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
Bug: 78133793
Test: Built target with cortex-a53 and verified that the flag is still
Test: there.
Test: Build target with cortex-a55/cortex-a75 and verified that the flag
Test: is not there.
Test: Built and booted on a taimen, ran bionic unit tests.
Change-Id: Ibd7f497ecf46e5781cd0265463b0782babdf062a
Merged-In: Ibd7f497ecf46e5781cd0265463b0782babdf062a
(cherry picked from commit a98d721485)
Bug: 78133793
Test: Built target with cortex-a53 and verified that the flag is still
Test: there.
Test: Build target with cortex-a55/cortex-a75 and verified that the flag
Test: is not there.
Test: Built and booted on a taimen, ran bionic unit tests.
Change-Id: Ibd7f497ecf46e5781cd0265463b0782babdf062a
Bug: 78133793
Test: Builds when using cortex-a75 as a target.
Change-Id: Ie3fbe40b15f4d89eeba0d630a82097122fc83b33
(cherry picked from commit 0612597a41)
Bug: 78133793
Bug: 78242072
Test: Builds when using cortex-a75 as a target.
Change-Id: Ie3fbe40b15f4d89eeba0d630a82097122fc83b33
Merged-In: Ie3fbe40b15f4d89eeba0d630a82097122fc83b33
(cherry picked from commit 0612597a41)
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
Bug: http://b/77792074
- Add the libclang_rt.profile runtime libraries directly to the compile
command (for both host and target) instead of relying on the Clang
driver.
- Move the coverage mutator to PreDepsMutators so the mutation has
already happened when runtime libraries are added during dependence
computation.
- Factor out cc/config/toolchain to identify libclang_rt.profile modules
for the x86 and x86_64 host.
Test: make NATIVE_COVERAGE=true produces coverage-enabled host binaries.
Change-Id: I1ebc8cffdf11622bfc18199a57674672888b3a5f
* Add -fuse-ld=lld to hostGlobalLldflags.
* Set up *ClangLldflags variables for hosts.
They are the same as *ClangLdflags, but could be changed in the future.
Bug: 73768157
Test: make checkbuild
Change-Id: I3d61504ab7262d472bbf933df7c1a9bef62519e1
So that the Path and similar functions can be used directly, without
manually adding something like configErrorWrapper (it just uses it all
the time now).
Bug: 76168832
Test: out/soong/build.ninja is identical
Change-Id: I8cb524b09a84d0b8357d7c3501c71270af411e17
Merged-In: I8cb524b09a84d0b8357d7c3501c71270af411e17
(cherry picked from commit 54daaf0371)
* 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
* 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
This reverts commit fa00dfda13.
Reason for revert: New Build Breakages in git_pi-dev-plus-aosp-without-vendor/aosp_walleye-userdebug and git_pi-dev-plus-aosp/aosp_crosshatch-userdebug
Change-Id: Iec9e695cccc3f206df67f0c01cfd4c2c3023dcec
Proposal for adding SHT_RELR sections in the generic-abi is at
https://groups.google.com/forum/#!topic/generic-abi/bX460iggiKg
Comparison with relocation_packer for aosp_marlin-userdebug:
$ du -B1 -s */out/target/product/marlin/system
996958208 base/out/target/product/marlin/system
1008340992 no_pack/out/target/product/marlin/system
997801984 sht_relr/out/target/product/marlin/system
base contains a build with current settings.
no_pack contains a build with relocation_packer disabled.
sht_relr contains a build with SHT_RELR sections enabled.
relocation_packer was saving 11,382,784 bytes (no_pack - base).
SHT_RELR sections are saving 10,539,008 bytes (no_pack - sht_relr).
Bug: None
Test: Built aosp_marlin-userdebug image, boots on device.
Test: Built aosp_x86_64-userdebug image, boots in emulator.
Change-Id: I448dc95baa4976b68ce2659b80498539426775f9
Adds Soong support for -fsanitze-minimal-runtime when using
the integer overflow sanitizers. This makes the crashes due to these
sanitizers less mysterious.
Bug: 64091660
Test: Compiled and checked the generated compiler commands
Test: Checked program that overflows for the abort reason
Change-Id: Ieeceaf6c35c8371592952d3b8b977aefc11601c5
Merged-In: Ieeceaf6c35c8371592952d3b8b977aefc11601c5
(cherry picked from commit 30c5db2f47)
* This is a workaround of llvm LTO bug.
* Keep using current NDK include directory path.
NDKTriple is default ClangTriple but kept as GccTriple for arm device.
Bug: 72619014
Test: make checkbuild
Change-Id: I5dc63c99760325c60bc2da98fd6a3125cef7267d
So that the Path and similar functions can be used directly, without
manually adding something like configErrorWrapper (it just uses it all
the time now).
Test: out/soong/build.ninja is identical
Change-Id: I8cb524b09a84d0b8357d7c3501c71270af411e17
Adds Soong support for -fsanitze-minimal-runtime when using
the integer overflow sanitizers. This makes the crashes due to these
sanitizers less mysterious.
Bug: 64091660
Test: Compiled and checked the generated compiler commands
Test: Checked program that overflows for the abort reason
Change-Id: Ieeceaf6c35c8371592952d3b8b977aefc11601c5
Bug: http://b/73127367
Bug: http://b/68659946
These new prebuilts have fixes for the bugs mentioned above.
Test: Build and verify that issues in both bugs above are fixed.
Change-Id: I410a43b70920d509118f8e6fdb012ef6b078d657
Merged-In: I410a43b70920d509118f8e6fdb012ef6b078d657
(cherry picked from commit 4a825ee14a)
Bug: http://b/73127367
Bug: http://b/68659946
These new prebuilts have fixes for the bugs mentioned above.
Test: Build and verify that issues in both bugs above are fixed.
Change-Id: I410a43b70920d509118f8e6fdb012ef6b078d657
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
This architecture only existed for unbundled use, but even the NDK is
removing support in their r17 release, so just remove support for it.
Test: build/soong/build_test.bash -only-soong
Change-Id: I4bd23babf567128d2d242cbdee3311abb198dd7c
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
Wrap blueprint.PackageContext so that the *Func methods can provide
an android.Config instead of an interface{}. The modified signatures
means that every method in ModuleContext and SingletonContext
that takes a blueprint.PackageContext now needs to be wrapped to
take an android.PackageContext.
SingletonContext wasn't previously wrapped at all, but as long
as it is, wrap everything like ModuleContext does. This requires
updating every Singleton to use the android-specific methods.
Test: builds, all Soong tests pass
Change-Id: I4f22085ebca7def6c5cde49e8210b59d994ba625
Bug: http://b/69481735
While Clang supports -mcpu=kryo, the GNU assembler doesn't. Use
Cortex-a53 instead, which is close to Kryo. The current alternative of
using Krait causes problems when also using armv8, which is not
available in Krait.
Test: Build marlin with internal CL 3248394 cherry-picked.
Change-Id: I571739e6ab4f1b37fafb304ecad2865c9394e04f
* When -Wno-error and -Werror are not used:
add -Wall to the front of cflags
if the project is in the WarningAllowedProjects,
otherwise add -Wall -Werror.
* Add -Wall -Werror to ndk_library build targets.
* Collect names of modules with -Wno-error or without -Werror,
and pass them to makefile variables:
SOONG_MODULES_USING_WNO_ERROR
SOONG_MODULES_ADDED_WERROR
SOONG_MODULES_ADDED_WALL
* Generate ANDROID_WARNING_ALLOWED_PROJECTS for old makefiles.
Bug: 66996870
Test: normal build
Change-Id: I31385e12b80ca946c7395a5a184ef259b029aac6
This reverts commit 20823f95e6.
Reason for revert: caused a minor performance regression in some benchmarks.
Bug: 69470341
Test: builds
Change-Id: I1a852b5d7a2aa1d08ecb54617898f814cddd7600
-fomit-frame-pointer was only being set for arm and mips. Since
we always use unwind tables and not frame pointers to unwind, and
since ART generated code does not use frame pointers, just turn
off frame pointers everywhere to gain an extra register.
Bug: 68951394
Test: m checkbuild
Change-Id: I9237d486a0c0215cdafd96d66712082df0eba785
These flags were added for gcc, but are always stripped out when
compiling for clang. Since gcc is barely used, removed them.
Bug: 68855788
Bug: 68947919
Test: m checkbuild
Change-Id: Iae2bda9808dd9499848ce145ccdf71c4c490b80e
Move -fdata-sections and -fno-short-enums to global device flags.
-fdata-sections was not previously set on x86[_64], -fno-short-enums
was not previously set on mips[64].
Bug: 68855788
Test: m checkbuild
Change-Id: I68e64888d5414fc022366eb2b6c5cd92c28a5542
It was previously set on arm[64] and mips[64], this will cause it
to be set for x86[_64] too.
Bug: 68855788
Test: m checkbuild
Change-Id: I75af16e7d259963ad633cc664929144332bb435d
Bug: http://b/68236396
This warning only needs to be enabled for frameworks/base/core/jni.
Test: Build the topic
Change-Id: I9f6aab2045f135d691696f9fd461c895a5aadb38
When the following lines are specified in the BoardConfig.mk
TARGET_2ND_ARCH_VARIANT := armv8-a
TARGET_2ND_CPU_VARIANT := generic
The resulted binaries won't be built using 32-bit armv8-a integer
division instructions. Instead, division routines are used because
the build system will set a compiler option "-march=armv7-a", and
hence overwiting the previous "-march=armv8-a", when
TARGET_2ND_CPU_VARIANT is set to generic (or unset).
Bug: 67446726
Test: lunch aosp_arm64; make -j; emulator # boot to home screen
Also verify -march=armv7-a is not specified in the compiler
command line and the resulted binary actually uses integer
division instructions.
Change-Id: I430687aa5a658d2ec9f325a66d849b4c8898c7d5
-fno-canonical-system-headers is required for gcc to use relative
paths to system headers in deps files, and is stripped out for
clang. Move it to the global flags so it affects windows gcc builds.
Bug: 68719465
Test: m checkbuild
Test: prebuilts/build-tools/linux-x86/bin/ninja -f out/combined-${TARGET_PRODUCT}.ninja -t deps | grep -E '^[[:space:]]*/' | sort | uniq
Change-Id: Ia9befd7cf8cfd714241e636fb786c319aecc79fe
-fomit-frame-pointer was specified twice, once for arm and once for
thumb. Move it to the shared cflags.
Bug: 68855788
Test: m checkbuild
Change-Id: Iab1299c247808f1a2542b468084600b7c32996e8
Move ldflags that are specified for all devices into
deviceGlobalLdflags, and add them to linker.go:
-Wl,-z,noexecstack
-Wl,-z,relro
-Wl,-z,now
-Wl,--build-id=md5
-Wl,--warn-shared-textrel
-Wl,--fatal-warnings
-Wl,--no-undefined-version
Bug: 68855788
Test: m checkbuild
Change-Id: I82561b4189287d7638006f9e298c5151f9930c5e
-Wl,--gc-sections is already added by library.go and binary.go for
anything that uses bionic.
Bug: 68855788
Test: m checkbuild
Change-Id: I229199045ef8595d69c07fcf1aa6bbdc0b753fe3
Move cflags that are set on all devices to deviceGlobalCflags:
-fno-canonical-system-headers
-ffunction-sections
-funwind-tables
-fstack-protector-strong
-Wa,--noexecstack
-D_FORTIFY_SOURCE=2
-Wstrict-aliasing=2
-Werror=format-security
Bug: 68855788
Test: m checkbuild
Change-Id: Iefec689fdd2749013d0cc003b3abec674a85fb74
Move all the flags that are used everywhere (or should be used
everywhere) into cc/config/global.go:
-no-canonical-prefixes
-fno-exceptions
-Wno-multichar
-O2
-g
-fno-strict-aliasing
Also remove flags that are already in noOverrideGlobalCflags:
-Werror=pointer-to-int-cast
-Werror=int-to-pointer-cast
x86 and x86_64 were specifying -fstrict-aliasing, but that was
being overriden later by -fno-strict-aliasing, so remove it.
ARM devices still override -fno-strict-aliasing to -fstrict-aliasing
when using ARM (vs. Thumb) instruction set.
Bug: 68855788
Test: m checkbuild
Change-Id: Ia2b5891bdefb60f974ad92b4b84a8548c2dcc7dc
This reverts commit 33c252c2f1.
I have a fix to the crashes that this CL set was causing, and have
uploaded it as a patchset to this revert.
This also contains a partial fix that was initially submitted
separately as
https://android-review.googlesource.com/#/c/platform/build/soong/+/524295/
Bug: 30227045
Test: ./art/test/testrunner/run_build_test_target.py -j110 art-asan #no
build errors
Test: m -j50 ASAN_OPTIONS=detect_leaks=0 SANITIZE_HOST=address # no
build errors
Change-Id: I3e53549fa03413d35d9a952f04de1e7629e1f06d
This reverts commit d4b484b070.
Rationale: second in group of commits that left aosp_x86_64 not
building. (See https://android-build.googleplex.com/builds/
submitted/4426589/aosp_x86_64-eng/latest/logs/build_error.log)
Bug: 30227045
Test: builds
Change-Id: I38ab5284c614d6ee68e7359219bd75c7d50131be
This CL makes multiples changes in preparation for platform-wide CFI.
(a) Adds a second -version-script=... to the command line
when building components that use a version script. This ensures that
__cfi_check is also exported, and allows CFI to be enabled for these
components.
(b) Adds both topdown and bottom up mutators for CFI to help propagate
dependencies correctly for components that may need CFI disabled.
(c) Fixes an issue with the mutators to correctly apply settings to
both generated variants
(d) Fixes issues when components have more than a single visibility
flag.
Bug: 30227045
Test: SANITIZE_TARGET=cfi m -j40 # dependencies are correctly built
# with/without CFI
Change-Id: I44793cc03bcbcdaa957cc49c7240b87d7c9db327
LLVM r275480 does not recognize flto flags, suppress the option in clang
libTooling tools for now.
Bug: 62839002
Test: mma
Change-Id: Ia9d80b46320e551a93dbff780405d8ff8ad73f35
Leave '__unix' and '__unix__' defined on mips/mips64, like arm.
This is needed to avoid a warning in external/libcxx project.
Test: successful build and boot aosp_mips-eng
Test: successful build and boot aosp_mips64-eng
Change-Id: I8f0e17bdbeffd5078c19aa7506564b8e79a9c945
include_deprecated -> include_jni
include_jni only includes jni.h. Other dependencies which
are provided as part of libnativehelper can be included
by using libnativehelper or by using them with in their
proper location (e.x. nativehelper/JNIHelp.h).
Bug: 63762847
Test: modules find their headers
Change-Id: I8674d2feed08bd80c1fc7b54e3ee38b9ee3484b2
Bug: http://b/65598278
The profile runtime depends on libgcc for some symbols (only under some
circumstances - armv5, ndk r14, static executables). Since Android
build passes -nostdlib and adds libgcc manually, the profile runtime
gets passed to the linker later than libgcc.
Instead, explicitly add the profile runtime to the linker command (and
pass one other flag added by the clang driver to the link).
Test: Build a library with profile instrumentation that otherwise fails
instrumented build.
Change-Id: I24b34cebd2c3bb6a540f8f4c465ace1be4eb90f3
Signed-off-by: Pirama Arumuga Nainar <pirama@google.com>
Move these flags from the normal flags to the toolchain flags, since we
want them to always apply.
Test: Add #ifdef __ANDROID__ to crtbegin.c, check to see if it's set for host bionic
Change-Id: I382dd229e3e4a889bc916f6f8e1248c7debb8fad
We've only got one user of this currently, but since it needs the
location of the toolchain, and different flags based on 32 vs 64-bit,
it's easier just to add support than to get this into a genrule.
Test: Convert external/mdnsresponder to Soong, build
Change-Id: I6c19a82bc14f6ab556f6cc5f37164862ba5f9083
This reverts commit 80b27e4e20.
Fixed CTS build issue by adding -march=armv7-a in cts/tests/tests/os/jni/Android.mk since the library built here needs/uses instruction (swp) obsolete in ARMv8.
Bug: 64964151
Test: lunch aosp_arm64-userdebug; make -j cts
lunch aosp_x86-userdebug; make -j cts
lunch aosp_sailfish-userdebug; make -j cts
lunch aosp_bullhead-userdebug; make -j cts
Change-Id: I6ccafce043e101c769ad370a81ffa0eb62719b5e
Add armv8-a as a valid/supported 32-bit arm architecture variant. If
some known armv8-a core, like cortex-a53, cortex-a73, etc. is specified
as TARGET(_2ND)_CPU_VARIANT, the associated TARGET(_2ND)_ARCH_VARIANT
will be treated as if armv8-a is specified.
Bug: 62895439
Test: "bionic-unit-tests-static --gtest_filter=*strlen*" on Nexus 4
(armv7-krait), emulator (armv7), and sailfish (armv8-kryo).
The test binary for the first 2 is built with armv7-a as its
TARGET_ARCH_VARIANT; The test binary for the last is built with
armv8-a as its TARGET_2ND_ARCH_VARIANT.
TARGET(_2ND)_CPU_VARIANTs of both binaries are set to "generic".
Change-Id: I53bee2974346cf485b2da54cf7aad010b0425910
Enabling the lto property for a module builds that module and all static
dependencies with LTO.
LTO (link-time optimization) allows the compiler to optimize and
generate code for the entire module at link time, rather than
per-compilation unit. LTO is required for Clang CFI and other
whole-program optimization techniques. LTO also allows cross-compilation
unit optimizations that should result in faster and smaller code, at the
expense of additional compilation time.
Test: make -j12 libc with lto: true for libc
Change-Id: Ib8baefedf60e02701d44673a7c473e0845730101
Gold recognizes a different set of emulation strings to specify targets
than the bfd linker accepts. Clang only passes bfd emulations to the
linker, so we need to override these with the versions accepted by gold
when using gold.
Gold normally picks up the correct target from the first ELF input file
if it cannot parse the emulation parameter. However when using LTO, all
objects may be bitcode files, which causes gold to rely on the passed
--oformat or -m parameter to determine the proper target. If gold cannot
parse the emulation string passed by clang, it fails to link.
Test: build LTO version of libc
Change-Id: I38e78bb912fd3cc5fb7b4a762284f50ddd4f3998
LL-NDK, VNDK-core, VNDK-SP libraries are exported to make as
SOONG_LLNDK_LIBRARIES, SOONG_VNDK_CORE_LIBRARIES, and
SOONG_VNDK_SAMEPROCESS_LIBRARIES. This can be used to auto-generate
ld.config.txt from a template.
Bug: 64013660
Test: BOARD_VNDK_VERSION=current m -j successful
Test: check out/soong/make_vars*.mk and look for SOONG_*_LIBRARIES
Merged-In: I0f4c5d05d9cd28c3fc9fdcca6ce0e6eaeaacbe8d
Change-Id: I0f4c5d05d9cd28c3fc9fdcca6ce0e6eaeaacbe8d
Also export the corresponding variable to make.
libnativehelper's include_deprecated contains all of the
headers that are currently used by libraries without
the "nativehelper/" prefix.
The current count of this is this:
2 ScopedLocalFrame.h
4 JniInvocation.h
4 ScopedBytes.h
5 AsynchronousCloseMonitor.h
6 toStringArray.h
7 ScopedStringChars.h
38 JniConstants.h
41 ScopedPrimitiveArray.h
79 ScopedUtfChars.h
80 UniquePtr.h
100 ScopedLocalRef.h
467 JNIHelp.h
Now we can remove each file from the global header include
on a file by file basis.
Bug: 63762847
Test: libs find their headers
Change-Id: Iffc0c1ceb55cc59dc4a70c75d7c0b9ce8397b2cf
Adds the SANITIZE_TARGET=integer_overflow build option to apply signed and
unsigned integer overflow sanitization globally. This implements the
Soong side of the build option.
An additional build option is provided to control whether or not to run
in diagnostics mode, controlled by SANITIZE_TARGET_DIAG. This works the
same way that SANITIZE_TARGET does and currently only supports
'integer_overflow' as an option.
A default sanitizer blacklist is added to avoid applying sanitization
to functions that are likely to exhibit benign overflows.
Bug: 30969751
Test: Building with and without the new flags, device boot-up, tested
various permutations of controlling the new flags from build files.
Change-Id: Ibc8a8615d3132f1a23faaf1cb4861f24c5ef734a
With the latest Clang we do not have issue with beqc instruction,
so allow generation of compact branches for mips.
This reverts commit 3d6a38d601.
Change-Id: I6dbb5d1fce08bd714cc9a0318d50de5765cff038
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
* Cortex-A15 supports VFPv4 instructions
Test: make otapackage
Test: Built angler with 32 bit variant set to cortex-a15.
Test: Boot this version of the angler, ran bionic unit tests.
Change-Id: I94f00c9486ece201aa2c230308b9f90b0209dc4a
This reverts commit 4068a5db6c.
Now the Mac xcode-select and xcrun goes through Config.HostSystemTool,
which will grab $PATH through Config.Getenv
Test: m -j (on mac)
Change-Id: I2632c4fdb2ec961e59944cf02ff165e0fd3c869d
Also, update flags for cortex-a53.
Bug: 37647380
Test: Built target with cortex-a73 for both 32 bit/64 bit.
Test: Built target with cortex-a53.cortex-a57 for both 32 bit/64 bit.
Test: Ran bionic unit tests, ran art target tests.
(cherry picked from commit 1d9aa26d44)
Change-Id: I3325f60add7f424f8cca53c22919fc481ef5e787
Moving the last users of a sanitizer runtime library to soong was
causing the runtime library to stop getting installed. Declare
the dependency so make keeps installing it.
Test: builds
Change-Id: Ieeb9ad5c04ac8df0d1a74239da393dac5cab2b03
Remove -Wa,-mmxu option because clang doesn't support it.
Test: successful build of mips32r2-fp-xburst arch variant
Change-Id: I0c3da5dee0bb3acb44e75991b4763b061acc86e1
Remove the last -isystem for global include directory (besides
bionic).
Bug: 31751828
Test: builds
Change-Id: I8f38332de8f0cffd5c56b9b5ebeacbaaf3a4faea
Merged-In: I8f38332de8f0cffd5c56b9b5ebeacbaaf3a4faea
(cherry picked from commit d13a457a45)