Commit Graph

4888 Commits

Author SHA1 Message Date
Colin Cross
e4f6ebaf6c Simplify missing whole_static_libs checking
Whole_static_libs required custom error checking when
AllowMissingDependencies was set because it could end up depending
on an empty list of objects, which would leave nothing in the
dependency tree that had been replaced with an ErrorRule.
Reuse the prebuilts case to depend on the .a file when there
are no objects and remove the custom error handling.

Test: TestEmptyWholeStaticLibsAllowMissingDependencies
Change-Id: Ic3216235f7e5ae8b5b6ab31ef2ca35c3994d82aa
2020-09-26 00:52:44 +00:00
Treehugger Robot
9dd2c4d543 Merge "Add type information to symbolfile and ndkstubgen." 2020-09-25 23:59:07 +00:00
Ivan Lozano
bc9e421215 rust: Allow rust_bindgen to use cc_defaults.
rust_bindgen modules can't inherit properties in cc_defaults that would
be useful for generating bindings (such as cflags). This CL moves these
common properties out into a new struct in cc and adds that struct to
cc_default.

Additionally, Cppflags is added to rust_bindgen to make sure that these
get picked up as well from cc_defaults.

Bug: 163598610
Test: rust_bindgen module uses cflags in cc_defaults.
Test: New Soong test passes
Change-Id: I702442a355244dc01954083f98a2eebbcea12e47
2020-09-25 16:15:26 -04:00
Yi Kong
aaac6f5c7d Merge "Global ThinLTO mode" am: 6a94390d2e am: 26fb8c32be am: 7fa23be7cc am: b3a004e12c am: 01fe41a3ea
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1432912

Change-Id: I6f63a7c9b62ae1ed6f401a5ee6ad001f854b6010
2020-09-25 16:24:51 +00:00
Yi Kong
6a94390d2e Merge "Global ThinLTO mode" 2020-09-25 08:36:17 +00:00
Treehugger Robot
e798cae7e5 Merge changes I0885e493,Ic37c8db9 am: 4f6eebff0c am: bbfd7e016a am: e67f4200fd am: 2b04afb880 am: 2c81bf414e
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1429848

Change-Id: Id5cd03ac91d2ea43a7d3b42d4c682b2cb5621a39
2020-09-25 07:01:03 +00:00
Dan Albert
063452b1c1 Replace FutureApiLevel with an ApiLevel. am: 0b176c8038 am: d5e15a13df am: 818d1b4e6e am: d997f3cd33 am: 07f0cae3c7
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1388351

Change-Id: Ife2f7c6a1d6dc9828c07ef6341b774e23d40fe3e
2020-09-25 06:00:59 +00:00
Dan Albert
d2a7987456 Replace ApiStrToNum uses with ApiLevel. am: c8060536e8 am: 6e3d089818 am: c81c409966 am: 97825a1e23 am: 049b18bb14
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1371896

Change-Id: Id26f8d0f0323da9fbf924fcb42dda23d326e2909
2020-09-25 06:00:55 +00:00
Martin Stjernholm
b024957791 Propagate all sanitizer flags in SDK snapshots.
liblog snapshot needs to sanitizer.address=false to avoid cycle in asan
builds. Adding that separately in library_sdk_member.go would start to
feel like whack-a-mole, so the snapshot generation is instead extended
to handle nested property structs.

This uses the BpPropertySet.AddProperty extension in
https://r.android.com/1423510, and common value optimisation now
recurses into non-anonymous structs, instead of comparing them as a
whole.

Test: m nothing
Test: `m SANITIZE_TARGET=address nothing` with prebuilts/runtime
  present in the manifest and a fresh snapshot made with this
Bug: 151303681
Change-Id: I472554117a488e6c800045cb2ed59377778571a4
2020-09-25 00:33:04 +01:00
Treehugger Robot
4f6eebff0c Merge changes I0885e493,Ic37c8db9
* changes:
  linux_bionic_arm64 is added when Host_bionic_arm64 is true
  HostCross is an attribute of a Target, not OsType
2020-09-24 22:56:43 +00:00
Dan Albert
d5e15a13df Replace FutureApiLevel with an ApiLevel. am: 0b176c8038
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1388351

Change-Id: I2f73307959278d9bc79301ff1ad7776e55a7d8de
2020-09-24 21:26:30 +00:00
Dan Albert
6e3d089818 Replace ApiStrToNum uses with ApiLevel. am: c8060536e8
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1371896

Change-Id: I2fc7571ca37d31f6f9e1a3d5abe8268d13c030d0
2020-09-24 21:25:54 +00:00
Dan Albert
af7b36dea5 Add type information to symbolfile and ndkstubgen.
Test: mypy symbolfile
Test: pytest
Bug: None
Change-Id: I6b1045d315e5a10e699d31de9fafc084d82768b2
2020-09-24 14:03:31 -07:00
Dan Albert
8bd5095362 Merge changes from topics "soong-apilevel", "soong-config-apilevel"
* changes:
  Convert more versions in config to ApiLevel.
  Replace FutureApiLevel with an ApiLevel.
  Replace ApiStrToNum uses with ApiLevel.
2020-09-24 21:02:07 +00:00
Yi Kong
93718e0d41 Global ThinLTO mode
Experimental global ThinLTO mode for compilation time evaluation.

Bug: 169004486
Test: GLBOAL_THINLTO=true m
Change-Id: I2ff06397be8b65c7972f1e5f09ab1496949567ee
2020-09-25 02:43:14 +08:00
Yo Chiang
219968c9b3 soong: Exclude system shared libs from fix suggestions
Pass the value of system_shared_libs to the Android.mk world, so that
prebuilt ELF check can exclude them from fix suggestions.

Bug: 141925662
Test: Write a bad cc_prebuilt_library module and check fix suggestions
Change-Id: I0cc61821765507180ce6a582bf8125a192f83a57
2020-09-24 13:18:08 +08:00
Jiyong Park
1613e5541f HostCross is an attribute of a Target, not OsType
A host target is considered as being cross-compiled when the target
can't run natively on the build machine. For example, linux_glibc/x86_64
is a non-cross target on a standard x86/Linux machine, but is a cross
host on Mac. Previously, whether cross or not was a static attribute of
an OsType. For example, Windows was always considered as cross host,
while linux_bionic was not. This becomes a problem when we support more
host targets like linux_bionic/arm64 which should be cross-host on
standard x86/Linux machines.

This change removes HostCross from the OsClass type and instead adds a
property HostCross to the Target type. When a target is being added, it
is initialized to true when the target can't run natively on the current
build machine.

Bug: 168086242
Test: m
Change-Id: Ic37c8db918873ddf324c86b12b5412952b0f2be2
2020-09-24 14:14:31 +09:00
Martin Stjernholm
4840a6e02f Merge "Handle absolute source paths correctly." am: a9a99bc6d2 am: d170d99b68 am: 3ee5786146 am: 5323a8a6f8 am: 687baab5a0
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1433434

Change-Id: I2a6814bc2d16a09210b1bb2565ce6b9e494a2251
2020-09-23 14:52:36 +00:00
Martin Stjernholm
a9a99bc6d2 Merge "Handle absolute source paths correctly." 2020-09-23 13:03:06 +00:00
Yi Kong
2ca8a04ad4 Merge "Tweak ThinLTO inling heuristics in absense of PGO profile" am: 76a5ba81e2 am: 280fdb9610 am: 5499f46ea6 am: cb89f96bfc am: 90660c0815
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1433954

Change-Id: Ie58691fc97d4aa71aa9f2c27fba09692f085321b
2020-09-23 06:26:39 +00:00
Yi Kong
76a5ba81e2 Merge "Tweak ThinLTO inling heuristics in absense of PGO profile" 2020-09-23 04:31:42 +00:00
Pirama Arumuga Nainar
40dc55f2af Merge "Propagate PGO instr. flags to dependencies of a static lib" am: d55be35331 am: 16878206e6 am: 0dc5152f68 am: 6033ba145c am: 749ccad37d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1433217

Change-Id: Ib8974ca928b41311338d80dda930104686914082
2020-09-23 03:27:23 +00:00
Colin Cross
5782caf3e3 Merge changes from topic "return-new-deps" am: 2d53a608ae am: 98d152f0d0 am: 619cbea5c5 am: 3c5bba9c93 am: ba2c80aa2e
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1428814

Change-Id: Ia01b631379986861b8da14666403f622ac0d7263
2020-09-23 01:18:36 +00:00
Pirama Arumuga Nainar
d55be35331 Merge "Propagate PGO instr. flags to dependencies of a static lib" 2020-09-23 01:11:40 +00:00
Colin Cross
2d53a608ae Merge changes from topic "return-new-deps"
* changes:
  Remove global state from version mutator
  Return new dependencies from BottomUpMutatorContext.Add*
2020-09-22 23:30:03 +00:00
Dan Albert
0b176c8038 Replace FutureApiLevel with an ApiLevel.
Keeping the int constant around for now as FutureApiLevelInt because
it's still useful in places that haven't adopted ApiLevel yet for
testing if their non-ApiLevel API level is current or not.

Test: treehugger
Bug: http://b/154667674
Change-Id: I47a7012703f41fdeb56f91edf9c83afa93042deb
2020-09-22 15:04:48 -07:00
Dan Albert
c8060536e8 Replace ApiStrToNum uses with ApiLevel.
Test: treehugger
Bug: http://b/154667674
Change-Id: I2954bb21c1cfdeb305f25cfb6c8711c930f6ed50
2020-09-22 15:04:48 -07:00
Stephen Hines
4392eaf2d3 Merge "Switch to clang-r399163." am: c5a0e64d82 am: d421364a97 am: 6c76bfed8f am: 394c241989 am: 140bcb4ee2
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1401176

Change-Id: I78d075f5bbd7a76ea30a58f8eaaf2c918630866c
2020-09-22 19:23:39 +00:00
Pirama Arumuga Nainar
1150fd7c68 Propagate PGO instr. flags to dependencies of a static lib
Bug: http://b/119560349
Bug: http://b/168925229

To build with PGO instrumentation, the link step also needs
-fprofile-generate flag.  Omitting this will result in a linker error.
This surfaces if module A depends on module B but PGO is used only for
module B.

Previous uses of PGO were avoiding or working around the issue but to
accommadate recent changes, this CL propagates the PGO linker flag to
module A.

Test: pgo-coral-config1 in release branch, TH
Change-Id: I12f6243152d4f5ea5526fbce03c25dba232ddab7
2020-09-22 11:49:25 -07:00
Yi Kong
bc220ca803 Forbid -fwhole_program_vtables
-fwhole_program_vtables depends on LTO being enabled. User manually
adding this through ldflag will break no LTO build configuration.

Test: TreeHugger
Change-Id: I557ec57831f01856a467f9567c3e7e25f8a6c566
2020-09-23 01:39:32 +08:00
Yi Kong
2f5f16d574 Tweak ThinLTO inling heuristics in absense of PGO profile
We previously disabled inlining and unrolling completely during ThinLTO
in absense of PGO profile. For global ThinLTO, we want to better balance
binary size and performance.

We evaluated a number of combination of heuristics with global ThinLTO
configuration:
                                binary size change
  no LTO                          baseline
  no inline, no unroll            -0.54%
  no inline, unroll               -0.50%
  import-instr-limit=5, unroll    +0.02%
  import-instr-limit=10, unroll   +0.13%

Loop unrolling does not contribute much to the binary size, therefore
it is re-enabled.

import-instr-limit=5 balances the binary size savings from ThinLTO and
size incrase due to additional optimisation.

Bug: 78485207
Bug: 169004486
Test: TreeHugger
Change-Id: I1c21153605e2ae42daa8857b06e27c081ee8ad85
2020-09-23 01:32:06 +08:00
Stephen Hines
c5a0e64d82 Merge "Switch to clang-r399163." 2020-09-22 16:40:02 +00:00
Martin Stjernholm
14ee832216 Handle absolute source paths correctly.
Can happen if OUT_DIR is set on an absolute path.

Test: env RBE_remote_disabled=true OUT_DIR=/home_2/tmp/out m
Bug: 169048540
Fixes: 169048540
Change-Id: Ia6b91b13142d84e54d0dee8b4e04a91ad2cecc36
2020-09-22 01:17:32 +01:00
Dan Albert
bdece9167a Merge "Replace stringly-typed API levels." am: 21498b4153 am: bf0942e3dd am: aec322d7d6 am: 647a308776 am: 9815787e55
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1356263

Change-Id: Ia52a5252bf3780279be3d63d42a376a1041aba43
2020-09-21 22:18:35 +00:00
Dan Shi
3194912150 Add support of test data to python_host_test
Bug: none
Test: m -j vts_vndk_abi_test
confirm abi_dump.zip found next to test binary

Change-Id: I834dddfc13eb9e7addd234307b085b16124db234
2020-09-21 14:36:43 -07:00
Dan Albert
21498b4153 Merge "Replace stringly-typed API levels." 2020-09-21 20:20:30 +00:00
Roland Levillain
842410d9e5 Merge "Introduce new Arm64 arch variant with dot product features" am: dba548af83 am: c3f8bb9f35 am: 9cf2103acd am: 76c2720461 am: 3288c6c9c9
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1426708

Change-Id: I8673220c20841c39fb83d0ba45974c37904f9184
2020-09-21 19:04:40 +00:00
Yi Kong
d53a5af1ca Merge "Introduce LTO property for -fwhole-program-vtables cflag" am: 52cebe5aff am: 6b8931ce48 am: 50dfc16e17 am: 380f24b73e am: e1eee5fd54
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1429862

Change-Id: I8d9840b2cd313682859a54ca0da74e70bff354e5
2020-09-21 19:04:27 +00:00
Roland Levillain
dba548af83 Merge "Introduce new Arm64 arch variant with dot product features" 2020-09-21 17:54:04 +00:00
Yi Kong
2d01fe28df Introduce LTO property for -fwhole-program-vtables cflag
-fwhole-program-vtables cflag requires LTO to be enabled. Some projects
add this flag unconditionally, breaking builds that turn off LTO.

Make this an LTO property so that build system will handle adding the
flag when LTO is on.

Test: build
Bug: 169004486
Change-Id: Ifce12c09e1d6b8c2807314c3bb982b076efcaaa4
2020-09-21 16:54:07 +00:00
Dan Albert
1a2462717e Replace stringly-typed API levels.
Handling of API levels within Soong is currently fairly difficult
since it isn't always clear based on context what kind of API level a
given string represents, how much canonicalizing and error checking
the code receiving the string are expected to do, or how those errors
should be treated.

The API level struct does not export its raw data, so as to keep its
"constructor" private to the android package, and to prevent misuse of
the `number` field, which is only an implementation detail for preview
API levels. API levels can be parsed with either
`android.ApiLevelFromUser`, which returns any errors to the caller, or
`android.ApiLevelOrPanic`, which is used in the case where the input
is trusted and any errors in parsing should panic. Even within the
`android` package, these APIs should be preferred over direct
construction.

For cases where there are context specific parsing requirements, such
as handling the "minimum" alias in the cc module,
`nativeApiLevelFromUser` and `nativeApiLevelOrPanic` should be used
instead.

Test: treehugger
Bug: http://b/154667674
Change-Id: Id52921fda32cb437fb1775ac2183299dedc0cf20
2020-09-18 12:41:28 -07:00
Victor Khimenko
98801ec1ee Merge "Add -D__ANDROID_NATIVE_BRIDGE__ to native_bridge targets" am: f18c623c04 am: a5aa453308 am: 99404342c8 am: f1b5387e26 am: 897e5f3757
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1428610

Change-Id: Ib024d7f20acca3816a9f72cbf0872cf8627372ea
2020-09-18 04:01:55 +00:00
Yu-Han Yang
613712c720 Add GNSS AIDL interfaces (build/soong)
Bug: 159467682
Test: atest VtsHalGnssTargetTest
Change-Id: I4699eb8c9d73d56ba586896c65f0f8f7f9040dee
2020-09-17 20:11:42 -07:00
Colin Cross
d1f898e70a Remove global state from version mutator
A per-context variable is used to store the list of modules that
contain stubs and their available versions.  Stores the list of the
stubs versions on the implementation module, and then use the new
return values from AddVariationDependencies to expand dependencies
on implementation libraries to also depend on the stubs libraries.
Adds a new mutator pass to propagate list of stub versions to llndk
libraries.

Also creates an alias version variation called "latest" to allow
depending on the latest version without having to know what it is.

Test: all Soong tests
Test: no change to build.ninja, Android-${TARGET_PRODUCT}.mk, make_vars-${TARGET_PRODUCT}.mk or late-${TARGET_PRODUCT}.mk
Change-Id: If19659e2e5828c860fd4d679ef79a414b7ea2efc
2020-09-17 18:56:59 -07:00
Victor Khimenko
f18c623c04 Merge "Add -D__ANDROID_NATIVE_BRIDGE__ to native_bridge targets" 2020-09-17 19:09:03 +00:00
Victor Khimenko
1a31f80b03 Add -D__ANDROID_NATIVE_BRIDGE__ to native_bridge targets
And remove dual meaning from arm_on_x86 target. It was set for x86
targets with arm support and for arm targets with x86 support - and that
2nd one was abused for native_bridge version of RenderScript.

It's much safer and cleaner to rely on __ANDROID_NATIVE_BRIDGE__ there
while leaving arm_on_x86 to mean "x86 binary built in the image with arm
support".

It's only used by bcc compiler which is in canadian-cross situation here:
it's pure x86-64 binary, but it needs to know about ALL supported
architectures on device because it needs to include appropriate codegen
module.

Bug: http://b/153609531

Test: cts-tradefed run cts --abi armeabi-v7a -m CtsRsCppTestCases
Test: cts-tradefed run cts --abi arm64-v8a -m CtsRsCppTestCases

Change-Id: I869212e0b82eeaa30361a4e183d5c862ab40ef12
2020-09-17 01:42:50 +00:00
Tom Cherry
a646a9de11 Include system/core/liblog/include instead of using symlinks
It seems better to include this path directly rather than creating
symlinks in system/core that accomplish the same result.

Test: treehugger
Change-Id: I248a2f0450bbd5da132f67872ec018decba42725
2020-09-16 16:52:29 -07:00
Stephen Hines
2210e720c9 Switch to clang-r399163.
Bug: http://b/155835175
Bug: http://b/151457797
Bug: http://b/165945989
Test: m with aosp_blueline
Change-Id: Id2c2932ccbc34fcbb19cd0b4da0d66ea92cc099a
2020-09-15 13:48:05 -07:00
Treehugger Robot
92ae56554d Merge "Heed SkipInstall flag when adding install rules for vendor-snapshot." am: 386821fae7 am: f6173cf1d2 am: c61d5f2904 am: d89e03f730 am: 8cc652f6fc
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1423509

Change-Id: I8f342230be86cbf9c80ae6d1fe5a36d3f403fbc3
2020-09-15 19:27:22 +00:00
Treehugger Robot
386821fae7 Merge "Heed SkipInstall flag when adding install rules for vendor-snapshot." 2020-09-15 16:49:35 +00:00