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
-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
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
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
-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
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
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
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
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
Variants and paths are different there, and it is hard to test since
it's only in postsubmit in TH.
Test: m nothing
Bug: 168558897
Change-Id: I071540b3c7ff9a9fd4104dca75079e831b1b2529
The prebuilt-vs-source selection operates by setting SkipInstall on
either module. When the vendor-snapshot module visits all modules it
will visit both, and if it is a static library it will then add
duplicate install rules for both source and prebuilt unless it
looks at SkipInstall.
Test: `m nothing` in a tree with prebuilts/runtime present, that
has been updated with a snapshot after https://r.android.com/1398472,
which started to propagate vendor_available flags to prebuilts
snapshots.
Bug: 151303681
Change-Id: Ie425f0115e4180b7f4a8e682696697d55d666845
AddFarVariationDependencies was broken, which allowed apex to add
dependencies on tests by requesting an empty test_per_src variation
even though some test dependencies did not have a test_per_src
variation. Add an alias from the pre-test_per_src variation
variant to the empty test_per_src variation, and drop the
test_per_src variation when requesting the depencency.
Test: TestApexWithTests
Change-Id: I2ed7bdd761027956141e25d4d81f9074afe628b6
Needed for jni_headers which is marked as recovery_available because libchrome
is also marked and that library is used by others that are the recovery
partition. There may be other dependency paths that require jni_headers to be
recovery_available that was just the first one found.
Bug: 168301990
Test: m nothing
Change-Id: I916ecfe7700b9c153b29115e849da148fc7e7a76
Bug: http://b/116784799
Previously this was set only when stl was requested. We can now pass
this for all C++ compilations.
Test: go/android-llvm-windows-testing
Change-Id: I43e635ff50d0f1a5e000f13021506aeece368b4a
An APEX module name, unlike the APEX package name, can contain
characters like '-', which are not allowed as C define strings.
Sanitize it properly.
Test: build GKI APEX
Change-Id: I8257d43c55862da8fab7f1e342c2d14369d1211e
LinuxBionic now supports arm64 architecture in addition to the existing
x86_64 arch. This is to make it possible to build host tools like adb,
fastboot, crosvm, etc. for Linux/ARM on regular Linux/x86 machines.
The arm64 target can be selected in various ways in Android.bp files:
- target.host (because this is still considered as a host target)
- target.linux (provided that the module is also enabled for host)
- target.linux_bionic (use the OS name directly)
- target.linux_bionic_arm64 (OS name + arch combo)
- target.linux_arm64 (provided that the module is also for host)
- target.not_windows
- arch.arm64
The toolchain for the new target is almost the same as the toolchain
config for Android/ARM64. One notable difference is that the clang
triple is aarch64-linux instead of aarch64-linux-android, so that
__ANDROID__ is not defined for the new OS type.
Bug: 134795810
Test: HOST_CROSS_OS=linux_bionic HOST_CROSS_ARCH=arm64 m nothing
Change-Id: If4300583edfb6d75bd4d984b38f73b6a406b4447
In addition to capture test, this adds vendor snapshot usage test to
ensure the snapshots of BOARD_VNDK_VERSION are used correctly.
Bug: 167642944
Test: m nothing
Change-Id: I200c95626479a2b2d982edd7488d816e01376734
This means binaries will run from their source location and look up
shared libs relative to there.
Test: m nothing
Test: Set up a prebuilt binary with shared libs, check that it can
be executed during build, and check that its symlinks get updated
when a shared lib is touched.
Bug: 145934348
Change-Id: I1a600c7163ce0ec34ee8caf0ffe87fef4feb3064
When building a vendor snapshot, the general rule the
build system uses to select a module for inclusion into
the vendor snapshot is if it's a framework module.
However, there are cases where a partner may modify the
framework module, thereby assuming control of that
module.
This change adds the exclude_from_vendor_snapshot
property allowing the partner to mark a module that
would normally be included in the vendor snapshot for
exclusion. This module is then built from source when
building the vendor image against the vendor snapshot.
Bug: 165705527
Test: m nothing
Test: build partner code against vendor snapshot
Change-Id: I6c5c15f13eeeb8f29717a4abd84b65fa72096889
This reverts commit 988ff8d149.
Reason for revert: RBE can now handle PGO profiles during remote linking.
Bug: http://b/162702246
Test: m ANDROID_PGO_INSTRUMENT=hwui hwuimacro and check hwuimacro has
PGO instrumentation.
Change-Id: I724b53dc086923beeb6f4b8903136545d18f4ece
Set the TEST_ROOT to /data/local/tmp/tests/vendor if LOCAL_VENDOR_MODULE or
LOCAL_USE_VNDK be set, if not, set to /data/local/tmp.
Bug: 138450837
Test: atest binderVendorDoubleLoadTest
Change-Id: I04acf12976dd24b9bf880a6775fa4f043a221001
prebuilt_firmware module is one of many prebuilt_etc-like modules. When
it is soc-specific, it is installed in /vendor/firmware. Similarly, when
prebuilt_firmware is embeded in a vendor apex, installing it in
<apex>/firmware instead of <apex>/etc.
Bug: 162701747
Test: lunch sunfish-userdebug
m && device boots && vibrator works
Change-Id: I00d28cde42259aaf8221e3897df77efc42b0c1ca
Bug: http://b/162702246
Test: m ANDROID_PGO_INSTRUMENT=hwui hwuimacro and check hwuimacro has
PGO instrumentation.
Change-Id: I8044702e0aed4fa7bb9ac71608a83a95f319abd9
The cc stripping logic can be reused for Rust. Export the Stripper
structure for that purpose. Extract the strip-related flags from
builderFlags into StripFlags. Add the method flagsToStripFlags
(similarly to flagsToBuilderFlags).
Add the helper method disableStripping on libraryDecorator.
Test: m
Bug: 153430439
Change-Id: I11aef1abb8d498a4c1672500a7398279edf7f548
To support module specific lexer flags, this follows the same strategy
as the yacc flags:
- add LexProperties to the BaseCompilerProperties
- propagate those flags to the generator generation (i.e. genLex)
- add a placeholder for custom flags
- replace the placeholder with the concatenated flags
This might not support escaping very well, but I figured that this is a
very edge case. Support for escaping etc. could be added later on.
Bug: 159682555
Signed-off-by: Matthias Maennich <maennich@google.com>
Change-Id: I31a3b783bb05213fe1621191031952b41b318103
AddFarVariationDependencies was broken, which allowed sdk modules to
request dependencies using image and version variations, even for
host modules that do not have image or version variations. Make
the image and version variations conditional on device sdk modules.
Test: go test ./sdk
Change-Id: I59b7a32a3782254fd5feb828a5258ee13d4db812
In order to rely on `-march`/`-mcpu` compiler flags for feature
detection, we introduce a new arch variant based on armv8.2 with the
addition of dot product features.
Test: test-art-target on Pixel 4.
Change-Id: I4d97db6129e2cd718a2b21008d36ec767739f925
Like shared libraries, the bootstrap subdirectory is appended to the
install path only when the module is in an APEX. Currently, this change
doesn't make any difference because only the Bionic binary (linker) is
satisfying the existing condition InstallToBootstrap() and it already
satisfies DirectlyInAnyApex.
However, this change makes a diference when we build the binary for the
host targets. Then without this change, it is installed to
out/soong/host/<OS>-<arch>/bin/bootstrap. This doesn't make sense
because we don't use APEXes for the host targets. With this change,
the binary is correctly installed to out/soong/host/<OS>-<arch>/bin
because DirectlyInAnyApex returns false for hosts.
Bug: 159685774
Test: m
Change-Id: I0d63bd8c11e3a96ee6a27b2295bc14d6dc15ff9e
We used this when doing cache-only for header-abi-dumper to prevent
cross-branch cache hits since abi-dumper had the absolute path of the files
in its output. Since header-abi-dumper no longer outputs absolute paths,
we no longer need to prevent cross-branch cache-hits.
Bug: b/162045672
Change-Id: Iecc3ad9614cda6202cc5f8a9d538f806a79bdf3b
When a cc module sets UseApexNameMacro(mutated property), it is built
with __ANDROID_APEX_NAME__ for its apex variants.
For now the new prop is used by aidl_interface-generated modules only.
Note that we already have __ANDROID_APEX_<NAME>__ macro. The new macro
can be used when we need to pass the name as data while the old one is
useful when we want conditional compilation.
Bug: 165017590
Test: m com.android.aidltest
check build.ninja if -D__ANDROID_APEX_NAME__ is defined for apex
varaints
Change-Id: Ia81ba8f833d23254e58c9777daf184d7861f07a7
This is necessary to not get dependencies on libclang_rt sanitizer libs
for the CRT objects which lead to cyclic dependencies in sanitizer
builds.
Test: `lunch aosp_blueline_hwasan-userdebug && m nothing`
in a tree that has the prebuilts created and unzipped from
`build/soong/scripts/build-aml-prebuilts.sh runtime-module-{sdk,host-exports}`
Bug: 151303681
Change-Id: I3f848a084280bdc3ade4b74df03e981d8cc61222
Add a -r argument to soong_zip that reads a list of files from a file
like the -l argument but treats it as a Ninja rsp file with escaping.
Replace the -l arguments in Soong that are using rsp files with -r.
Fixes: 162435077
Test: TestReadRespFile, TestZip
Change-Id: I4605312e99406ab1bd0c37af9c5ad212393f0403
APEX variants that share the same SDK version and updatability
almost always use identical command line arguments to build but
with different intermediates directories. This causes unnecessary
build time and disk space for duplicated work.
Deduplicate APEX variants that would build identically. Create
aliases from the per-APEX variations to the new shared variations
so that the APEX modules can continue to depend on them via the
APEX name as the variation.
This has one significant change in behavior. Before this change,
if an APEX had two libraries in its direct dependencies and one
of those libraries depended on the other, and the second library
had stubs, then the first library would depend on the implementation
of the second library and not the stubs. After this change, if
the first library is also present in a second APEX but the second
library is not, then the common variant shared between the two
APEXes would use the stubs, not the implementation.
In a correctly configured set of build rules this change will
be irrelevant, because if the compilation worked for the second
APEX using stubs then it will work for the common variant using
stubs. However, if an incorrect change to the build rules is
made this could lead to confusing errors, as a previously-working
common variant could suddenly stop building when a module is added
to a new APEX without its dependencies that require implementation
APIs to compile.
This change reduces the number of modules in an AOSP arm64-userdebug
build by 3% (52242 to 50586), reduces the number of variants of the
libcutils module from 74 to 53, and reduces the number of variants
of the massive libart[d] modules from 44 to 32.
This relands I0529837476a253c32b3dfb98dcccf107427c742c with a fix
to always mark permissions XML files of java_sdk_library modules as
unique per apex since they contain the APEX filename, and a fix
to UpdateUniqueApexVariationsForDeps to check ApexInfo.InApexes
instead of DepIsInSameApex to check if two modules are in the same
apex to account for a module that depends on another in a way that
doesn't normally include the dependency in the APEX (e.g. a libs
property), but the dependency is directly included in the APEX.
Bug: 164216768
Test: go test ./build/soong/apex/...
Change-Id: I2ae170601f764e5b88d0be2e0e6adc84e3a4d9cc
APEX variants that share the same SDK version and updatability
almost always use identical command line arguments to build but
with different intermediates directories. This causes unnecessary
build time and disk space for duplicated work.
Deduplicate APEX variants that would build identically. Create
aliases from the per-APEX variations to the new shared variations
so that the APEX modules can continue to depend on them via the
APEX name as the variation.
This has one significant change in behavior. Before this change,
if an APEX had two libraries in its direct dependencies and one
of those libraries depended on the other, and the second library
had stubs, then the first library would depend on the implementation
of the second library and not the stubs. After this change, if
the first library is also present in a second APEX but the second
library is not, then the common variant shared between the two
APEXes would use the stubs, not the implementation.
In a correctly configured set of build rules this change will
be irrelevant, because if the compilation worked for the second
APEX using stubs then it will work for the common variant using
stubs. However, if an incorrect change to the build rules is
made this could lead to confusing errors, as a previously-working
common variant could suddenly stop building when a module is added
to a new APEX without its dependencies that require implementation
APIs to compile.
This change reduces the number of modules in an AOSP arm64-userdebug
build by 3% (52242 to 50586), reduces the number of variants of the
libcutils module from 74 to 53, and reduces the number of variants
of the massive libart[d] modules from 44 to 32.
Bug: 164216768
Test: go test ./build/soong/apex/...
Change-Id: I0529837476a253c32b3dfb98dcccf107427c742c
In preparation for reusing the same variation for multiple apexes,
rename ApexName to ApexVariationName.
Bug: 164216768
Test: all soong tests
Change-Id: I88f2c5b192ffa27acd38e01952d0cefd413222a0
We don't need the prebuilt versions. The NDK CRT objects are (now)
built from the platform sources and the only difference is that the
NDK CRT objects also include an ELF note that identifies the NDK
version, which isn't helpful for anything built by the platform.
Add a `crt` property to cc_object that allows CRT objects to identify
themselves. CRT objects, unlike other modules, will have a variant
built per-API level they support, rather than just an SDK variant and
a platform variant. This is needed because new CRT objects will rely
on APIs not available in old libcs and old CRT objects will not
support all the features of a modern one.
Test: treehugger
Bug: http://b/159925977
Change-Id: I6595485fa1bfe0ad4945193d344b863f64eec654
This hasn't worked for a couple years, and continues to bitrot. Just
remove it.
Adds a bpfix rule so that we can eventually remove the
product_variables.pdk definition, which is now always a no-op.
Test: treehugger
Change-Id: I830b54d419b59f6db1d4617b45e61a78234f57a7
Merged-In: I830b54d419b59f6db1d4617b45e61a78234f57a7
Instead of UnbundledBuild, use AlwaysUsePrebuiltSdks
to determine if java modules needs to be built against prebuilt sdks.
And rename UnbundledBuildUsePrebuiltSdks to AlwaysUsePrebuiltSdks to
express its behavior more correctly.(It can be orthgonal to "Unbundled")
Bug: 160390776
Test: TARGET_BUILD_UNBUNDLED_IMAGE=true m vendorimage
Change-Id: I0be7265c1959d8774c295372cd7a9250169f6df9