Commit graph

134 commits

Author SHA1 Message Date
Evgenii Stepanov
8f5e67a98c Use a different linker for ASan binaries.
Another change in bionic/linker adds linker_asan/linker_asan64 that
know where to find ASan shared libraries.
Also, include linker_asan to the required packages list when building
for ASan.

Change-Id: I8ebe7c0091bbeb0c135708a891d33d9844373d37
2015-07-14 11:10:40 -07:00
Ying Wang
bbaeaa5879 Merge "Configure synci generation explicitly" 2015-07-01 18:58:52 +00:00
Evgenii Stepanov
bf140974b2 Move sanitized vendor libraries to /data/vendor/lib(|64).
Sanitized RPATH now mentions /system/vendor/lib to preserve overlay
in the case when a sanitized version of a vendor library can not be
built.

Bug: 22199458
Change-Id: I3222d2e1d6c08fdd1e0404fcb7db347aa4a92bb7
2015-06-30 14:04:45 -07:00
Evgenii Stepanov
4d3d4141ae With SANITIZE_TARGET, move shared libraries to /data.
A fully (or even mostly) asan-instrumented device will have 2 copies of each
shared library, which might not fit on system partition. Moving instrumented
libraries to /data.

Bug: 21785137
Change-Id: I64184261da2eb24a1382c67e4931c34a5a38b3c0
2015-06-19 11:15:50 -07:00
Dan Albert
abf4bc916a Add support for LOCAL_SANITIZE := integer.
This also does a bit of cleanup in config_sanitizers.mk. The result is
that `LOCAL_SANITIZE := <any arbitrary ubsan group>` should function
fine for both host and target.

This is a superset of LOCAL_DETECT_INTEGER_OVERFLOWS, so remove that.
This also checks integer division by zero.  It's supposed to cover
shifting undefined behaviors as well, but apparently it does not
(though `LOCAL_SANITIZE := shift` works fine).

Change-Id: I4ac99eafa6920a3f8cb82af37ce56ff0fdb95223
2015-06-19 10:28:06 -07:00
Nikola Veljkovic
91091280f1 Revert "[MIPS] Do not use compact branches until GDB supports them"
This reverts commit 063ef33089.
2015-06-17 17:22:26 +02:00
Nikola Veljkovic
063ef33089 [MIPS] Do not use compact branches until GDB supports them
GDB does not yet have support for compact branches, and is unable to
set a breakpoint on them. Turn compact branch generation off, until
GDB is fixed.

Change-Id: Ie7d6fb891e9934f8fc645fe9cf8f706be15a5f77
2015-05-25 16:27:01 +02:00
Duane Sand
3dfd20aea4 [MIPS] Temporarily disable Mips shared-textrel errors
Clang++ for Mips and Mips64 generates read-only exception unwind
tables that trigger DT_TEXTREL warnings at link time.  Until Clang
is fixed, ignore those performance warnings instead of failing the build.

With this patch, Mips clang++ can be (optionally) used when building
libdeqp.

NDK's Mips llvm has been using an alternate temporary fix, marking the
.gcc_exception_table section as read-write for Mips only:
   https://android-review.googlesource.com/#/c/119660/

A permanent fix using a read-only exception table is pending upstream:
   http://reviews.llvm.org/D9669

Change-Id: Ie0cd7da398acbe45dbe39adc251e7fd5b5ca1445
2015-05-13 11:07:20 -07:00
Chih-Hung Hsieh
90036610dd Upgrade x86 gcc to 4.9 and disable devirtualization.
Also filter out gcc-only flags -Wno-clobbered and -fno-devirtualize
when compiled with clang/llvm.

BUG: 19872411
Change-Id: I6de57583be04da607f569df65e93531787dbb789
2015-05-04 14:04:58 -07:00
Chris Dearman
ab3a5f490c Configure synci generation explicitly
The default for synci generation is compiler version dependent

Change-Id: I3f94cabd98c45aaa4e5149e8bb050dc47efa61ca
2015-04-30 13:22:16 -07:00
Evgenii Stepanov
f0b15e173b Fix AddressSanitizer link order and multilib setup.
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: I5c0cdb89e5e08a1950eb276e406da9f31a6e52dd
2015-04-27 14:48:35 -07:00
Dan Albert
b5b2ffe3be Add support for a partial ubsan build.
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
2015-04-17 11:37:03 -07:00
Dan Albert
4ed9508842 Merge "Add support for ubsan." 2015-04-15 22:06:15 +00:00
Stephen Hines
b992bfcf33 Use -Wno-format-pedantic to disable overly aggressive format string warning.
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
2015-04-10 09:12:38 -07:00
Dan Albert
08cca28f92 Add support for ubsan.
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
2015-04-08 15:52:04 -07:00
Chih-Hung Hsieh
9205bc1da6 Filter out gcc flags that are not recognized by clang.
Change-Id: I04e95fc3b0cb2825bf90a55916f89d25fa9fc475
2015-04-02 14:42:20 -07:00
Dan Albert
343ed674e3 Use prebuilt libclang_rt.profile.
Bug: 17574078
Change-Id: I4838cd5d125a0b2bf76aad2fdaef1ee3122687e8
2015-04-01 19:03:22 -07:00
Stephen Hines
9a98c47c64 Merge "Don't warn on definition of possibly reserved identifiers." 2015-04-01 18:50:29 +00:00
Stephen Hines
f68002187a Don't warn on definition of possibly reserved identifiers.
Change-Id: Icfcfa94aac0503c97dee0ff4d0cd49107201526d
2015-03-25 17:28:57 -07:00
Bernhard Rosenkränzer
a24a9a8e62 Allow -mcpu=cortex-a15 for clang
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>
2015-03-25 16:59:46 +01:00
Chih-Hung Hsieh
78df832481 Filter out unsupported flag: -fprefetch-loop-arrays
Change-Id: I55ba9045948a910ebd76c09f9f4ebb6b37eed1e7
2015-03-05 16:02:04 -08:00
Chih-Hung Hsieh
73e734bea5 Disable tail call optimization and use -mstackrealign to boot up on fugu.
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
2015-03-02 16:50:39 -08:00
Miao Wang
9b2908b4f6 Make bcc-compat able to pick the right mtriple flag for Renderscript
Compat Lib.

Change-Id: Ifb3093ebc392d107e874cee3a67b5f6e942c6e0a
2015-01-12 17:20:28 -08:00
Tim Murray
7c40fb95dc disable Krait for Mac builds to avoid assembler issues
Change-Id: Ie98f4dbc2cef92798ec08b43b93e7e0339a92a92
2014-12-09 14:28:57 -08:00
Dan Albert
b58fb4aac6 Let clang decide ASan linker flags for the host.
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
2014-12-05 14:52:56 -08:00
Stephen Hines
433f1614b0 Switch to Clang 3.6.
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
2014-12-03 15:11:09 -08:00
Stephen Hines
1568029218 Add more support for GLOBAL_CONLYFLAGS.
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
2014-12-01 15:36:26 -08:00
Ying Wang
a69e59623b am 478eda53: Merge "FORCE_BUILD_LLVM_COMPONENTS if HOST_PREFER_32_BIT."
* commit '478eda5365f866c830f957d6bd1aba3854d55bcc':
  FORCE_BUILD_LLVM_COMPONENTS if HOST_PREFER_32_BIT.
2014-11-07 00:58:32 +00:00
Ying Wang
e5d4e74f9f FORCE_BUILD_LLVM_COMPONENTS if HOST_PREFER_32_BIT.
Because we don't have 32-bit prebuilt libLLVM/libclang.

Change-Id: I86dac33e9bcbcb3d197f7d1e4c9d33bd4e7c473e
2014-11-06 14:11:33 -08:00
Stephen Hines
f1c5dd60b2 am 35e4ede5: Merge "Use automatic color option with the latest clang."
* commit '35e4ede5974053d05ae0f8791e60ba77a31907b3':
  Use automatic color option with the latest clang.
2014-11-04 17:44:44 +00:00
Stephen Hines
c141b85ef1 Use automatic color option with the latest clang.
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
2014-11-03 23:42:10 -08:00
Ying Wang
7f18adc240 am 871b8df1: Merge "Add -fcolor-diagnostics to global clang cflags."
* commit '871b8df128b144f39d40889e463722a032c4d246':
  Add -fcolor-diagnostics to global clang cflags.
2014-10-30 23:43:02 +00:00
Ying Wang
c7d1a973b0 Add -fcolor-diagnostics to global clang cflags.
Bug: 18187181
Change-Id: Ifcbe34b685b1dfd7ffc801bcdad7bd8208e45f86
2014-10-30 12:22:29 -07:00
Ian Rogers
508e27bfd7 am 93cb8c7d: Merge "Specify -mcpu=krait for clang."
* commit '93cb8c7d951b89eeb1e3cee2433bffecc13fdb11':
  Specify -mcpu=krait for clang.
2014-10-29 12:32:37 +00:00
Ian Rogers
e270873407 Specify -mcpu=krait for clang.
Change-Id: I64682cddf57246341c1727ca16c56f7ce0c6fd0a
2014-10-28 15:50:02 -07:00
Chih-Hung Hsieh
736a146c3c am 717ebfc1: Merge "Add unknown flag to CLANG_CONFIG_UNKNOWN_CFLAGS."
* commit '717ebfc13182202ab38e17c0cd008924e9e5c4e9':
  Add unknown flag to CLANG_CONFIG_UNKNOWN_CFLAGS.
2014-10-28 04:48:54 +00:00
Chih-Hung Hsieh
54fd82d111 am 660f3c9a: Merge "Set default to Clang integrated assembler."
* commit '660f3c9ae9cb99f428fb62fb6a1256679eb9f138':
  Set default to Clang integrated assembler.
2014-10-24 13:02:00 +00:00
Chih-Hung Hsieh
22b6c5c2c1 Add unknown flag to CLANG_CONFIG_UNKNOWN_CFLAGS.
BUG: 18108271
Change-Id: Id929cad31340d2946027603c1c8c8fb1cb60f66a
2014-10-23 16:39:09 -07:00
Chih-Hung Hsieh
57c8a15edd Set default to Clang integrated assembler.
BUG: 17820427
Change-Id: I10a6ddd94aad083665164d7939990e148b3b6efb
2014-10-22 09:21:53 -07:00
Bill Yi
13466f0f79 Merge commit '66b3e31936b99436e01c473dca492126eea3e336' into HEAD 2014-10-22 08:45:57 -07:00
Ying Wang
18cd02257d Merge "Add -Wno-unused-command-line-argument to clang cflags to enable ccache." 2014-10-21 19:19:16 +00:00
Ying Wang
24e03369cf Add -Wno-unused-command-line-argument to clang cflags to enable ccache.
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
2014-10-20 17:21:16 -07:00
Dan Albert
96983cba42 am cc0aa4da: am 28c265dd: Merge "We also need -rdynamic for host ASAN."
* commit 'cc0aa4dabd4bae2b17bc9de8f88e04e862d030b2':
  We also need -rdynamic for host ASAN.
2014-10-20 22:42:11 +00:00
Dan Albert
4ffe3f5b9f We also need -rdynamic for host ASAN.
Change-Id: Iee33ca85c25d9bf126be8318a3b837074ab10076
2014-10-20 13:54:27 -07:00
Dan Albert
66acb2a8ae resolved conflicts for merge of 96c22133 to lmp-dev-plus-aosp
Change-Id: I35a2f403e9e664536b45b5ac9185adf1e1a02442
2014-10-20 13:37:18 -07:00
Dan Albert
2daceaa83c Add support for ASAN in host modules.
Change-Id: Id9ed83499e0eb995f06e845c3153a50677d768b8
2014-10-20 11:37:18 -07:00
Chih-Hung Hsieh
25756c1422 am 8913e282: am 29373be8: Merge "Add -fPIC as default Clang mips ASFLAGS."
* commit '8913e28295a9f93121fa60f74a6ff39eadd2e86d':
  Add -fPIC as default Clang mips ASFLAGS.
2014-10-09 17:24:37 +00:00
Chih-Hung Hsieh
ce6300a5db Add -fPIC as default Clang mips ASFLAGS.
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
2014-10-08 15:41:29 -07:00
Stephen Hines
532376db67 am 56f688bc: Merge "Switch TBLGEN-related executables to use "BUILD_" instead of "HOST_"." into lmp-dev
* commit '56f688bce5f3229f065a94446d049bc3a055b92b':
  Switch TBLGEN-related executables to use "BUILD_" instead of "HOST_".
2014-10-01 23:01:29 +00:00
Stephen Hines
b34b7aeb31 Switch TBLGEN-related executables to use "BUILD_" instead of "HOST_".
Bug: 14416410
Change-Id: Ife2d7329795f229adcddc5c57b20aa96c56387c0
2014-09-30 02:37:20 -07:00