Commit graph

36 commits

Author SHA1 Message Date
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
Logan Chien
aceb86e345 Merge "Remove flags from ClangLibToolingUnknownCflags"
am: 0b6bcd4014

Change-Id: I7f7e9e80052e748c1d92f46fee4552c1b4a45a2b
2018-10-17 03:08:54 -07: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
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
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
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
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
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
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
Martijn Coenen
8ad44855e6 Revert "Revert "Revert "Move -Wno-enum-compare{,-switch} to external cflags"""
This reverts commit cc4bbdccd3.

Reason for revert: breaks builds

Change-Id: Ia8908eb372ce46b23aea73283baf37add4477312
2018-06-13 07:36:05 +00:00
Yi Kong
cc4bbdccd3 Revert "Revert "Move -Wno-enum-compare{,-switch} to external cflags""
This reverts commit 2f71a6adcd.

Change-Id: I09abb194b25813b8b1e4470b22171121cc3f8c11
2018-06-12 22:59:16 +00:00
Yi Kong
2f71a6adcd Revert "Move -Wno-enum-compare{,-switch} to external cflags"
This reverts commit 96d221f914.

Reason for revert: build breakage for sdk target

Change-Id: I933df62738c08b48d8ae4ea951b2cb4837616c78
2018-06-12 04:51:49 +00:00
Yi Kong
96d221f914 Move -Wno-enum-compare{,-switch} to external cflags
Test: m checkbuild
Bug: 72330874
Change-Id: I8aaa020f5efafa8746b2c5ae29cea1a313a28045
2018-06-11 14:54:35 -07:00
Yi Kong
cc80f8d64f Revert "Revert "Add external projects only CFlags option""
This reverts commit a9ccbb7b87.

Test: m
Change-Id: I92d7b7707f73ef3af5824d3e8cb6da0465b5e07d
2018-06-06 16:41:26 -07:00
Kevin Rocard
a9ccbb7b87 Revert "Add external projects only CFlags option"
This reverts commit 6a350878d8.

Reason for revert: Breakage of many AOSP targets

Change-Id: I917e6daa04ac02ecb98c7bb1816f9bdaf46429f5
2018-06-05 21:43:46 +00:00
Yi Kong
6a350878d8 Add external projects only CFlags option
Every time the toolchain adds a new warning, we had to suppress the
warning in every external projects that violates it, or disable it
globally -- which we end up doing most of the time since the first
option is way too time consuming.

Add a separate cflags option for external projects and move existing
-Wno-* flags there so that we can enforce better code quality for
internal projects.

TODO: Move more -Wno-* flags to ClangExtraExternalCflags

Test: m checkbuild
Change-Id: If3dee491616a1e7ba6223c2f522d100e10c5ee76
2018-06-05 19:32:02 +00:00
Pirama Arumuga Nainar
d7feb380c1 Update clang to r328903
Bug: http://b/77532044

* b/77967848 - Disable -Wc++98-compat-extra-semi

Test: Test various targets in AOSP and internal branches.  For Googlers,
go/clang-r328903-testing

Change-Id: If08dafb9ad993fb686dfd6eeb5e2d61a9c99bd0b
2018-04-30 15:18:05 -07:00
Chih-Hung Hsieh
02b4da53a7 Add USE_CLANG_LLD and use_clang_lld.
* USE_CLANG_LLD is unedefined in current builds.
* When USE_CLANG_LLD is defined to 'true' or '1',
  use clang's lld instead of ld or ld.gold.
* When lld is enabled:
  * ld-only flags are not passed to 'lld'.
  * location_packer is disabled.
  * Use new lld's --pack-dyn-relocs=android.
* When lld does not work:
  * In Android.mk files use LOCAL_USE_CLANG_LLD := false.
  * In Android.bp files use use_clang_lld: false.
* Only arm, arm64, x86, and x86_64_devices have LLD flags;
  all other hosts and targets do not call lld yet.

Bug: 73768157
Test: make checkbuild and boot
Change-Id: I06b8a1e868a600997a7e70fe05c299d751d23d5f
2018-04-12 14:37:35 -07:00
Chih-Hung Hsieh
3ede294729 Switch to clang 7.0
* Suppress more noisy new warnings at global level.
* Add -no-pie to partial link .o files, with -r.
* Revert workaround of b/72706604, no need of
  -Wl,-plugin-opt,-emulated-tls
* Filter out clang 7.0 unknown flag "-Wno-extended-offsetof"

Bug: 72706604
Bug: 72412006
Test: make checkbuild
Change-Id: I7ff45465c4bd771991f42b40f68dc35586045656
2018-03-26 18:04:47 -07:00
Dan Willemsen
8054f0a9d2 Revert "Fix absolute paths in clang debug output"
This reverts commit 253cab89ee. It is no
longer necessary.

Bug: 36463318
Bug: 72408185
Test: compare output directories after `m libc`
Test: compare treehugger output files
Change-Id: Ib5d7bbc13fa6f547e658247559153c61387e3604
2018-03-08 17:10:54 -08:00
Dan Albert
f2ceea7f1f Disable a warning that libc++'s headers trip.
Test: make checkbuild
Bug: None
Change-Id: I117bd9ef3f4f3c8792f4b6692d7b70ad69b6922d
2018-02-07 17:24:42 -08:00
Stephen Hines
a42e0a0eca Silence warnings rather than keeping them in the logs.
We can simply revert this patch to work on these warnings independently.

Bug: http://b/72331526
Bug: http://b/72331524
Bug: http://b/72330874
Test: Build

Change-Id: I9cec51578a1c6de33fb6f832c758b9916c61b735
2018-02-06 14:51:08 -08:00
Yi Kong
599a6032fc Switch to clang-4579689.
Bug: 68397894
Test: http://go/clang-4523590-testing
Change-Id: Ief806250572fe2cc5f39b4c47ff74863acbbb26d
2018-02-01 10:23:32 -08:00
Dan Willemsen
01f388c343 Add base variables for windows clang
This just copies most of what exists for clang on Linux, but doesn't
actually turn on clang support.

Bug: 69933068
Test: m nothing; compare ninja files
Change-Id: I2cf203026e7ced32004a91d7f3baf4a6415085eb
2017-11-30 15:42:53 -08:00
Colin Cross
d00350c61b Add license headers to all go and shell files
Test: none
Change-Id: I75c443e05f2b1e17fcb6823182717d2e6f5df7c4
2017-11-17 23:05:26 +00:00
Pirama Arumuga Nainar
4c0e1bf4e0 Re-enable -Wunknown-warning-option
Bug: http://b/68236396

This warning only needs to be enabled for frameworks/base/core/jni.

Test: Build the topic
Change-Id: I9f6aab2045f135d691696f9fd461c895a5aadb38
2017-11-10 13:54:47 -08:00
Stephen Hines
0ed7d24f7a Switch to clang-4393122.
Bug: http://b/62580008
Bug: http://b/68236239
Bug: http://b/68236396
Test: https://goto.google.com/clang-4393122-testing
Change-Id: Ib6bcf93e356172aad2a762b730a6f93916a5d845
2017-10-30 16:00:44 +00:00
Jayant Chowdhary
20f5d137ed Make clang libTooling tools ignore all lto flags.
LLVM r275480 does not recognize flto flags, suppress the option in clang
libTooling tools for now.

Bug: 62839002

Test: mma

Change-Id: Ia9d80b46320e551a93dbff780405d8ff8ad73f35
2017-10-27 11:29:52 -07:00
Jayant Chowdhary
9677e8c6ad Black-list for clang LibTooling Cflags.
Add a list of flags which are not understood by clang LibTooling tools
and filter them out of the Cflags the tools are invoked with.

Test: In frameworks/av, make libmedia vendor_available (this invokes
header-abi-dumper on this module), mm -j64.

Bug: 62447349

Change-Id: I46f017212b89f4331145c999103d0ed44da0abaf
2017-06-19 19:43:03 -07:00
Josh Gao
e0b933b74d Globally enable libcxx's thread safety annotations.
Add -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS to clang extra cppflags
to make libcxx always emit thread safety annotations. Note that this
won't generate additional warnings on projects that don't already use
-Wthread-safety.

Test: treehugger
Change-Id: I517a96571d77be119510c981bc2cbaddb41dee95
2017-04-27 18:13:21 -07:00
Dan Willemsen
253cab89ee Fix absolute paths in clang debug output
As of the latest clang python wrapper, clang is being executed with an
absolute path. That means that clang-provided headers are written with
absolute paths in the debug info, making the builds non-reproducible
(especially with ccache).

So keep our current PWD=/proc/self/pwd -fdebug-prefix-map=/proc/self/cwd=,
but add a new -fdebug-prefix-map=$PWD/= to rewrite these absolute paths.

Bug: 36463318
Test: m -j libc adb; grep for path names
Test: spot check objdump -W before/after, see only expected diffs.
Change-Id: Ic2cdfca051d3c38b753fd5c1fcbeaca8bafc29ae
2017-03-27 16:58:43 -07:00
Elliott Hughes
5a0401ab9c Consistently use -std=gnu99 for gcc as well as clang.
This matters for C files that are also built for Windows. Previously they'd
be compiled with -std=gnu99 for the host but [effectively] -std=gnu89 for
Windows.

Bug: http://b/32019064
Test: builds, and can build libcrypto_utils without a manual -std= line
Change-Id: I9c5cc7832220b5c3d6a007ff10d076e26fd8c75d
2016-10-13 14:41:31 +00:00
Colin Cross
b98c8b0595 Move toolchain and global variables into separate package
Move all of the configuration into a cc/config package

Change-Id: If56fc7242062ed1ce3cb297f78a1e0ef7537373c
2016-08-01 13:37:01 -07:00
Renamed from cc/clang.go (Browse further)