Commit graph

415 commits

Author SHA1 Message Date
Alex Light
a08ae8487c Remove -fno-emulated-tls from linux_bionic
This was preventing tools using 'thread_local' from compiling and is
not needed. Bionic fully implements TLS.

Test: cd tools/dexter/slicer; mma
Bug: 31559095
Change-Id: Ib362ad8bc950726080356b61ccae83f155ce040b
2018-10-31 11:18:22 -07:00
Chih-Hung Hsieh
53390f2557 DO NOT MERGE, Make default -Wimplicit-fallthrough as error.
Other branches might still have this warning for some build targets.

Bug: 112564944
Test: make checkbuild
Change-Id: I3db52b8a60bb28861fc9ba963a7d1cd1fe49e903
2018-10-31 18:04:22 +00:00
Peter Collingbourne
63c6361f91 Merge "Enable safe ICF with LLD." 2018-10-27 00:59:55 +00:00
Treehugger Robot
33195833de Merge "Enable SHT_RELR sections to encode relative relocations." 2018-10-25 21:02:44 +00:00
Peter Collingbourne
486e42c353 Enable safe ICF with LLD.
Support for safe ICF was added to LLD in LLVM r337429. This reduces
the size of sailfish system.img by 7.6MB.

The address-significance tables created by Clang to support LLD's
implementation of safe ICF are incompatible with ld -r. Therefore we
need to pass -fno-addrsig to the compiler to prevent it from creating
an address-significance table when building a cc_object.

Change-Id: I83e28741e6b3cdf09566447d2658ce48594f2074
2018-10-25 13:40:28 -07:00
Peter Collingbourne
98d8580c3a Prevent clang from using the x18 register on arm64.
This is achieved via the compiler flag -ffixed-x18 for non-LTO builds
and the linker flag -plugin-opt -mattr=+reserve-x18 for LTO builds.

This change should be reverted once we upgrade past LLVM r340889
which does this by default on Android.

Bug: 112907825
Bug: 111759196
Change-Id: I05473ddbb98319d87d442425b4d715647eae3a38
2018-10-24 23:40:49 +00:00
Dan Willemsen
9ff34c0ca8 Update linux_bionic configuration
Add a missing toolchain method, don't require modules to opt in to
linux_bionic.

Bug: 31559095
Test: attempt to build host bionic
Change-Id: Ia5c8e2f127b88f56191b7abc389d5329cfdb0720
2018-10-22 15:46:03 -07:00
Rahul Chaudhry
1ffac8e636 Enable SHT_RELR sections to encode relative relocations.
Proposal for adding SHT_RELR sections in the generic-abi is at
https://groups.google.com/forum/#!topic/generic-abi/bX460iggiKg

This CL requires clang-r328903.

The following test results are on clang-r339409.

Size comparison for "aosp_marlin-userdebug":
$ du -B1 -s {none,pack,relr,both}/out/target/product/marlin/system
1014616064      none/out/target/product/marlin/system
1001074688      pack/out/target/product/marlin/system
1004273664      relr/out/target/product/marlin/system
1000099840      both/out/target/product/marlin/system

none contains a build with no packing (--pack-dyn-relocs=none).
pack contains a build with current settings (--pack-dyn-relocs=android).
relr contains a build with relr packing only (--pack-dyn-relocs=relr).
both contains a build with both options enabled (--pack-dyn-relocs=android+relr).

With --pack-dyn-relocs=android+relr, lld will encode the relative
relocations in a SHT_ANDROID_RELR section, and pack the rest of
the dynamic relocations in a SHT_ANDROID_REL(A) section.

--pack-dyn-relocs=android was saving us 13,541,376 bytes (1.35%) (none - pack).
--pack-dyn-relocs=relr will save us 10,342,400 bytes (1.03%) (none - relr).
--pack-dyn-relocs=android+relr is saving us 14,516,224 bytes (1.45%) (none - both).

Size comparison for the "system/bin" directory:
$ du -B1 -s {none,pack,relr,both}/out/target/product/marlin/system/bin
29413376        none/out/target/product/marlin/system/bin
28319744        pack/out/target/product/marlin/system/bin
28258304        relr/out/target/product/marlin/system/bin
28180480        both/out/target/product/marlin/system/bin

--pack-dyn-relocs=android was saving us 1,093,632 bytes (3.72%) (none - pack).
--pack-dyn-relocs=relr will save us 1,155,072 bytes (3.93%) (none - relr).
--pack-dyn-relocs=android+relr is saving us 1,232,896 bytes (4.19%) (none - both).

Bug: None
Test: Built aosp_marlin-userdebug image, boots on device.
Test: Built aosp_x86_64-userdebug image, boots in emulator.
Change-Id: Ibb726c3b9d87688f387a7f2974fdae9bfc24efc9
2018-10-22 20:29:39 +00:00
Logan Chien
aceb86e345 Merge "Remove flags from ClangLibToolingUnknownCflags"
am: 0b6bcd4014

Change-Id: I7f7e9e80052e748c1d92f46fee4552c1b4a45a2b
2018-10-17 03:08:54 -07:00
Logan Chien
0b6bcd4014 Merge "Remove flags from ClangLibToolingUnknownCflags" 2018-10-17 09:46:26 +00:00
Logan Chien
61f2d11e75 Remove flags from ClangLibToolingUnknownCflags
This commit removes flags from ClangLibToolingUnknownCflags.  These
flags were added to workaround an old version of clang in
`external/clang`.  Since we have updated to clang-r339409b, we don't
need these workaround anymore.

Bug: 117764794
Test: development/vndk/tools/header-checker/utils/create_reference_dumps.py
Change-Id: Ifbeebf05df5c08ee3bb7d489f39250d8fd5f5acf
2018-10-16 17:52:12 +08:00
Haibo Huang
3df2d5986a Merge "Add support for cortex-a76 in soong"
am: 2bfa2c852c

Change-Id: Ieabcb61634e3e60f26589837b8c0d3c29d072371
2018-10-15 14:15:52 -07:00
Haibo Huang
a31e2bda89 Add support for cortex-a76 in soong
Bug: 117125298
Test: Change a device to be A76 and build
Change-Id: Iae0773d54e57b247c818d44f8044180d5a3f95a8
2018-10-12 23:55:38 +00:00
Kostya Kortchinsky
b03b69be6d Merge "Scudo minimal runtime support for Soong"
am: d054c225fb

Change-Id: Ia506665582e4668d6ca29d1a1680c889844a95d1
2018-10-12 10:03:30 -07:00
Kostya Kortchinsky
d054c225fb Merge "Scudo minimal runtime support for Soong" 2018-10-12 16:49:31 +00:00
Kostya Kortchinsky
ad73b2e18a Scudo minimal runtime support for Soong
Scudo is now compatible with the -fsanitize-minimal-runtime, and offers a new
dynamic library that doesn't bundle UBSan.

This patch adds support for this new library in Soong, preferring it over the
full one, unless a UBSan or diagnostic dependency is found.

Test: aosp compiled with m -j
Test: local test enabling Scudo for tombstoned
Change-Id: I17794131db148b33f8a8710ac43302cadf1af314
2018-10-11 11:55:16 -07:00
Pirama Arumuga Nainar
2985a30e1e Merge changes from topic "windows-libcxx"
am: f4ecf76b2d

Change-Id: I9bc7c290899afe5aa6e15730ae812e23ed665c16
2018-10-11 10:22:26 -07:00
Pirama Arumuga Nainar
5f193cb677 Change STL for Windows to libc++.
am: a403cc7254

Change-Id: Ieb1487d7c6dcc200ca0cf1dafa10378803de6b05
2018-10-11 10:22:08 -07:00
Pirama Arumuga Nainar
6048e3c52d Merge "Switch to clang-r339409b"
am: 3558470d28

Change-Id: I75a339f7cc25227a8e709b6267dbeb8797353d22
2018-10-11 10:21:36 -07:00
Pirama Arumuga Nainar
f4ecf76b2d Merge changes from topic "windows-libcxx"
* changes:
  Remove --allow-multiple-definitions for 32-bit Windows
  Change STL for Windows to libc++.
2018-10-11 17:00:53 +00:00
Pirama Arumuga Nainar
8fd5a96959 Remove --allow-multiple-definitions for 32-bit Windows
Bug: http://b/109759970
Bug: http://b/91353691

There are no multiple-defintion errors after switching to clang-r339409
and libc++.

Test: m native-host-cross
Change-Id: I5576b3894ed1d88c9b2e5f4d92e1d3bfadfb029b
2018-10-10 20:10:15 +00:00
Pirama Arumuga Nainar
a403cc7254 Change STL for Windows to libc++.
- Stop including libstdc++ headers.
- '-pthread' and 'static-libgcc' are unused when we pass -nodefaultlibs.
We didn't pass -nodefaultlibs for libstdc++.
- Use SjLj exceptions for 32-bit.  libgcc_eh implements SjLj exception
model for 32-bit.
- Disable visibility annotations for libcxx and libcxxabi since we are
only going to support these as static libraries.
- Use Win32 threads.  MinGW pthreads throws an error when building
libcxx since it's pthread_mutex_initializer is not constant (needs a
cast).
- Link libgcc_eh, which needs pthread, which in turn depends on
kernel32.  Wrap the libraries with --start-group and --end-group and
remove duplicates.

Test: Build and test Windows binaries under Wine.

Change-Id: I8be51b004585e11ef51b7d5012f2a51330d1260f
2018-10-10 20:09:37 +00:00
Pirama Arumuga Nainar
14b3cb0ab3 Switch to clang-r339409b
Bug: http://b/117499735

Test: clang-tools build, AOSP taimen build and TH
Change-Id: I9fada181e2cb85e65c66672f870b59e8da0be9ce
2018-10-10 18:38:11 +00:00
Dan Willemsen
dc1b833df0 Remove GCC-specific toolchain methods
am: bd4abf5dfc

Change-Id: Iaea003158a8fddcd73eee1dcc2c7803687a15e71
2018-10-09 22:46:52 -07:00
Dan Willemsen
bd4abf5dfc Remove GCC-specific toolchain methods
Test: m
Change-Id: I06442347ade2d60bc42131b3126ecc17840c9e31
2018-10-09 19:44:54 -07:00
Dan Willemsen
6e9fe7c6ec Merge "Restore lld parts of "Remove cortex-a53 linker workaround for new cpus.""
am: 55e095b6d8

Change-Id: I8f9d87561e02ffbeb0aae0f9435ad971c9bc1e2f
2018-10-09 16:26:41 -07:00
Dan Willemsen
e28663fb28 Restore lld parts of "Remove cortex-a53 linker workaround for new cpus."
https://android-review.googlesource.com/c/platform/build/soong/+/689585
added, but was skipped going into pi-dev-plus-aosp, as the pi-dev
version (which did not have these lld bits) was already merged there.
When pi-dev-plus-aosp was pushed to aosp-master, this got lost.

Merged-In is a random git_master change, since this needs to go
into pi-dev-plus-aosp too, but no further.

Bug: 78133793
Test: git diff aosp-master..master -- cc/config/arm64_device.go
Change-Id: Iea69a2c040d11249e43a76a78859944274ce6a92
Merged-In: I7799feac522a1097ec4271bd7868cd6bfe147ad9
2018-10-09 14:44:46 -07:00
Dan Willemsen
5d7598005a Remove GCC checks
am: 8536d6b3b7

Change-Id: I1ba28f29238db813a683169a6113baea33095f4c
2018-10-08 19:34:53 -07:00
Dan Willemsen
8536d6b3b7 Remove GCC checks
Clang is always used now, so we can remove all the GCC checks. Removing
GCC-specific configuration will happen in the next CL.

Test: m
Change-Id: I4835ecf6062159315d0dfb07b098e60bff033a8a
2018-10-09 02:16:58 +00:00
Chih-Hung Hsieh
cfba3658f4 Merge "Add default -Wimplicit-fallthrough."
am: 230e4c77a5

Change-Id: I15e7cbf40722360d91cafc196e4a9a908338df56
2018-10-08 18:02:54 -07:00
Chih-Hung Hsieh
bd783f13c1 Add default -Wimplicit-fallthrough.
After we fix all existing such warnings, it can be changed to an error.

Bug: 112564944
Test: make checkbuild
Change-Id: I61ee3a24a3f992ef018cfe6c995e957416551183
2018-10-08 22:12:35 +00:00
Chih-hung Hsieh
88eb6873f5 Merge "Revert "Disable performance-noexcept-move-constructor check.""
am: 66ee92f3c1

Change-Id: I5c5636b8194b13fc54bb4fdaf58c40c5b39fce11
2018-10-05 16:15:34 -07:00
Treehugger Robot
66ee92f3c1 Merge "Revert "Disable performance-noexcept-move-constructor check."" 2018-10-05 23:01:46 +00:00
Chih-hung Hsieh
fac4eec15e Revert "Disable performance-noexcept-move-constructor check."
This reverts commit 1b5470afe1.

Reason for revert: Most of these warnings were fixed.

Change-Id: I63ada2b7d6f3d6a446a8fbfc9221dee668c7a30b
2018-10-05 18:45:06 +00:00
Pirama Arumuga Nainar
b56f1e22a7 Remove --allow-multiple-definion linker flag for 64-bit Windows
am: b83de950e7

Change-Id: Iff346710722c019a059639b99fd61866833741e2
2018-10-03 14:03:08 -07:00
Pirama Arumuga Nainar
b83de950e7 Remove --allow-multiple-definion linker flag for 64-bit Windows
Bug: http://b/109759970

r335286 fixed this for 64-bit Windows.  This remains broken for 32-bit
Windows.

Test: m native-host-cross
Change-Id: I4d11b83d51db055406c6723aad89efd1b86b9b7b
2018-10-03 11:40:23 -07:00
Stephen Hines
f4fe6300e6 Merge "Switch to clang-r339409."
am: ee15f2a7c7

Change-Id: Ic7de9d629900ce71315029a82f32a89a11c730be
2018-10-01 09:20:41 -07:00
Stephen Hines
c91ab9eb6d Switch to clang-r339409.
This also changes over llvm-strip to use the -o flag, rather than
relying on nonstandard (and no longer functional) positional arguments.

Bug: http://b/111998531
Test: Multiple new builds. For googlers - http://go/clang-r339409-testing
Change-Id: I8c82d06304af24a001e6552e36e2f540d8e364ce
2018-09-26 21:15:08 +00:00
Pirama Arumuga Nainar
783591182e Merge "GccCppStdVersion should not be needed anymore"
am: e12f5e23c2

Change-Id: I5ad9f5f976faa0ba52c87b64bd82275c65e54bf9
2018-09-26 13:32:27 -07:00
Treehugger Robot
e12f5e23c2 Merge "GccCppStdVersion should not be needed anymore" 2018-09-26 20:19:01 +00:00
Chih-Hung Hsieh
4bea350243 Merge "Disable performance-noexcept-move-constructor check."
am: 0d565c1afa

Change-Id: If7fc844e8225184e963b8da3dc56f313dcad4264
2018-09-25 14:29:01 -07:00
Pirama Arumuga Nainar
43cfe82174 GccCppStdVersion should not be needed anymore
Test: Build
Change-Id: I2cd16deed269fb40a59754dec94b376383346bf0
2018-09-25 21:27:45 +00:00
Chih-Hung Hsieh
1b5470afe1 Disable performance-noexcept-move-constructor check.
This reduces amount of warnings in default builds,
until we add noexcept to those move constructors.

Bug: 116614593
Test: build with WITH_TIDY=1
Change-Id: Iaa9e9480dbc72a7370ccbe10ed232b87dc8d6184
2018-09-25 20:25:57 +00:00
Richard Fung
82b39d59df Merge "Add support for cortex-a72"
am: 3013361546

Change-Id: I1add4a9a88d4a840d9ab699f3e8d53780f849441
2018-09-25 08:35:18 -07:00
Richard Fung
eb37ed3832 Add support for cortex-a72
Bug: 113346253
Test: lunch cheets_arm64-eng; m
Change-Id: I02dd1cfe75f97767eac7424d472ff643987c276b
2018-09-24 16:33:45 -07:00
Chih-Hung Hsieh
0a4427da81 Use WITH_TIDY_FLAGS env variable.
am: 9e5d8a60e2

Change-Id: I42b0ba1ee10ab4a3290b355c40009081ed101376
2018-09-21 17:40:53 -07:00
Chih-Hung Hsieh
9e5d8a60e2 Use WITH_TIDY_FLAGS env variable.
This variable is a space separated string of clang-tidy flags to be passed
to clang-tidy before any other system required extra flags.
Note that when this flag or local tidy_flags is defined,
the default -header-filter flag is suppressed.

Test: make with WITH_TIDY=1 WITH_TIDY_FLAGS="-extra-arg=-DABCD1=1 -extra-arg=-DABCD2=2"
Bug: 32668284
Change-Id: If7bd31c65404ef7fe6c3499d51f0f209a704efd9
2018-09-21 15:19:24 -07:00
Chih-Hung Hsieh
5e669eff0a Use DEFAULT_TIDY_HEADER_DIRS env variable.
am: 60bd4bf079

Change-Id: I4c34db5d306beb15cf8160aa905c06b8459ea8f6
2018-09-21 12:26:07 -07:00
Chih-Hung Hsieh
60bd4bf079 Use DEFAULT_TIDY_HEADER_DIRS env variable.
This variable is a regular expression to be passed as
additional patterns to the -header-filter flag for clang-tidy.
For example, when make with WITH_TIDY=1 DEFAULT_TIDY_HEADER_DIRS="d1/d2|mydir/*"
for a project in external/xyz, clang-tidy will be called with additional flag
  -header-filter=\"(external/xyz|d1/d2|mydir/*)\"

Test: make with WITH_TIDY=1 DEFAULT_TIDY_HEADER_DIRS="d1/d2|mydir/*"
Bug: 32668284
Change-Id: I6051f4f80bc6dbab882bd81435ccbc772772ac63
2018-09-21 10:34:25 -07:00
Dan Willemsen
d877b27eea Merge "Remove GCC support from Make"
am: 2f7e3bb4d0

Change-Id: I32d17dca901bfc7b32f9305fee63f3ebbb58835a
2018-09-06 19:58:11 -07:00
Dan Willemsen
f640dbcd1f Remove GCC support from Make
We need to keep support in Soong until toolchain_library no longer uses
GCC.

Test: out/build-aosp_arm64.ninja is the same before/after
Test: build_test on downstream branches
Change-Id: Ib78bcd6d5544afc3a3164f65fa72a3f08b2acf29
2018-09-06 22:37:54 +00:00
Yi Kong
ec11aef9cd Merge "Add BuiltinsRuntimeLibrary"
am: e944600978

Change-Id: I009085ecc3b340db8a92154ead624c5059ffdcdc
2018-08-31 17:45:16 -07:00
Yi Kong
924adc4d17 Add BuiltinsRuntimeLibrary
... and rename SanitizerRuntimeLibrary to LibclangRuntimeLibrary since
some of them are not sanitizers.

Bug: 29275768
Test: m
Change-Id: Id638adea42d22b02438fce26120aa155bea14d42
2018-08-31 14:53:54 -07:00
Pirama Arumuga Nainar
ecdcb62d22 Use Windows security mitigation features: ASLR, DEP
am: 191f646295

Change-Id: Ie182452ca1ac3a9fb959fd887421763445c646e4
2018-08-30 16:21:36 -07:00
Pirama Arumuga Nainar
191f646295 Use Windows security mitigation features: ASLR, DEP
Bug: https://issuetracker.google.com/36952278
Bug: http://b/113171785

From
https://android-review.googlesource.com/c/platform/system/core/+/737292:

The --dynamicbase linker flag enables use of Address Space Layout
Randomization (ASLR) on Windows Vista and newer. It causes the code
segment / module to be loaded at unpredictable addresses to make
exploits harder to construct.

The --nxcompat linker flag enables use of Data Execution Protection
(DEP) on Windows XP SP2 and newer. It causes the process to be killed if
the process tries to execute code on memory pages not marked executable.
This makes exploits harder to construct because the stack is then not
executable, other data pages aren't, etc.

These bits are already set on AdbWinApi.dll and AdbWinUsbApi.dll.

--high-entropy-va provides improved ASLR.

Credit: Spencer Low for doing the initial work at
https://android-review.googlesource.com/c/platform/system/core/+/737292.

Test: Verify that DLLCharacteristics reported by 'objdump -x' is:
      0x140 for 32-bit and 0x160 for 64-bit.  Also verified trivial use
      cases under Wine.

Change-Id: I1b898cd36c7c627916dae9ce7dfd1c27de1e3c59
2018-08-30 12:54:33 -07:00
Dan Willemsen
d83ba979f4 Clean up darwin cc toolchain
am: e97e68a05a

Change-Id: I3adf41a6b8eab2bee60c518fb9465ad70de9d9e5
2018-08-28 21:24:07 -07:00
Dan Willemsen
e97e68a05a Clean up darwin cc toolchain
Remove the ability for Soong to build 32-bit darwin code. We've already
disabled this in Make, this is just removing the unused bits in Soong
and simplifing the toolchain config.

Test: m host
Test: build/soong/scripts/build-ndk-prebuilts.sh
Change-Id: I968c5d98bdf162297d639f7988918dadb7ba6e07
2018-08-28 20:08:50 -07:00
Dan Willemsen
58f6fed8e2 Merge "Support Mac 10.14 SDK"
am: 6dcc81c3c6

Change-Id: I0231c56f893d13be29a571669df7604f91a5873f
2018-08-28 19:04:43 -07:00
Treehugger Robot
6dcc81c3c6 Merge "Support Mac 10.14 SDK" 2018-08-29 01:53:42 +00:00
Dan Willemsen
5a050c0183 Support Mac 10.14 SDK
Now that we don't compile 32-bit binaries, this seems to work, at least
in Xcode 10 beta 6.

Test: m checkbuild host
Change-Id: I61a98a3c31b331d6d01cd633f8d949fad86047cb
2018-08-28 16:48:45 -07:00
Chih-hung Hsieh
4cef9cbbad Merge "Define PATH_TO_CLANG_TIDY_SHELL for build/make rules."
am: 4b42edbca0

Change-Id: Ie19f560057ef5d3e2ef0671e8af42dd3d1261626
2018-08-28 12:21:36 -07:00
Chih-Hung Hsieh
b699c43f89 Define PATH_TO_CLANG_TIDY_SHELL for build/make rules.
* PATH_TO_CLANG_TIDY_SHELL is ${config.ClangTidyShellPath},
  wich is "build/soong/scripts/clang-tidy.sh"

Bug: 110538415
Test: build with WITH_TIDY=1
Change-Id: I27d7be095c998583fa9ad4d705aa1332bd018140
2018-08-27 16:19:59 -07:00
Chih-Hung Hsieh
1cc0227af2 Remove flto dependent flags when -flto is removed.
am: 9e88ba9f22

Change-Id: I174a627fe877f66b81ae889a82eefadff8216dc4
2018-08-24 12:53:01 -07:00
Chih-Hung Hsieh
9e88ba9f22 Remove flto dependent flags when -flto is removed.
* C++ source files could be compiled with "-fwhole-program-vtables"
  in cppflags. We need to filter out those flto dependent flags
  in flags.CppFlags and use flags.toolingCppFlags instead of
  flags.cppFlags.

Test: build with WITH_TIDY=1
Change-Id: Ic2b0f99b95a5f0422f879226e6f6060cab71456a
2018-08-24 18:42:22 +00:00
Chih-hung Hsieh
5761ca65c6 Merge "Add clang-tidy.sh to filter out troublesome flags."
am: a644fbfa2c

Change-Id: I79f64979576431e85d6196110615450da1c4eea3
2018-08-23 15:34:55 -07:00
Chih-Hung Hsieh
a7aa958e6e Add clang-tidy.sh to filter out troublesome flags.
* Some flags are accepted by clang but not clang-tidy.
  They could cause the diagnostic-unused-command-line-argument warning.
  Flag -flto messed up the -I flags.
* Add clang-diagnostic-unused-command-line-argument to
  default clang-tidy checks.
* Move CLANG_TIDY_UNKNOWN_CFLAGS to build/make/core/clang/tidy.mk.

Bug: 111850071
Bug: 111885396
Test: build with WITH_TIDY=1
Change-Id: Iabeeb27715acf83ef6aafe3e77206b9a01a0d889
2018-08-22 09:21:45 -07:00
Evgenii Stepanov
72a8984921 Merge "Add "hwaddress" sanitizer."
am: 9b4f9afbaf

Change-Id: I163b6cbcf9c14ee6fd7a55b86f5db642abe52d0a
2018-08-20 17:11:00 -07:00
Evgenii Stepanov
d97a6e9483 Add "hwaddress" sanitizer.
This is a new sanitizer similar to ASan, but with a few differences
from the build system perspective:
* Only runs on AArch64.
* Supports static binaries.
* Bionic itself will be built with HWASan.
* Does not have any "if a library is sanitized than the binary must
  be, too" requirements unlike ASan. Even better, individual static
  libraries can be freely sanitized or not. We propagate "nosanitize"
  from binaries to static libraries anyway, because otherwise there
  is no good way to disable hwasan on a binary as a whole.

Same a CFI, we export a list of sanitized static libraries to make.
In fact, we export separate lists for vendor and regular libraries,
because it is possible for one to be sanitized without the other
(i.e. there can be mylib.hwasan.vendor w/o mylib.hwasan or vice
versa).

Bug: 112438058, 112709969
Test: manual, part of a bigger patch set

Change-Id: Ie4fdeb522ac03cf9684526882e84dfee3807b6a7
2018-08-16 13:18:47 -07:00
Logan Chien
42cf4b8715 Merge "Remove LinuxClangCppflags" am: 7a1d4418d6
am: dc9321b257

Change-Id: I0988dcf773d249db6b636c936bc4b6b05e79f686
2018-07-31 11:00:34 -07:00
Logan Chien
dc9321b257 Merge "Remove LinuxClangCppflags"
am: 7a1d4418d6

Change-Id: I5507797e2ff5e7c08b9dfd1d04d15d29c290ac69
2018-07-31 10:56:27 -07:00
Logan Chien
7a1d4418d6 Merge "Remove LinuxClangCppflags" 2018-07-31 17:51:17 +00:00
Logan Chien
bef00a2c52 Remove LinuxClangCppflags
This commit removes LinuxClangCppflags.  Adding these `-isystem` flags
results in build failures when we build a module with `libc++_host`.
Furthermore, these headers are not being used anymore.

Bug: 111579848
Test: make checkbuild  # on aosp and internal
Change-Id: Ideca268431d9d60d383e3e5b7bb3f73ece416bd2
2018-07-31 01:45:00 +08:00
Chih-Hung Hsieh
bafbeac702 Do not pass -flto dependent flags to clang-tidy. am: ff7cff7268
am: 9e7e09b77a

Change-Id: Ia26281d74e74cb4aa6f111e2273a012e9a266350
2018-07-26 20:23:10 -07:00
Chih-Hung Hsieh
9e7e09b77a Do not pass -flto dependent flags to clang-tidy.
am: ff7cff7268

Change-Id: I0da058960c67b69ecf2df63e5f2b385b82eea80e
2018-07-26 20:19:07 -07:00
Chih-Hung Hsieh
ff7cff7268 Do not pass -flto dependent flags to clang-tidy.
Bug: 111885396
Test: run with WITH_TIDY=1
Change-Id: I92468491cdc5894d1197f6c1631e2073c6e7c4fa
2018-07-26 17:43:12 -07:00
Chih-Hung Hsieh
d31b3f87dd Merge "Do not pass -flto and -fsanitize flags to clang-tidy." am: 9f65ef8cd9
am: 167d8c77ba

Change-Id: Ibe7416e9ae2b5b1f73dda5862a3c3eebda33bc60
2018-07-26 17:04:54 -07:00
Chih-Hung Hsieh
167d8c77ba Merge "Do not pass -flto and -fsanitize flags to clang-tidy."
am: 9f65ef8cd9

Change-Id: I7edbaaa8cccabe2b2952fa88499bdfbecfecf60a
2018-07-26 16:59:42 -07:00
Chih-Hung Hsieh
5942fe4fd1 Do not pass -flto and -fsanitize flags to clang-tidy.
Some flags stop clang-tidy to search included header files.

Bug: 111885396
Test: run with WITH_TIDY=1
Change-Id: Ie1ac37298793c015286db0f5caa252b67f4db365
2018-07-26 15:00:28 -07:00
Dan Willemsen
7c6bbd6c1f Fix go vet issues am: 59339a29e1
am: af42826aee

Change-Id: I6e8d7a9d3abb13b035e394f7c0657d49d64f8b5b
2018-07-22 23:28:00 -07:00
Dan Willemsen
af42826aee Fix go vet issues
am: 59339a29e1

Change-Id: I6c5de64ee36c1dde4e043b36f84d2cf140afac41
2018-07-22 23:23:59 -07:00
Dan Willemsen
59339a29e1 Fix go vet issues
Test: go vet ./...
Change-Id: Ifb936ccc5e2b5a2c3fcbbbcb54f680e2973ea1b3
2018-07-22 21:18:45 -07:00
Yi Kong
c888227e7d Merge "Revert^6 "Move -Wno-enum-compare{,-switch} to external cflags""
am: c415116333

Change-Id: I352ec6a79d3d525c17bde9eceaf3b348b63d6a9a
2018-06-29 17:18:21 -07:00
Yi Kong
c415116333 Merge "Revert^6 "Move -Wno-enum-compare{,-switch} to external cflags"" 2018-06-30 00:03:55 +00:00
Yi Kong
e1e83e4279 Revert^6 "Move -Wno-enum-compare{,-switch} to external cflags"
This reverts commit c729b508c3.

Reason for revert: New breakages fixed

Change-Id: I8b5e597fdb2af782d591ddcf5b4e7534273a2e7b
Merged-In: I8b5e597fdb2af782d591ddcf5b4e7534273a2e7b
2018-06-29 20:35:35 +00:00
Roland Levillain
cda6b350c6 Merge "Revert^5 "Move -Wno-enum-compare{,-switch} to external cflags""
am: cf96428ef4

Change-Id: I5521b4b7e10da012897018333e1209e00742f3f3
2018-06-29 02:45:53 -07:00
Roland Levillain
cf96428ef4 Merge "Revert^5 "Move -Wno-enum-compare{,-switch} to external cflags"" 2018-06-29 09:37:42 +00:00
Yi Kong
c729b508c3 Revert^5 "Move -Wno-enum-compare{,-switch} to external cflags"
This reverts commit e0050ebda1.

Reason for revert: Breaks build

Change-Id: I01bc218553ae6efb6140b66f035ccb129d3e5028
2018-06-29 08:19:46 +00:00
Yi Kong
71fd304741 Merge "Revert^4 "Move -Wno-enum-compare{,-switch} to external cflags""
am: e758c83bb5

Change-Id: I16b295a98f503685db2bd4ec1a91b52d93f65ab7
2018-06-29 00:03:50 -07:00
Yi Kong
e758c83bb5 Merge "Revert^4 "Move -Wno-enum-compare{,-switch} to external cflags"" 2018-06-29 06:57:27 +00:00
Yi Kong
e0050ebda1 Revert^4 "Move -Wno-enum-compare{,-switch} to external cflags"
This reverts commit 8ad44855e6.

Reason for revert: Breakage fixed, try again

Change-Id: Ia648b9513d2224a5e363b65f44f9b2f838db1d3d
2018-06-28 21:05:34 +00:00
Pirama Arumuga Nainar
cd53ba1bab Merge changes from topic "mingw-clang"
am: 9d951a10f3

Change-Id: Ie7e0794c98d4b0d317cea9f1d2bf2c02e760b1e5
2018-06-26 12:54:17 -07:00
Pirama Arumuga Nainar
9af0f2d42a Use -static-libgcc for Windows
am: abf1b31a20

Change-Id: Id8eea1c93a97061fa6e50df7c9ba06a9ec62d306
2018-06-26 12:54:01 -07:00
Treehugger Robot
9d951a10f3 Merge changes from topic "mingw-clang"
* changes:
  Use clang for windows host modules
  Use -static-libgcc for Windows
2018-06-26 19:47:53 +00:00
Chih-hung Hsieh
52bd011b72 Merge "Define CLANG_TIDY_UNKNOWN_CFLAGS for build/make."
am: 95894d8ffe

Change-Id: Iac0463e8b7b8603e5d10f84e26aac7cccafc37ec
2018-06-26 10:03:25 -07:00
Pirama Arumuga Nainar
8a852e7694 Use clang for windows host modules
Bug: http://b/69933068

- Remove GCC's intrinsic header path so Clang's headers get included.
- Add '-B' with GCC's binary directory so Clang detects the linker.
- Bug: http://b/109759970 - Pass '--allow-multiple-definition' linker
flag to deal with ld.bfd's inability to handle Clang-generated section
names is fixed.
- Bug: http://b/110800681 - lld cannot link Android's Windows modules
yet

Test: m native-host-cross and run adb_test.exe under wine.

Change-Id: I9be9cfc34a47cbeee04024438dea214305112eaa
2018-06-25 18:36:50 -07:00
Pirama Arumuga Nainar
abf1b31a20 Use -static-libgcc for Windows
Bug: http://b/69970955

With the MinGW prebuilts update (http://aosp/709402), executables get a
runtime dependency on libgcc_s_sjlj-1.dll with both gcc and Clang.
Passing -static-libgcc removes this dependency and is a better option
than having to package an extra dll with executables.

Test: Run gcc-built adb_test.exe under wine
Change-Id: I18e5fadb1b8ace510ae684e2d4cfa7fe7d007cff
2018-06-25 18:31:01 -07:00
Chih-Hung Hsieh
ad47a27d9c Define CLANG_TIDY_UNKNOWN_CFLAGS for build/make.
Bug: 110538415
Test: build with WITH_TIDY=1
Change-Id: I6c5b5a0cb3ad3c2756bbae5e7c0234a0dafe5991
2018-06-25 13:48:42 -07:00
Kostya Kortchinsky
9cba8204b1 Soong support for Scudo
am: d18ae5ce98

Change-Id: I0c0fcf29ccd99575de573a915c7da5d51b14cd45
2018-06-19 13:11:58 -07:00
Kostya Kortchinsky
d18ae5ce98 Soong support for Scudo
Scudo is a hardened usermode allocator that is part of LLVM's compiler-rt
project (home of the Sanitizers). clang allows for -fsanitize=scudo as a
possible command line option to link the shared Scudo library to a binary.

This patch add Scudo as a potential sanitize option. Scudo is not compatible
with ASan and TSan and will be disabled if either is enabled.

Bug: 72112048
Test: aosp compiled with m -j
Test: local experiment with scudo: true to ensure that a test target
(tombstoned) could be linked with scudo.

Change-Id: I76bb6c60891d4782f6665a112c4c2bf7c31645da
2018-06-19 09:46:09 -07:00
Yi Kong
904ba56bb9 Merge "Remove workaround for cortex-a55/a75"
am: bbabc7b67e

Change-Id: Ic8cbeab81b1c75902c95bd5e2b4e9185a2f8feb6
2018-06-17 02:08:19 -07:00