mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 22:02:23 +01:00
Port Bazel toolchain and code to macOS (x86). (#238)
This updates the Bazel toolchain logic to work on macOS. Much like on Linux, I'm not testing this against a *released* LLVM, but against a from-source build. You can build and install LLVM from top-of-tree locally with CMake, or on macOS maybe use Homebrew like: ``` brew install llvm --HEAD ``` You then need to point Bazel to the installed `clang` executable if it is not placed onto your PATH (Homebrew doesn't): ``` bazel test --repo_env=CC=$HOME/homebrew/opt/llvm/bin/clang //parser:all ``` This builds and passes tests for me at least. The fuzzer feature may not work (yet) with this setup, but that can be improved incrementally as we proceed.
This commit is contained in:
@@ -54,7 +54,12 @@ auto SourceBuffer::CreateFromFile(llvm::StringRef filename)
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
void* mapped_text = mmap(nullptr, size, PROT_READ, MAP_PRIVATE | MAP_POPULATE,
|
||||
void* mapped_text = mmap(nullptr, size, PROT_READ,
|
||||
#ifdef __APPLE__
|
||||
MAP_PRIVATE,
|
||||
#else
|
||||
MAP_PRIVATE | MAP_POPULATE,
|
||||
#endif
|
||||
file_descriptor, /*offset=*/0);
|
||||
if (mapped_text == MAP_FAILED) {
|
||||
return ErrnoToError(errno);
|
||||
|
||||
Reference in New Issue
Block a user