This allows us to, for certain modules, enable bp2build, but disable
mixed builds.
This facilitates easier iteration on these two features, as modules can
be incrementally "fixed" for bp2build, even if they are not ready for
mixed builds integration.
Test: USE_BAZEL_ANALYSIS=1 m libc
Test: Manually verified that note_* modules exist in bionic/libc/BUILD
Test: bazel build //bionic/....
Change-Id: I3462c8398680140cfc953443d96196143b8ad0a3
LLNDK stubs and headers are required to build the vendor modules
against VNDK snapshot libraries. Add the LLNDK stubs and headers to
the VNDK snapshot prebuilt files.
The stub libraries will be included in shared/llndk-stub directory.
Bug: 181815415
Test: development/vndk/snapshot/build.sh --build-artifacts
Change-Id: If518f3e91080e69fa1da94af0aa27320d4e71a08
ApexInfo is not part of the properties struct. It can handle structs
having private fields.
Bug: 1663140
Test: m
Change-Id: Ib07d4410f0ce187c9de347da34b84b814b2eb537
A module will be installed to debug_ramdisk (or
debug_ramdisk/first_stage_ramdisk if recovery as boot is true) if
debug_ramdisk is set to true.
Bug: 184004542
Test: soong test
Change-Id: Ic5a4d27407e506fffa462de2149e0785f11b2ac7
This is unused and doesn't work with our current API review process
anyway (un-drafting an API won't be flagged for API council review).
Test: treehugger
Bug: None
Change-Id: I6d8fcc9885b82dac5ada7772d9e3fb9101524ece
Before this change, exclude paths disabled sanitization of targets that
would otherwise be enabled by SanitizeDevice product variable (aka
SANITIZE_TARGET).
With this change, in addition to the above logic, exclude path disables
sanitization of targets that would otherwise be enabled by the
corresponding include path.
Effectively, this change disables sanitization of targets that are
covered by *both* include and exclude paths.
Test: build/soong/cc/cc_test.go
Bug: b/184976817
Change-Id: I96f1e2a808d88b352b92b7490fa1df5c010314c3
This adds Rust vendor image support for all module types except
Rust prebuilts.
Bug: 184042776
Test: New Soong tests.
Test: Example cc_library vendor module can depend on rust_ffi_shared.
Test: Example rust_library vendor-only module compiles.
Change-Id: Iaa30ad51fdaedcbf14687da5472581f6af62ff59
As part of adding Vendor support to Rust, refactor the image mutator in
CC to a new common image mutator interface so this logic can be reused
across both CC and Rust.
Bug: 184042776
Test: m nothing
Change-Id: Ia55d5ad840db7cf1a64d6c65ed86487230cb8742
There is little overlap at this point, but we expect these to converge
more over time, to handle exported includes, libs, etc., this will allow
those changes to be handled in one place and allow more consolidation of
code.
Test: bp2build generate & sync; mixed build libc
Change-Id: I51685dad9f4fc11a634965a3c9e84f4a0e279ecb
cc modules have complex image variant settings. To avoid setting
wrong partitions to modules, add a test to check the install
partition.
Bug: 184885453
Test: m nothing
Change-Id: I080661335f2da7281d6e6a0d2fedd1fcecb4b2cb
In aosp/531337 support for installing prebuilts to vendor and odm
partitions was introduced.
Since aosp/1542687 allowed installing vendor variants to odm, we
started to see device_specific cc_prebuilts not installed to odm
at all.
The reason for this is the InVendor condition is true for the
device_specific module and VendorVariantToOdm is false in cases
outside the one it was designed for, so SocSpecific returns true and
the module gets installed to vendor instead of odm.
We need to check if we're specifically building a vendor variant
before triggering this VendorVariantToOdm logic.
Bug: 184885453
Change-Id: I05be06a61c5fc3f2f72599eb4746c9c0523b956e
This changes the return value into a compiler/linker attr struct to
standardize callsites and make it easier to retrieve the parsed attrs.
Test: TH
Change-Id: I1e3956e7cb5d924ce8472ece940faea459beef37
This CL contains the converter for libdl_android, a cc_library that
expands into a cc_shared_library and a regular cc_library.
Test: TH
Test: bp2build; bazel test //build/bazel/tests/...
Change-Id: If70641a538211b0d6b2aac0e4d0d06912318304d
We need this so that HWASan sanitizer mutator in CC can sanitize Rust.
Bug: 180495975
Test: m nothing
Change-Id: I2c9eb248df4e55a33f5d45083e91588f4c8e3e94
Modules linking against VNDK R have been using libgcc_stripped and
libunwind_llvm as their unwinder. This change uses those old unwinder
libraries if current module's VNDK version is R.
Bug: 178470649
Test: soong test
Change-Id: I86d0600b2fb09cd9828c0a5b1157558711b0ec86
memtag sanitizer libraries are vendor available and can be captured as
snapshots. This change adds a redirection logic for memtag libraries.
This is just a workaround, just like other SnapshotInfoProvider calls.
In the future we need to refactor these codes. So TODO is added to
remind refactoring.
Bug: 178470649
Test: soong test
Change-Id: Id77f1ce94255b56a68f3e1d7446a68189c45ac54
Test: Added unit test
Test: bp2build-sync.py write; bazel build //bionic/... works for more cc_library_static targets (in a parent CL)
Change-Id: Ib487216a4bcbc52958ff948722dae347b0d8b606
For an AIDL file, five files are generated for the CPP backend: cpp
output, depfile, and three headers. Previously, the cpp output and the
dep file were created at <module_out>/gen/<abs_path_to_input_aidl>.cpp,
while the headers were at <module_out>/gen/aidl/<package_name>/*.h.
This not only looks inconsistent, but more critically makes it difficult
for the aidl compiler to infer the path to the headers that the build
system registered as implicit outputs. Inferring the implicit outputs
by the aidl compiler is needed because otherwise users will see the
error message from sbox just saying that some of the expected files are
not created. This can happen when the input AIDL file is put directly
into the srcs property without specifying the base directory, e.g.
some/subdir/android/foo/IFoo.aidl where the pacakge is actually
android.foo.
In order to make it easy for developers to fix such an error,
I0f23b6027ba3a4755cc2901f4a7f7fc70bffd0ef introduces a check in the aidl
compiler which is triggered earlier than the sbox error. The compiler
now enforces that the cpp output is at
<out_dir>/<package_name>/<type>.app. When the check fails, it suggests
to fix that by correctly feeding the AIDL file via filegroup and the
path property.
This change in Soong is required to satisfy aidl compiler when the base
directory is correctly set. The cpp output is now at
<module_out>/gen/aidl/<pacakge_name>/<type>.cpp.
Bug: 184586092
Test: aidl_unittests
Change-Id: I172180a40bded4f6c08679a2d862b086998be1e1
Suffixes attached to snapshot modules are based on the main architecture
(e.g. "arm64" for aosp_cf_x86_64_phone-userdebug), not the architecture
of arch variants.
Bug: 184588077
Bug: 184695066
Test: Run unit tests using:
Test: source build/envsetup.sh
Test: m -j nothing
Change-Id: Id8d002d45864a6fb12d642b60011e7a9eaf29e07
Androidmk_suffix has been captured with "m vendor-snapshot". But the
suffix is to avoid collision with core variants, so the suffix should be
based on the existence of core variants. This change sets the suffix by
using OtherModuleDependencyVariantExists. This way we can also avoid
mutators and global states.
Bug: 179665538
Test: m nothing (soong test)
Change-Id: I35343aa2c4c07782057b82e6dd0e705a786e55fc
Required fixes:
- Set MakeLinkType for libraries, even in mixed build mode.
- Set snapshot header information to empty list, which passes
validation logic for depending modules
Fixing these libraries also requires a Starlark change to
cc_library_static.bzl, which will be submitted separately.
Additionally, this adds better error messaging in the event that
output files are missing from a mixed-build library.
Test: USE_BAZEL_ANALYSIS=1 m libc
Test: USE_BAZEL_ANALYSIS=1 m runtime-module-sdk
Change-Id: Iad2c4d46359986fb0a43263292a15ed45fabbac7
Starting with copts for cc_object, with an extracted function that can
be shared with other cc_* module types.
Test: TH
Change-Id: I9025232e83a3dcd0ca243387486fafbdbd3e2d9b
All version names will go through ApiLevelFromUser which triggers an
error when the name is not a valid one.
Bug: 175678607
Test: m
Change-Id: Id33bf64085603914d45ad7942cb8908a4734493f
Remove Android-targeting gcc toolchain libraries -- libgcc,
libgcc_stripped, libatomic, and libgcov. Also remove libunwind_llvm,
which is replaced with a libunwind toolchain prebuilt.
The __atomic_* library functions are now part of the compiler-rt
builtins library:
https://android-review.googlesource.com/c/toolchain/llvm_android/+/1625025
Bug: http://b/153025717
Test: treehugger
Change-Id: I971d0a4a49f1aaeb3546e80b6d94208277a171ac
This CL is pretty large, so I recommend starting with reading the newly
added tests for the expected behavior.
This change works in conjunction with the linked CLs in the Gerrit topic.
Those CLs add support for new platform() definitions for OS targets
specified in Soong's arch.go, which are configurable through
Android.bp's `target {}` property. It works similary to previous CLs
adding support for the `arch {}` property.
These configurable props are keyed by the OS: android, linux_bionic,
windows, and so on. They map to `select` statements in label list
attributes, which this CL enables for cc_library_headers' header_libs
and export_header_lib_headers props.
This enables //bionic/libc:libc_headers to be generated correctly, from:
cc_library_headers {
name: "libc_headers",
target: {
android: {
header_libs: ["libc_headers_arch"],
export_header_lib_headers: ["libc_headers_arch"],
},
linux_bionic: {
header_libs: ["libc_headers_arch"],
export_header_lib_headers: ["libc_headers_arch"],
},
},
// omitted props
}
to:
cc_library_headers(
name = "libc_headers",
deps = [] + select({
"//build/bazel/platforms/os:android": [
":libc_headers_arch",
],
"//build/bazel/platforms/os:linux_bionic": [
":libc_headers_arch",
],
"//conditions:default": [],
}),
)
Test: TH
Test: Verify generated //bionic/libc:libc_headers
Fixes: 183597786
Change-Id: I01016cc2cc9a71449f02300d747f01decebf3f6e
cc/linker.go code assumes that export_static_lib_headers can apply
regardless of whether a library is a regular or 'whole' static lib.
However, this check prevents that code from working.
Bug: 183654927
Test: use export_static_lib_headers like this
Change-Id: I680f90514e41224a7077630167ab4e481909d89c
So far, when a library `libfoo` has `stubs.versions: ["10", "11"]`, then
`shared_libs: ["libfoo"]` is linked to the version 11 of the stub.
This requires the author of `libfoo` to manually update the property
whenever a new version is introduced. Otherwise, clients are not able
to use the newly added APIs because the latest stub is for an old
version.
This change eliminates the need for manual updating. "current" version
is always implicitly added to `stubs.versions`. It is added even when
nothing is set on the property, if `stubs.symbol_file` is set. i.e.
```
cc_library {
name: "libfoo",
stubs: {
symbol_file: "libfoo.map.txt",
// no versions: [...] needed
},
}
cc_library {
name: "a_client",
shared_libs: ["libfoo"],
apex_available: ["myapex"],
min_sdk_version: "29",
}
apex {
name: "myapex",
native_shared_libraries: ["a_client"],
min_sdk_version: "29",
}
```
`a_client` links to the "current" stub of `libfoo` that has all symbols
shown in the map file.
Note that, above doesn't mean that the client has unlimited access to
APIs that are introduced even after the min_sdk_version of the client
(29 in this example). The use of such APIs still has to be guarded with
`__builtin_available` check.
Bug: N/A
Test: m
Change-Id: I70bb1600c18e74d36c6b24c3569d2149f02aaf96
cc_object crtbrand sets product_variable.platform_sdk_version.asflag
and will not compile correctly within mixed builds without it.
Only handles product_variables that expand product variables.
Bug: 181794963
Test: ~/aosp/build/bazel/scripts/milestone-2/demo.sh full
Change-Id: I293fcb18032aa51f63bb7b3de94abd6d1ec38180
Fixes the few tests that break due to this and which cannot easily be
separated into their own changes.
Bug: 183650682
Test: m nothing
Change-Id: Ia2f31213a1f114a78e66a81d89279ecde9f4c465
* changes:
Make test_for arch variant.
Don't use APEX stubs between internal libs in the same APEX when building test_for modules.
Add FilterListPred.
Don't panic on "go test" invocations from the command line.
To be able to avoid registering dependencies on nonexistent host APEXes
in host builds.
Test: art/tools/buildbot-build.sh --host
with http://r.android.com/q/topic:libdexfile-noext applied
Bug: 183217299
Change-Id: Iaa6411b511b6f50da01827b49852607ae825bc83
building test_for modules.
This extends the current approach where test modules always depend on
the platform variants of the APEX libs, and only skips the stubs on
them. It still has the limitation that the internal libs must have the
exact same apex_available lists.
Also some improvement of the test accuracy in TestTestFor.
Test: m libartagent-target
with http://r.android.com/q/topic:libdexfile-noext applied
Bug: 183217299
Change-Id: I2118b8a22c887077867a3ddbbe73437b4a29a6ad
* changes:
Replace ANDROID_SDK_HOME with ANDROID_PREFS_ROOT for metalava
Simplify lint rules using improved RuleBuilder rsp support
Support multiple rsp files in RuleBuilder
Pass rsp files into sbox and rewrapper
Add test for sbox input sandboxing
Support multiple rsp files in REParams
Move response file handling to a separate package
rewrapper supports a comma separate list of rsp files, replace
REParams.RSPFile with REParmas.RSPFiles.
Test: remoteexec_test.go
Change-Id: I7850c071c23d368d6fad4480dd527d146c13c6d3
Revert the static_lib behavior to the previous behavior (pass static
libs to the linker rather than via to rustc using `-lstatic=<lib>`). To
bundle static libraries into libraries, provide the whole_static_libs
property which retains the current static_libs behavior.
Passing all static libraries via -lstatic was resulting in odd bloat
where in some cases static symbols were duplicated in binaries and
libraries. This split makes it possible to be explicit about when static
libraries should be bundled.
Bug: 183182230
Test: mma system/bt; mma system/security/keystore2; mma external/rust
Change-Id: Ic2dde5d1542dca5ce145aa3a3fbd9ea54440d991
Also refactor bp2build-related code for cc_library_headers.
(Retry of previous CL after the presubmit failed to detect a merge conflict)
Test: Added unit test.
Test: bp2build-sync.py write; bazel build //bionic/... still works (but bp2build is disabled for most cc_library_static targets for other reasons)
Change-Id: I2f4405c2fea305623bbc6daaaf62808b0c074216
Test behavior was changed a while ago so that tests by default ignore
non-existent source paths (unless they explicitly check for/rely on
them). Prior to that CheckSnapshot() could detect when files were
missing from the snapshot but it no longer can.
This change disallows non-existent source files in all the sdk tests
which means that they are disallowed when processing the snapshots as
they use the same preparers as were used to process the sources.
This caused a test failure which has been temporarily ignored and has
a TODO and bug associated with it.
Bug: 183184375
Test: m nothing
Change-Id: I969d8515d20ef5ae515f2b5f93d8ed4e4f8ede75
Revert submission 1594391-bp2build-cc_library_static
Reason for revert: Broke the build on aosp-master
Reverted Changes:
Ib16ccf31a:Add cc_library_static macro to help with bp2build ...
I37c856be2:Add bp2build support for cc_library_static.
Change-Id: Ie94d5bc6da81758cd4e0461c08a810a29643c971
Also refactor bp2build-related code for cc_library_headers.
Test: Added unit test.
Test: bp2build-sync.py write; bazel build //bionic/... still works (but bp2build is disabled for most cc_library_static targets for other reasons)
Change-Id: I37c856be20a47b154909338a22a7dba1ab55693f
This CL adds the support for specifying lists of directories in
build/soong/android/bazel.go, which are then written into
out/soong/bp2build/MANIFEST. Using this configuration,
modules/directories can either default to bp2build_available: true or
false, while still retaining the ability to opt-in or out at the module level.
It also ensures that ConvertWithBp2Build returns true iff the module
type has a registered bp2build converter.
Test: go tests
Test: demo.sh full
Test: TreeHugger presubmits for bp2build and mixed builds.
Change-Id: I0e0f6f4b1b2ec045f2f1c338f7084defc5d23a55
--icf=safe has been enabled for arm and arm64.
Do the same thing for all devices.
On bertha_x86_64, this CL makes system.raw.img 4.4MB smaller.
Bug: 182446785
Test: build
Change-Id: Ifd597cd8496c49b55df269f22e01b1c50dc8f6e8
Bug: http://b/181740505
Explicitly adding dependency to profile runtime causes apex dependency
errors. We're already passing -fprofile-instr-generate to the linker so
depending on the profile runtimes is unnecessary.
Test: pgo-coral-config1 on internal release branch and run tests on
APCT.
Change-Id: Ie54785726c7ac044e5a5a2299073d02d45d5e0a7
Link against the libunwind.a shipped with the NDK so it matches what's
linked into the NDK's libc++_shared.so.
Bug: http://b/153025717
Test: device boots, manually inspect some linker command lines
Change-Id: Icc79844f5e70f0eaa97ea758449c30fbddd030d2
Background: `min_sdk_version` of a crt object is the oldest SDK version
that the crt object supports. When it's set to for example 16, Soong
creates a number of versioned variants of the crt object starting from
16 to the latest version. The variant for version X is provided to NDK
clients having `min_sdk_version` set to X.
Problem: all versioned variants of a crt object were built with `-target
<arch>-linux-android16`. Therefore they all have been with `#define __ANDROID_API__
16`. This is because the mutated variants still have the same
min_sdk_version property and the clang triple follows min_sdk_version,
not sdk_version. This is too conservative and against our intention to
provide the latest crt object that matches with the min_sdk_version of
the client.
In the other hand, the platform(non-sdk) variant of the crt object
doesn't have such a problem. min_sdk_version is completely ignored.
However, this is a bug and will be fixed by aosp/1640364. As a side
effect of the fixing, the platform variant will begin to built with a
very old __ANDROID_API__ which unnecessarily turns off the new platform
features like the TLS segment over-alignment.
This change fixes the problems:
* For the versioned variants of crt objects, we set both
`min_sdk_version` and `sdk_versio` to the version that the variant is
created for.
* For the platform variant of crt objects, `min_sdk_version` is force
reset to "current".
Bug: 183191008
Test: m
Change-Id: I8c9d0fcea816de8cd1532dac4a47eee4f726c037
Background:
When compiling cc_* modules, min_sdk_version determines the "version"
part of the clang triple: -target <arch>-linux-android<version>. The
version part is used to make sure that calls to the APIs that are added
after the version are guarded with a runtime check (i.e.
__builtin_available).
Previously, min_sdk_version was used as the version part only when the
cc_* module is unbundled (e.g. built for an APEX or built with SDK). In
other words, min_sdk_version has been ignored for the platform variants.
They were built with the version number 10000.
This was problematic for Mainline module tests. Since they are neither
part of an APEX nor built with SDK (because they need to have access to
some of the module-only APIs), they are built with the version number
10000. As a side effect, __builtin_available macro are expanded to 1 at
build time - because 10000 is higher than any API versions. When such a
test built in the latest platform source tree runs on a device running
an old platform, it tries to call an API that might not be available on
the platform and experience a crash, due to the lack of the runtime
check.
This change fixes the problem by using min_sdk_version as the "version"
part of the clang triple, regardless of the module's variant. Then
__builtin_available macro in the tests doesn't expand to 1, but to a
function call to the libclang_rt.builtin library which checks the system
property ro.build.version.sdk.
Bug: N/A
Test: run resolv_stress_test
Change-Id: I88f64c5a35f1b5276c3350e177b116932011a940
With clang r377782, llvm binutils implements all the necessary
funtionaility for strip.sh. We can finally get rid of all the fallback
GNU binutils usage.
Test: m
Bug: 141010852
Bug: 135627985
Change-Id: I110f6028dab7f599decf59a5cb1b927b35e11857