Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
Fuchsia OS
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hacrwang
Fuchsia OS
Commits
352bd5aa
Commit
352bd5aa
authored
7 years ago
by
Jake Ehrlich
Browse files
Options
Downloads
Patches
Plain Diff
Fixed issues raised by Roland
Change-Id: I980a679ef7483dda9fc8b98b154fa0dbae730356
parent
a2761a7c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
toolchain.md
+12
-12
12 additions, 12 deletions
toolchain.md
with
12 additions
and
12 deletions
toolchain.md
+
12
−
12
View file @
352bd5aa
...
...
@@ -136,41 +136,41 @@ options:
cmake
-G
Ninja
-DCMAKE_BUILD_TYPE
=
Debug
-DCMAKE_C_COMPILER
=
${
CLANG_TOOLCHAIN_PREFIX
}
clang
-DCMAKE_CXX_COMPILER
=
${
CLANG_TOOLCHAIN_PREFIX
}
clang++
-DLLVM_ENABLE_LTO
=
OFF
-DFUCHSIA_x86_64_SYSROOT
=
${
FUCHSIA_x86_64_SYSROOT
}
-DFUCHSIA_aarch64_SYSROOT
=
${
FUCHSIA_aarch64_SYSROOT
}
-C
${
LLVM_SRCDIR
}
/tools/clang/cmake/caches/Fuchsia-stage2.cmake
${
LLVM_SRCDIR
}
```
## Building
with
sanitize
r support
## Building sanitize
d versions of LLVM tools
For the purposes of explanation we'll explain how to build with ASan. To build
with ASan support you first need to build libc++ with ASan support. You can do
this in the same build as long as you don't modify libc++. To setup a build with
ASan support first run CMake with
`LLVM_USE_SANITIZER=Address`
and
`LLVM_ENABLE_LIBCXX=ON`
.
Most sanitizers can be used on LLVM tools by adding
`LLVM_USE_SANITIZER=<sanitizer name>`
to your cmake invocation. MSan is
special however because some llvm tools trigger false positives. To build with
MSan support you first need to build libc++ with MSan support. You can do this
in the same build. To set up a build with MSan support first run CMake with
`LLVM_USE_SANITIZER=Memory`
and
`LLVM_ENABLE_LIBCXX=ON`
.
```
bash
cmake
-G
Ninja
-DCMAKE_BUILD_TYPE
=
Debug
-DLLVM_USE_SANITIZER
=
Address
-DLLVM_ENABLE_LIBCXX
=
ON
-DCMAKE_C_COMPILER
=
${
CLANG_TOOLCHAIN_PREFIX
}
clang
-DCMAKE_CXX_COMPILER
=
${
CLANG_TOOLCHAIN_PREFIX
}
clang++
-DLLVM_ENABLE_LLD
=
ON
${
LLVM_SRCDIR
}
cmake
-G
Ninja
-DCMAKE_BUILD_TYPE
=
Debug
-DLLVM_USE_SANITIZER
=
Memory
-DLLVM_ENABLE_LIBCXX
=
ON
-DCMAKE_C_COMPILER
=
${
CLANG_TOOLCHAIN_PREFIX
}
clang
-DCMAKE_CXX_COMPILER
=
${
CLANG_TOOLCHAIN_PREFIX
}
clang++
-DLLVM_ENABLE_LLD
=
ON
${
LLVM_SRCDIR
}
```
Normally you would run Ninja at this point but we want to build everything
using a sanitized version of libc++ but if we build now it will use libc++ from
`${CLANG_TOOLCHAIN_PREFIX}`
which isn't sanitized. So first we build just
the libcxx and libcxxabi targets:
the cxx and cxxabi targets. These will be used in place of the ones from
`${CLANG_TOOLCHAIN_PREFIX}`
when tools dynamically link against libcxx.
```
bash
ninja
lib
cxx
lib
cxxabi
ninja cxx cxxabi
```
Now that we have a sanitized version of libc++ we can have our build use it
instead of the one from
`${CLANG_TOOLCHAIN_PREFIX}`
and then build everything.
```
bash
LD_LIBRARY_PATH
=
`
pwd
`
/lib
ninja
```
Putting that all together
Putting that all together
:
```
bash
cmake
-G
Ninja
-DCMAKE_BUILD_TYPE
=
Debug
-DLLVM_USE_SANITIZER
=
Address
-DLLVM_ENABLE_LIBCXX
=
ON
-DCMAKE_C_COMPILER
=
${
CLANG_TOOLCHAIN_PREFIX
}
clang
-DCMAKE_CXX_COMPILER
=
${
CLANG_TOOLCHAIN_PREFIX
}
clang++
-DLLVM_ENABLE_LLD
=
ON
${
LLVM_SRCDIR
}
ninja libcxx libcxxabi
LD_LIBRARY_PATH
=
`
pwd
`
/lib
ninja
```
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment