ASan runtime library (when using dynamic linking) must be the first
dependency of the main executable to achieve correct symbol
interposition. This matches how the clang driver works.
In multilib setup, ASan-RT name depends on the target arch:
/system/lib/libclang_rt.asan-arm-android.so
/system/lib64/libclang_rt.asan-arm64-android.so
We also set RPATH to /system/lib/asan or /system/lib64/asan
to have a place for ASan-only versions of system libraries.
Change-Id: I937d202077b6e433ba476c075d31be818b662d53
Also filter out gcc-only flags -Wno-clobbered and -fno-devirtualize
when compiled with clang/llvm.
BUG: 19872411
Change-Id: I6de57583be04da607f569df65e93531787dbb789
(cherry picked from AOSP commit 90036610dd)
Some of the ubsan checks expose a few pathological performance cases
in clang, and thus aren't suited to be used in SANITIZE_HOST.
This mode is also supported on the target despite not having the
target runtime libraries for ubsan by generating traps.
Change-Id: I0b0f0a08ca84d72e44e2174a66726b1c5e5cad7e
Bug: 20148343
The latest clang warns on "%p" being used with non-void pointer types, which
would require a great deal of cleanup in several sub-projects.
Change-Id: I4175d5cf8709504455067c906a2eb8ccc8e25432
Rather than adding LOCAL_UB_SANITIZER, LOCAL_THREAD_SANITIZER, etc for
each new sanitizer, deprecate LOCAL_ADDRESS_SANITIZER in favor of
LOCAL_SANITZE that mirrors the behavior of -fsanitize=<sanitizers>.
For example, the following will use both asan and ubsan:
LOCAL_SANITIZE := address undefined
We'll leave LOCAL_ADDRESS_SANITIZER around for compatibility until we
can clean up the tree.
Change-Id: I8a62315129d4753f8e992584ca6db1e5dfdd4d2a
Clang 3.6 (including the snapshot present in AOSP) added support for
-mcpu=cortex-a15 -- there's no need to fall back to generic armv7-a
anymore.
Change-Id: I8a582261ac35e32f8f1def1d244cf83f2096520d
Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org>
http://llvm.org/bugs/show_bug.cgi?id=15086,
llvm tail call optimization is wrong for x86.
For Android/x86 to use SSE* instructions safely, stack should be 16-byte
aligned before JNI function call, which isn't true for all x86 device,
so -mstackrealign should be the default.
BUG: 19234330
Change-Id: I4c6676366788772dbe64fd7f0dd33b3ed5c9b80e
Pass -fsanitize=address instead of manually specifying asan libraries
and other linker flags.
Note that we enable LOCAL_ALLOW_UNDEFINED_SYMBOLS by default for host
builds because ASAN only links symbols in the final executable, so
there will _always_ be undefined symbols in intermediate libraries.
Bug: 18208352
Change-Id: Ief55ab296e94974560eeb10507ec8d90f0025d5c
This change also defaults C compilations with clang to gnu99, and turns off
the -Winconsistent-missing-override flag, since we need further cleanup to
turn it on. -finline-functions is an unnecessary flag that only gcc needs.
Change-Id: I1cfcaedca32d9e3c248a6aa9460603205901c491
This will be necessary to support -std=gnu99 mode for clang 3.6, which
defaults to C11 mode (unlike prior releases that use C99).
Change-Id: Iea84582f9f12ba76b988463cbc0a20bd61042538
Bug: 18187181
Now that I checked in the latest prebuilts, clang will automatically use
color on terminals and no color on redirection to files or non-terminals.
Change-Id: I9be00c44947946cc18ce59c936b7f45d0ce2b6fc
Previously ccache is disabled when it fails calling clang's preprocessor with
unused arguments (such as '-Wa,--noexecstack') in the command line.
See http://petereisentraut.blogspot.com/2011/05/ccache-and-clang.html.
(-Qunused-arguments suppresses more than
-Wno-unused-command-line-argument does.)
Change-Id: I6cde307632c8395c053eb28063d7844d93070562
For mips target, gcc passes -KPIC to assembler by default,
but clang passes -KPIC only if -fPIC or -fpic is given.
BUG: 17895505
Change-Id: I7803adaf8ad7b40c6473872b67f4e0b4c502b38a