cc_stub_suite now has an additional attribute correponding to the api
surface. This attribute will be used to pass additional args to the stub
generator.
Update bp2build to set the api_surface of the apex stubs. This ensures
that its stubs are generated with "--systemapi --apex"
Test: unit tests
Bug: 298085502
Change-Id: If4c479f85e6e485b5c795a565a0c559f1f013bf5
This module type will be converted to a cc_prebuilt_* bazel target. It
will provide
1. a prebuilt (.a/.so) file
2. headers (as -isystem)
Test: added a bp2build unit test
Bug: 298088835
Change-Id: Ib58cc7f6fde8f4ca34516f6f18a4c048a02a049a
Currently, we have ~4 of these modules which are all defined in
prebuilts/ndk. However, using ctx.ModuleDir() instead has the following
advantages
- makes bp2build simpler since we do not need to relativize this path
- prevents soong modules from reaching into another directory (as the
test setups were doing).
Test: m nothing
Change-Id: I780e2564cb37ebf4b800f0cd184789f3fc6f2fc8
Collect all NDK exported headers paths into a file that is used to
detect public types that should be ABI monitored.
Assume that we have the following code in exported header:
typedef struct Context Context;
typedef struct Output {
...
} Output;
void DoSomething(Context* ctx, Output* output);
If none of public headers exported to end-users contain definition of
"struct Context", then "struct Context" layout and members shouldn't be
monitored. However we use DWARF information from a real library, which
may have access to the definition of "string Context" from
implementation headers, and it will leak to ABI.
STG tool doesn't access source and header files, only DWARF information
from compiled library. And the DWARF contains file name where a type is
defined. So we need a rule to build a list of paths to public headers,
so STG can distinguish private types from public and do not monitor
private types that are not accessible to library users.
Bug: 156513478
Test: development/tools/ndk/update_ndk_abi.sh with enabled canDumpAbi
Change-Id: I9fa41e73450a41379638debb3dc56f421e0fb870
Signed-off-by: Aleksei Vetrov <vvvvvv@google.com>
For a dependency edge A --> B (stublib), Soong will link A's platform
variant against impl of B's platform variant if either of these are true
1. A and B have same apex_available
2. B has bootstrap: true
3. B is only available to platform
(3) was missing from bp2build. This CL adds that.
To implement this, we check the `apex_available` property of B.
Test: updated bp2build tests
Test: Built the internal module b/299191635 that was failing due to this
Bug: 299191635
Change-Id: Iafb173a3ab20d69b89f7949ce40c6f4096396f24
Soong currently adds -isystem
prebuilts/ndk/current/sources/cxx-stl/system/include to modules that
have ndk_system STL. This does not translate well to Bazel because of
its stricter sandboxing constraints.
In preparation for building sdk variants with Bazel, create an
indirection where sdk variants that use this STL depend on a
`ndk_system` header library module.
This should be a no-op in Soong, but the resultant ninja files are not
identical. (e.g diff https://diff.googleplex.com/#key=OOLtc1GFmDDF). The
-isystem now appears _before_ the local cflags. However, this should be
fine because we have a check in `CheckBadCompilerFlags` that bans use of
-I/-isystem in user-provided cflags.
Test: diff'd ninja file
Test: TH
Bug: 298258442
Change-Id: I8c4e2b66bb9ac25c44ceedd52298ba474a554a04
This enables Machine Learning Guided Optimizations (MLGO) for register
allocation. App launch performance on oriole-userdebug is improved by
0.53%, and binary size is very slightly reduced (e.g. 64 bytes for
libart.so).
https://dashboards.corp.google.com/_0e1b06dd_a79e_4433_b625_b62e5cac004b?p=BootImageProfileId:36265
Test: presubmit
Bug: 229056536
Change-Id: I0e5d40bb90a1555a1343f114ebffffca281f20b2
-Wmultichar is enabled by default, so we don't need to explicitly
enable it.
Bug: 298703966
Test: presubmit
Change-Id: Iae820145e6412365024a97ab3a34d760563785fa
Sandboxing the rust rules requires having explicit inputs for the rust
toolchain. This module type makes the rustc prebuilt and its
dependencies explicit as a module that can be depended on by all rust
rules.
Bug: 286077158
Test: rust sandboxing topic + go test
Change-Id: If2b80b32e329e6a6ee11ba824de868cf04714553
This warning usually indicates an incorrect size being computed,
which can cause severe bugs.
Bug: 296422292
Test: presubmit
Change-Id: I381dea70a6a408883ec772ccc006746ad66b835f
This adds support for correctly handling Rust sanitized snapshots,
ensuring they only have one variation.
The presence of multiple variations were causing build failures
when a rust_fuzz module for host was defined and a snapshot
build was requested.
This also sets -Z link-native-libraries=no on host modules
(in addition to device modules) to avoid emitting extra linkage
flags due to link attributes.
Bug: 282897366
Test: SOONG_SDK_SNAPSHOT_USE_SRCJAR=true m
Change-Id: Idf980c29145f11c530ad635a4eb5b01a1730ac24
Now built with MLGO. This reduces the total Clang invocation time for
building AOSP by 0.7%.
TOOLCHAIN_RUSAGE_OUTPUT=/tmp/rusage.txt m -j32
PGO + LTO + BOLT 83839.78s
MLGO + PGO + LTO + BOLT 82949.30s
Test: presubmit
Bug: 293616148
Change-Id: I5364c341520172e8e1acafb4aa3330922805ac0e
Sanitized glibc binaries get their runtime added by clang, not by
Soong, but unsanitized glibc binaries with sanitized dependencies
need their runtime added manually by Soong. Fix adding a static
runtime dependency to static glibc binaries.
Fixes: 297250415
Test: TestUbsan
Change-Id: I4913326604f9efebd8ecd4aad2f109fad8b6a80c
Adds the ability to centrally disable HWASan for multiple modules when
building with SANITIZE_TARGET=hwaddress. Soong version of the patchset.
HWASan takes precedence over CFI and several other sanitizers that it's
incompatible with[1], which can be problematic for modules that require
those sanitizers (e.g. those that depend on vendor prebuilts where only
sanitized variants are provided). This patch adds an easy way to disable
HWASan for such modules while still keeping it globally enabled.
Test: build with HWASAN_EXCLUDE_PATHS set and verify with readelf that
relevant modules have no references to __hwasan symbols
[1] bb31ca1168/core/config_sanitizers.mk (236)
Change-Id: I5824f71f2a400c64cde29e2c7afdd167d851d337
For the trunk stable next build, we have duplicated modules for the
vndk libraries txt files: one from the generated list, the other from
the prebuilt vndk snapshot files.
If the current vndk version provided by the vndk snapshots, use the
txt file from the prebuilt vndk snapshot.
Bug: 296777146
Test: lunch cf_x86_64_phone-next-userdebug && m nothing
Change-Id: I18bd7b7c77bd37c26c5e0b15cb020a59d50f4f2f
I want to make this warning an error in my project and the
current setup is preventing me from doing so.
This has to be -Wno-error=reorder-init-list and not
-Wno-reorder-init-list because the later is overridden by some
modules explicitly enabling warning sets. -Wno-* flags are
overridden by -W* flags coming later in the command line,
but -Wno-error=* flags are only overridden by later -Werror=
flags.
Bug: 145210666
Test: presubmit
Change-Id: Ia08f8a20da37cdc57167324b0cd19413d8786990
Source tree may include prebuilt vndk snapshot libs that are newer
than or equal to the PLATFORM_VNDK_VERSION.
Ignore those prebuilt vndk snapshot libs.
Bug: 296488609
Test: lunch cf_x86_64_phone-next-userdebug; m nothing
Change-Id: I3adaf3b7636f53884f08540959d2ec2fddfb6921
There are three types of tests, deviceless tests, device-driven tests
and host-driven device tests. But currently we don't have information
to get the type of a test and can't generate test targets on desired
types.
Test: b test //platform_testing/tests/example/native:hello_world_test
Test: b test //packages/modules/adb:adbd_test
Bug: 296312548
Change-Id: I3f022ef769636d508e055477623a4d1a6a1d9044
Without an explicit deduping in this helper function, a dependency may
appear multiple times in the generated BUILD files. I noticed this while
converting some internal google tests.
This currently does the deduping for the non-configurable root value. I
ran into some issues deduping the configurable values, and I will
address it in a followup CL.
Test: go test ./bp2build
Change-Id: Ie7b588a9c922d72e4fabfb1414a7cc3dc402ff86
Soong's proto.include_dirs becomes the -I path for aprotoc cpp code
generation. This does not translate well to Bazel because it runs this
action in a sandbox. Even if we construct an -I path, the .proto files
will not be there. This CL attempts to handle this kind of dependency
automatically via bp2build.
For this hypothetical example
```
foo.proto # contains `import bar.proto"
Android.bp # cc_library {srcs:"foo.proto", p.include_dirs:["subdir"]},
subdir/bar.proto
```
Implementation details for CcProtoGen of foo
- Glob the labels of .proto files for each includeDir, and create a
proto_library that encapsulates them.
- Since Bazel poses a contraint that proto_library target needs to be
in the same pacakge as the .proto file, the proto_library might be created
in a subdirectory with an import_prefix
- Add bar's proto_library as transitive deps of foo's cc_proto_library.
This will be added to -I during aprotoc. We cannot add them to `deps`,
otherwise bar's symbols will be statically linked into foo's .a
file.
Implementation details for clang compile of foo
At the end of CcProtoGen, we have converted foo.proto
to .cpp/.h files. To compile them to .a files, we need the .h files
generated from bar.proto. Soong specifies this at the
top-level cc_library soong module, so add those deps as the
implementation deps for clang compile.
(Will add support for java in a follow-up CL)
Test: go test ./bp2build
Test: built some internal modules that were previously blocked by this
Bug: 285140726
Change-Id: I7e1f9f0d1b1ba916a7ba8278f6cfb342b381d695
llndk.libraries.txt file is currently located within the VNDK APEX.
However, this file is still required even if VNDK APEX is deprecated.
This change removes llndk.libraries.txt from VNDK APEX, so it can be
installed within the system image.
Bug: 290160925
Test: aosp_cf build succeeded with llndk.libraries.txt in the system
image
Change-Id: I09a0a43babaa58ff16fc04ea71ab41ab68b54b70
Because enabling ThinLTO makes some constructor functions not called
in arm64 executables.
Bug: 295944813
Test: build
Change-Id: Ic0cab5fd80aa86d0d9ca1131564b747a445c6e46
The orderfile use flags are unused as cflags causing warnings which becomes errors in some order file builds
In addition, I fixed the test cases so it only looks at ldflags not cflags for orderfile use flags.
Test: mma build/soong
Output: #### build completed successfully (05:14 (mm:ss)) ####
Change-Id: I2a2d846d6688fd5256cf753267c000ff054d56f1
- ARM 32-bit targets will be built with 4096 ELF alignment.
- ARM 32-bit targets will only support 4K Page sizes.
- ARM 32-bit targets won't be page agnostic.
Test: source build/envsetup.sh
lunch aosp_cf_x86_64_phone
m
Bug: 295550555
Change-Id: I61cc45fa5f2ea18c494dfc9a0ca44cf9b694dfa3
If `srcs` contains a gensrcs/genrule module, the current bp2build module
will put it in the catch-all `srcs` attribute. This is reserved for .cpp
sources, so if the genrule produces a .proto/.aidl/... file, this will
fail.
This handles genrules that produce .proto files. To implement this, this
creates an additional partition that detects if the other module is a
genrule/gensrc that produces .proto files. If true, it will append it to
the proto partition.
This CL does not handle
- genrule that produce .c/.aidl/.yacc/.... files. They will continue to
be partitioned into the catch-all partition
- java modules
Test: unit tests
Test: TH
Bug: 293205700
Change-Id: Ib720fdf3a053ff5dd256e6faa632e3fa7776966d
Revert submission 2681060-dumpstate-isstrictrun
Reason for revert: This change has been successfully cherry-picked to udc-d1-dev, and can now be reverted in AOSP so that libdumpstateutil doesn't need a vendor variant.
Reverted changes: /q/submissionid:2681060-dumpstate-isstrictrun
Change-Id: Ia337b557c71c5a64d350f45199929440474fa278
Reduce the import instr limit from the LLVM default (100) to 40. This
helps reduce the binary size as well as improving performance slightly.
Size:
Default(100) 40 30
libhwui.so 11059040 11058912 11060872
libart.so 10697576 10697160 10696568
Performance:
40 vs. default: 0.37% improvement
http://go/art-benchmark?p=BootImageProfileId:36054
30 vs. default: 0.36% improvement
http://go/art-benchmark?p=BootImageProfileId:36058
Test: presubmit
Change-Id: Id800ff7818cde908daab784bac0a312c6a71272d
Now migration to STG is complete, hence remove the legacy extraction
mechanisms.
Bug: 156513478
Change-Id: I55b7626e2bfa78c9bb5157ade73d71a97597da72
Signed-off-by: Matthias Maennich <maennich@google.com>
Replace the abidw->stg pipeline by just stg for extraction directly from
ELF/DWARF. This is to migrate to STG entirely.
As a migration tooling, keep the existing method active via
`legacy_use_abidw` as a flag on ndk_library.
Bug: 156513478
Change-Id: Ideaa9908b31591f49f9a167cfa3f3d5c95d8b198
Signed-off-by: Matthias Maennich <maennich@google.com>
STG's native .stg format has been designed with version control in mind
as is the best format to represent STG's internal data representation.
Hence, migrate the ABI representation dump to .stg. That is done by
converting `abidw` extracted xml to stg at build time. STG has builtin
`abitidy` functionality, so `stg` can replace the prior `abitidy` step
to generate the final format.
Bug: 156513478
Change-Id: Ifcac8998ab899637a5d8c54f9e72d79d3e28ec52
Signed-off-by: Matthias Maennich <maennich@google.com>
In addition, I added a test file to check if flags are added and propagated correctly.
Test: mma build/soong
Output: #### build completed successfully (07:24 (mm:ss)) ####
For testing with an actual binary or shared library, steps are in this
README:
https://android.googlesource.com/toolchain/pgo-profiles/+/refs/heads/main/orderfiles/README.md
Change-Id: Idcf169156ef691bcacb8adc92828ef09450085f8
This change adds libdumpstateutil to VndkMustUseVendorVariantList. This
is done to avoid a VNDK re-spin on aosp/2679475 and aosp/2681060, which
add the dumpstate util function IsStrictRun and make it framework-only.
Test: Presubmit; verify that builds still work on internal (refer to
aosp/2681060 test).
Bug: 283326935
Change-Id: I3c60dd919a65182937d6e0b233635ff6ca9414d3
This reverts commit 73fe13c9b1.
Reason for revert: b/293884796, crash on boot of riscv64 aosp phone.
Change-Id: Ie90e0e99ddaa7bb5d496e2b1d0ab0302702cb2bc
If the target SDK of the module is a preview, the current logic passes
it through to llvm-rs-cc, which expects an int. Convert codenames to
their API level first, then extract the final or preview int.
Also simplify the logic to look for 'current' more generically via the
common ApiLevel library functions.
Test: Verified local build of riscv64, confirmed RS attempts to build
with API level 9000+ instead of 'VanillaIceCream'.
Change-Id: I1fa7577181bfd16de0ea4e77f7ab8fbd8fdb55e5
This reverts commit e72ee14006.
Bug: 293532332
Reason for revert: Test failure fixed in https://r.android.com/2681595
Change-Id: Id40079133e50492a6e2f3e2794012695562c39f6