Commit graph

8713 commits

Author SHA1 Message Date
Yi Kong
9723e338ee Do not perform AFDO or optimizing LTO for eng builds
Afdo creates more variants to build, and optimizing LTO is costly to
perform. Turn off these two optimizations for eng builds for a faster
build speed.

This reduces total C/C++ invocation time for aosp_arm64-eng by 6.28%.

Test: presubmit
Bug: 307753064
Change-Id: Ibac4269c66a64e896dba2074b607d71a2da37546
2023-12-04 19:04:00 +09:00
Jooyung Han
85707de8c1 Add cc_library.target.vendor.no_stubs
This is to handle libz special case. libz has stubs but not an LLNDK.
So, libz.vendor should be treated as non-stub-providing libraries and
Vendor APEX should bundle it if it's used by its contents.

libz will set no_stubs for vendor/product variants.

Bug: 313806237
Test: go tests ./apex/...
Change-Id: I10759d7073838909126f8bfe87654f11aa02fd32
2023-12-04 11:06:20 +09:00
Colin Cross
f61d03d241 Add TestContext parameter to ContentFromFileRuleForTests
The next CL will need a TestContext parameter in
ContentFromFileRuleForTests in order to retrieve the file rule contents
from the Config.  Add it and update all the tests that use it in order
to simply review of the next CL.

Bug: 306029038
Test: go test ./...
Change-Id: Ia4b4c9854017ea3472fa2f8ba42cf7f72720496e
2023-12-03 17:22:56 -08:00
Elliott Hughes
bee01f7d62 riscv64: disable a weird option.
By default clang assumes that on riscv64 jumps are really expensive.
That's probably not true for the kind of SoCs we're dealing with, but
more importantly (see the bug) it causes clang to do loads from the
right hand side of a `&&` before the left hand side has been evaluated.
This found one latent bug in libcore, and it doesn't seem like the best
use of anyone's time to have to chase similar issues if they're going
to be similarly latent for riscv64 when we get clang's default fixed.

Bug: https://github.com/google/android-riscv64/issues/124
Test: treehugger
Change-Id: I640f1b43ea3d2452366ab86e97a9189fa9f5326c
2023-12-01 17:39:20 -08:00
Elliott Hughes
198583ed20 Merge "riscv64: stop explicitly disabling emutls." into main 2023-12-01 20:28:09 +00:00
Colin Cross
0d5dd390c6 Merge "Move test data installation to Soong" into main 2023-12-01 18:56:01 +00:00
Tomasz Wasilczyk
a1d45b8ec1 Merge "Bump default experimental from gnu++2a to gnu++2b." into main 2023-12-01 17:21:01 +00:00
Elliott Hughes
74780e61dc riscv64: stop explicitly disabling emutls.
riscv64 has always had ELF TLS (and the emutls bugs have been fixed now
too).

Test: treehugger
Change-Id: I8dd1d28d4f28a442130e4cf536166ea733f16a96
2023-12-01 02:08:05 +00:00
Colin Cross
5c1d5fb21b Move test data installation to Soong
To generate module-info.json in Soong for b/309006256 Soong needs to
know the test data paths. Moving test data installation into Soong will
also help later for test suite packaging.

Add ModuleContext.InstallTestData that installs the files listed in a
[]DataPath alongside the test.  The files will also be passed to Make
to allow it to continue packaging them into the test suites for now.

Update the module types that are producing LOCAL_TEST_DATA entries
in their Android.mk files to go through InstallTestData instead.

Bug: 311428265
Test: atest --host toybox-gtests --test-timeout=120000
Change-Id: Ia8b964f86e584ea464667fd86a48d754d118bead
2023-11-30 13:38:49 -08:00
Yu Liu
9dc6b1025d Merge "Add container property to aconfig_declarations." into main 2023-11-30 21:33:34 +00:00
Tomasz Wasilczyk
37d6943f37 Merge "Bump the default from gnu++17 to gnu++20." into main 2023-11-30 15:15:12 +00:00
Justin Yun
41cbb5e9b5 Define __ANDROID_VENDOR_API__
cc modules can use __ANDROID_VENDOR_API__ to read BOARD_API_LEVEL
that is the API level of the vendor surface.

Bug: 313822931
Test: check ninja commands to have -D__ANDROID_VENDOR_API__=<version>
Change-Id: Iceb5918cbfce0f24929d02d7e3caf1e9942b88e8
2023-11-30 05:26:12 +00:00
Yi Kong
33914a613f Merge "Remove PGO build support" into main 2023-11-29 07:35:14 +00:00
Yu Liu
eae7b36699 Add container property to aconfig_declarations.
Bug: 311155208
Test: Unit test
Change-Id: I7b187138856d0144203961e82b6dad5e2f8eed9d
2023-11-28 12:37:02 -08:00
Jooyung Han
9ffbe83028 Add non_apex.exclude_shared_libs to cc
This can be used to add apex-specific shared_libs to a CC module. It
would be nice if we could have apex.shared_libs. But it would make code
much harder to follow because we need to record the shared_libs list as
"exclude list" for non-apex anyway.

Bug: 312510312
Test: m libhardware libhardware.vendor libhardware.vendor.com.google.cf.ir
  # check DTNEEDED for libapexsupport
  # only apex-variant should have the dependency
Change-Id: I56a3dc280127d8ba44337707444ea226a49ccf0f
2023-11-28 22:42:23 +09:00
Yi Kong
9c3f433426 Remove PGO build support
We have removed our final PGO enabled project, time to remove PGO build
support.

Test: presubmit
Change-Id: I14ccd0fc8e3fbb8b3015072245fafd0eebe3ec08
2023-11-24 17:14:27 +09:00
Yi Kong
78a456e771 Merge "Remove unneeded MLGO cflag" into main 2023-11-22 06:06:47 +00:00
Yi Kong
8fb0b498db Remove unneeded MLGO cflag
For LTO compilation, we do not need MLGO flags in cflags, since codegen
happens during link only.

Fixes compiler warnings for unused command line argument.

Test: presubmit
Change-Id: I361e4292b10a3582fd5c69fa7b5678c654b44a0f
2023-11-22 06:06:36 +00:00
Pirama Arumuga Nainar
d03958d457 Merge "Revert "Remove flags rejected by RBE input processor"" into main 2023-11-21 23:45:12 +00:00
Pirama Arumuga Nainar
6c771e7d29 Revert "Remove flags rejected by RBE input processor"
This reverts commit a4724a0c4e.

Reason for revert: reclient has an updated deps scanner now.
Bug: http://b/248371171
Test: enable RBE; RBE_CLANG_TIDY_EXEC_STRATEGY=remote; make tidy-soong_subset


(cherry picked from https://android-review.googlesource.com/q/commit:2c36e5efceae94424b513878cf6dc4e9640651ab)
Merged-In: Id876bd7eee1e5606f8dc05903f77f135b47da360
Change-Id: Id876bd7eee1e5606f8dc05903f77f135b47da360
2023-11-21 19:54:27 +00:00
Aditya Choudhary
4b6eaf4bd1 Set testModule to true in cc.NewTest().
This Cl sets testModule field to True in cc.NewTest(). This will cover "cc_test", "cc_test_host" and "art_cc_test".

Change-Id: I4a8db86835b195db34fd9f86560e7bf9321fbd7d
2023-11-21 15:49:19 +00:00
Aditya Choudhary
87b2ab28a8 Add test spec provider to test modules.
Provider added for the following test modules in this change: art_cc_test, cc_benchmark, cc_fuzz, cc_test, cc_test_host, rust_test,and rust_test_host.

Bug: 296873595
Test: Manual test
Change-Id: I815680529bcbecacb3a2bdb8f3746053afdee48c
2023-11-20 21:52:56 +00:00
Colin Cross
4b9d9350bd Merge "Fix soong for go test ./..." into main 2023-11-18 02:30:13 +00:00
Yi Kong
ef2e76edb4 Merge "Revert "afdo: Remove -fprofile-sample-accurate flag"" into main 2023-11-17 22:08:14 +00:00
Colin Cross
7e2e794333 Fix soong for go test ./...
Fix various issues that prevent building or running tests with the
Go tools:

Remove testing/test_spec_proto/go.mod.  There's already a go.mod at
the top level, and adding testing/test_spec_proto/go.mod breaks
compiling with the Go tools in IntelliJ or from the command line.

Fix go vet issues when trying to print []DataPath.

Fix aconfig_conversion_test.go and add it to Android.bp so it runs
in presubmit.

Test: go test ./...
Change-Id: I18af2f05631446fe507744a2951e4b02c7ab59be
2023-11-17 21:28:39 +00:00
Tomasz Wasilczyk
e14961626c Bump default experimental from gnu++2a to gnu++2b.
Bug: 311052584
Test: treehugger
Test: m checkbuild
Change-Id: I5e9d479dd4c14e21fe7d29ea6894f1149fd15e50
2023-11-15 11:46:26 -08:00
Elliott Hughes
c79d9e3053 Bump the default from gnu++17 to gnu++20.
We should update gnu++2a to gnu++2b too, but not in this CL.

Bug: 311052584
Test: treehugger
Test: m checkbuild
Change-Id: I3637444d74868b3a29b425fd749ecbbe1a45fbf7
2023-11-15 11:46:03 -08:00
Yi Kong
0880a82de5 Revert "afdo: Remove -fprofile-sample-accurate flag"
This reverts commit febf8b9bdf.

We are still seeing flaky performance alerts from microbenchmarks even
with this change, and this has caused binary size / memory usage
increase. Let's add this flag back and observe whether performance
regression reports become more frequent.

Change-Id: I0fec1296b1f49b21b59d81add677f6a926ee88dc
2023-11-15 08:51:08 +09:00
AdityaK
76c7385f22 Provide an environment variable to disable mlgo
Helps iterate on compiler that was build without mlgo. Building with mlgo requires a docker image

Change-Id: Ie2988ecaf15031cdb14411abf7b99530e3860cce
2023-11-14 10:24:59 -08:00
Juan Yescas
a74b22e8e6 16k: soong: Add the C flag -D__BIONIC_NO_PAGE_SIZE_MACRO flag to x86-64
To simulate 16k page size in x86-64 cuttefish, it is necessary
to compile the shared libraries and binaries with max-page-size greater
than 4096.

Bug: 309816695
Test: source build/envsetup.sh
      lunch aosp_cf_x86_64_phone_pgagnostic-trunk-userdebug
      m
Change-Id: I32670ef2c25fdcefec11bd07ba41cd0ea96c92bd
2023-11-09 16:58:29 -08:00
Juan Yescas
3db51d2500 16k: soong: Add linker flag -Wl,-z,max-page-size for x86-84 to align binaries and .so
To simulate 16k page size in x86-64 cuttefish, it is necessary
to compile the shared libraries and binaries with max-page-size greater
than 4096.

Bug: 309816695
Test: source build/envsetup.sh
      lunch aosp_cf_x86_64_phone_pgagnostic-trunk-userdebug
      m
      readelf -l out/target/product/vsoc_x86_64_only/system/bin/toybox
Change-Id: I38e4449a7826a2eca0c1a1cccc916af21f0b3a93
2023-11-09 13:29:22 -08:00
Dan Willemsen
f051ec6de2 Merge "Update the minimum macos deployment version to 10.14" into main 2023-11-08 18:46:51 +00:00
Dan Willemsen
876b12ffdd Update the minimum macos deployment version to 10.14
Bug: 191879468
Test: Build aosp-build-tools on Mac
Change-Id: I21c3d0482ba9a23b2b54849eccb18c7958559d93
2023-11-08 02:11:27 +00:00
Yi Kong
0fa503da2e Only enable MLGO for ARM64 ThinLTO targets
The MLGO model we embed in the Android Clang is trained on ARM64
ThinLTO artefacts. Applying the model across architectures does not
necessarily translate to performance improvement. Therefore only enable
the optimisation on ARM64 ThinLTO for now.

Test: presubmit
Bug: 293827654
Change-Id: Ie64a65c11191cf700a463637a0746c8470d3aa3c
2023-11-07 14:12:51 +09:00
Colin Cross
f96b001064 Don't call android.PathForModuleSrc(ctx).String() to get ModuleDir
ctx.ModuleDir is much cheaper than android.PathForModuleSrc(ctx).String().

Test: builds
Change-Id: I81819088d9564b06a0336a59a45f2b110b0bd9d6
2023-11-02 19:07:49 +00:00
Yi Kong
bc9d35168c Merge "Add option to emit ThinLTO indexes and imports for MLGO training" into main 2023-11-01 05:12:25 +00:00
Yi Kong
b8eaee68b6 Add option to emit ThinLTO indexes and imports for MLGO training
Test: presubmit
Bug: 293827654
Change-Id: I8de1287543194d8e47ff5b57d4cabc7416048bbf
2023-10-31 21:59:45 +09:00
Hsin-Yi Chen
d8f510b687 Merge "Let header-abi-linker filter symbols by API level" into main 2023-10-31 03:55:05 +00:00
Hsin-Yi Chen
843c0638d6 Let header-abi-linker filter symbols by API level
In a trunk stable branch, the ABI-monitored libraries under different
release configurations share the source code. The exported symbols are
filtered by version scripts and API level. header-abi-linker needs to
take the API level as a parameter.

Test: make
Bug: 308192597
Change-Id: I4b55b7ec023451b3a4cd1da308a1de10842d51d2
2023-10-30 13:03:53 +08:00
Justin Yun
87e4128270 Merge "Stop using VNDK from product partition" into main 2023-10-30 05:01:44 +00:00
Aditya Kumar
e19a173a48 Merge "Discard IllegalFlags when testing a new compiler" into main 2023-10-29 00:50:33 +00:00
AdityaK
e7b606717a Discard IllegalFlags when testing a new compiler
Also add -Wno-everything as suggested by Pirama

Bug: b/308179696

Follow up: https://b.corp.google.com/issues/308179380

Change-Id: Iaa73f2b52363562b2391346d8b2e5dc73bab4f2d
2023-10-27 18:54:58 +00:00
Krzysztof Kosiński
14e25a504c Merge "Revert "Revert "Enable -Werror=incompatible-function-pointer-types""" into main 2023-10-26 21:46:35 +00:00
Krzysztof Kosiński
83199b5e4d Revert "Revert "Enable -Werror=incompatible-function-pointer-types""
This reverts commit 5e75975e04.

Reason for revert: breakages fixed

Change-Id: Id54499eabaca649bee5ea6452a3a4134d8773e2d
2023-10-26 07:16:29 +00:00
Justin Yun
d578412cf1 Stop using VNDK from product partition
Product modules install required vndk modules in /product/lib[64].
But still the product modules can link to the llndk from system
partition using the list in /system/etc/llndk.libraries.txt.
To install /system/etc/llndk.libraries.txt file, use
llndk_libraries_txt singleton without versioned name.

Until VNDK is fully removed, the vndk apex must install the versioned
llndk.libraries.<ver>.txt file to the vndk apex.
Use llndk_libraries_txt_for_apex singleton for this purpose.

Test: lunch cf_x86_64_phone-next-userdebug; m
Test: atest GtsVndkDependencyTestCases
Bug: 299867815
Bug: 302255959
Change-Id: I058616081fe31597a9b76b772b69927807436896
2023-10-25 14:36:04 +09:00
Yu Liu
7ec40649bb Merge "Support a few more attrs in cc_aconfig_library." into main 2023-10-23 22:47:37 +00:00
Treehugger Robot
c70be4b986 Merge "Globally disable -Wreorder-init-list." into main 2023-10-22 09:49:55 +00:00
Krzysztof Kosiński
8f8cc1668e Globally disable -Wreorder-init-list.
This warning is triggered even when initializers don't have any
side effects, so it very rarely surfaces actual bugs/mistakes.
99% of the time it complains about a purely cosmetic issue.
Disable it by default in commonGlobalCFlags, which still allows
individual modules to opt into it.

Bug: 145210666
Test: presubmit
Change-Id: I671b5c457ee3d92b9cc37f020ba54e01e1a04f59
2023-10-22 05:09:40 +00:00
Yu Liu
f11b7c3093 Support a few more attrs in cc_aconfig_library.
More might be added later when we have an allowlist.

Bug: 305998969
Test: b build with the change in ag/25094394
Change-Id: I92df843ac81f4e33ce7506db61c989a380015975
2023-10-20 19:17:53 +00:00
Eric Rahm
1952471c56 Reapply "Use zstd to compress debug info in cc libraries"
This reverts commit d0500f10ef.

Test: m
Bug: 305277519
Change-Id: I126395d32cfc0048b6403c831613d9b4a178af4d
2023-10-20 16:01:14 +00:00
Eric Rahm
5571ab8599 Reapply "Compress debug info in clang builds with zstd"
This reverts commit 6d089b7de0.

Test: m
Bug: 305277519
Change-Id: Iaa27fa0aae8ef624b403e905bfb04df15e380baf
2023-10-20 16:01:14 +00:00
Matías Hernández
a76ea9ac49 Merge changes from topic "revert-2788316-JFVDBRFDKA" into main
* changes:
  Revert "Decompress debug sections when creating debug info"
  Revert "Compress debug info in clang builds with zstd"
  Revert "Use zstd to compress debug info in cc libraries"
  Revert "Use zstd to compress debug info in rust libraries"
2023-10-20 15:48:28 +00:00
Matías Hernández
6d089b7de0 Revert "Compress debug info in clang builds with zstd"
Revert submission 2788316

Reason for revert: DroidMonitor-triggered revert due to breakage https://android-build.corp.google.com/builds/quarterdeck?branch=git_main&target=panther-next-userdebug&lkgb=10981485&lkbb=10981536&fkbb=10981536, bug b/306625613

Reverted changes: /q/submissionid:2788316

Change-Id: I7a49b82d26454fe34f8200622a38cdabc0f446cf
BUG: 306625613
2023-10-20 13:07:14 +00:00
Matías Hernández
d0500f10ef Revert "Use zstd to compress debug info in cc libraries"
Revert submission 2788316

Reason for revert: DroidMonitor-triggered revert due to breakage https://android-build.corp.google.com/builds/quarterdeck?branch=git_main&target=panther-next-userdebug&lkgb=10981485&lkbb=10981536&fkbb=10981536, bug b/306625613

Reverted changes: /q/submissionid:2788316

Change-Id: Ice939d57214879416da06d7134c6a8b56eaf00e6
BUG: 306625613
2023-10-20 13:07:14 +00:00
Eric Rahm
b60cd11bc7 Merge changes Ia85d8dc0,I4ab3d47f,Ieeaa6554,I0b3c1f08 into main
* changes:
  Use zstd to compress debug info in rust libraries
  Use zstd to compress debug info in cc libraries
  Compress debug info in clang builds with zstd
  Decompress debug sections when creating debug info
2023-10-20 10:32:13 +00:00
Eric Rahm
f52906f194 Use zstd to compress debug info in cc libraries
We can save a significant amount of disk space by compressing
debug info in `lld` cc builds. This change configures a build
flag to instruct lld to compress debug info when building cc
libraries. Rather than adding a global config we add this to
each target individually to avoid linker failures on windows
cross build targets.

Test: m
Bug: 305277519

Change-Id: I4ab3d47fb0de7e31a39fb671cccde1acee3a2018
2023-10-19 22:47:44 +00:00
Eric Rahm
fa0dff576b Compress debug info in clang builds with zstd
We can save a significant amount of disk space by compressing
debug info in `clang` builds. This change configures a build
flag to instruct clang to compress debug info.

Test: m
Bug: 305277519
Change-Id: Ieeaa655452d847e83ebc6bec0864e47c46f4c6fb
2023-10-19 22:24:58 +00:00
Cole Faust
14c1ed8d7d Merge "gofmt soong" into main 2023-10-19 03:48:45 +00:00
Cole Faust
06ea531ab3 gofmt soong
Test: Presubmits
Change-Id: Ia76c35ba51685eca29df51738000eacd3f43ce20
2023-10-18 17:42:59 -07:00
Aditya Kumar
f583bafc6e Merge "Revert "Enable hot cold split"" into main 2023-10-18 17:54:32 +00:00
Yi Kong
c1545e8dbf Merge "Add additional flag required for Flow Sensitive AFDO" into main 2023-10-18 07:04:06 +00:00
Aditya Kumar
b36eaa663b Revert "Enable hot cold split"
This reverts commit 4e28d0eda2.

Reason for revert: Reverting now that we should have sufficient data from Crystalball https://b.corp.google.com/issues/306023954

Change-Id: I9f92c203eda309956ec192432ba0063eb11f59e2
2023-10-17 21:31:45 +00:00
Liz Kammer
fa774656a1 Merge "Restrict bp2build of hdr library props" into main 2023-10-17 13:54:16 +00:00
Yi Kong
bc2d02aa6a Add additional flag required for Flow Sensitive AFDO
It can be removed in the future once it becomes default.

Test: presubmit
Bug: 304282732
Change-Id: Ia7729593eff13ba5cc69fdb54519305295313b4d
2023-10-16 16:59:21 +09:00
Liz Kammer
96da2babed Restrict bp2build of hdr library props
Only migrate relevant attrs

Test: bp2build.sh
Change-Id: Ie6635789a64a542ecd5815dc29313b505cc1f19a
2023-10-13 16:22:24 -04:00
AdityaK
4e28d0eda2 Enable hot cold split
Change-Id: I6752ee000bc72c488ab197f6671514c9e5faa2bd
2023-10-13 15:35:26 +00:00
Ramya Subramanian
5e75975e04 Revert "Enable -Werror=incompatible-function-pointer-types"
This reverts commit 07c362bf7f.

Reason for revert: DroidMonitor: Potential culprit for Bug 304839693 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.”.

Change-Id: Iafb894510c48af2dd8b015d7264a031ff9348884
2023-10-11 23:00:33 +00:00
Jingwen Chen
9c2e3ee54a Move platform constraints to bazel_common_rules.
This enables sharing of platform constraints between platform and kernel builds.

Bug: 304594734

Test: treehugger
Change-Id: I48091eeaf2e529c3f180ba056da3935911868b14
2023-10-11 12:07:44 +00:00
Yi Kong
b33ced051a Enable Flow Sensitive AutoFDO
FSAFDO (Flow Sensitive AutoFDO) is an improvement over AutoFDO. It
attempts to capture and represent the flow-sensitive profile in LLVM
optimization passes with the mechanism to expose and iteratively
reload/match the profile with better precision.

Enable this for all AFDO projects so that we can capture data from the
field, and then evaluate the performance gain.

Test: presubmit
Bug: 304282732
Change-Id: I0de6b4071e4f0a75500f3ffd5171a7be5117ec86
2023-10-10 14:16:29 +09:00
Treehugger Robot
6525ee82d7 Merge "Revert "Do not convert non-unit tests."" into main 2023-10-10 02:22:14 +00:00
Spandan Das
0f81762d3f Merge "Replace ndk_libs.bzl with an attr in cc_stub_suite" into main 2023-10-10 02:18:09 +00:00
Yi Kong
cdd6a47bbf Merge "Remove GLOBAL_THINLTO build option" into main 2023-10-10 01:41:56 +00:00
Jingwen Chen
6e119745b8 Revert "Do not convert non-unit tests."
This reverts commit 80b54d2502.

Reason for revert: caused hello_world_test to not be converted, but it's a test that builds/passes

Bug: 300117121

Change-Id: I805cfb336b7f58a5a1e295cade16be4c471e2ed5
2023-10-09 23:21:54 +00:00
Spandan Das
17a27f0c14 Replace ndk_libs.bzl with an attr in cc_stub_suite
(This CL is a cleanup, and should be a no-op)

Currently we support three variations of cc api stubs.
1. publicapi stubs, i.e. ndk stubs (empty additional args to ndkstubgen)
2. module-libapi stubs that are also an ndk library (--systemapi --apex)
3. module-libapi stubs that are not an ndk library (--systemapi --apex
   --no-ndk)

ndk_libs.bzl was used to differentiate between (2) and (3). This creates
an additional layer of indirection - users will need to modify this
external .bzl file if they would like to add a library to an ndk.

Replace this with an explicit atttibute in cc_stub_suite macro for better UX.

Test: go test ./bp2build
Test: b test //build/bazel/rules/cc:cc_stub_library_tests (added in
sibling CL)
Bug: 299501496

Change-Id: Idd3579e8013bae7a1740534f90d2767df5bac1a5
2023-10-09 18:07:39 +00:00
Elliott Hughes
69cf8a3221 Merge "Have the sanitizers trap rather than abort." into main 2023-10-09 16:08:05 +00:00
Yi Kong
950c17435d Remove GLOBAL_THINLTO build option
GLOBAL_THINLTO is now default, since it improves build speed, produces
more performant code and smaller binary. Remove the option to turn it
off since we no longer maintain that variation, and that simplifies the
logic (esp. for moving CFI builds to ThinLTO).

Also fixed a bug where ThinLTO is not propagated to its static deps on
non-default targets (32-bit or host).

Test: presubmit
Bug: 169004486
Change-Id: I31f41ba27c2b94a384d2ba5027049c307d6f4334
2023-10-09 10:56:14 +00:00
Yi Kong
0b6c4b7c08 Merge "Change lto_test to use GlobalThinLTO configuration" into main 2023-10-09 10:41:28 +00:00
Kiyoung Kim
f161d653cf Merge "Disable TARGET_VNDK_USE_CORE_VARIANT if VNDK is deprecated" into main 2023-10-09 05:31:12 +00:00
Krzysztof Kosiński
07c362bf7f Enable -Werror=incompatible-function-pointer-types
Bug: 296321145
Test: presubmit
Change-Id: I9c056285263061e17e53c4924dcd32bf5310ed91
2023-10-06 20:06:47 +00:00
Dan Albert
dbd4a25cf7 Merge "Fix error message to still be an error." into main 2023-10-06 18:55:32 +00:00
Christopher Parsons
f7fe400fbc Merge "Dont write data attrs for cc lib rules" into main 2023-10-06 14:09:07 +00:00
Kiyoung Kim
03b6cba1f2 Disable TARGET_VNDK_USE_CORE_VARIANT if VNDK is deprecated
TARGET_VNDK_USE_CORE_VARIANT enables vendor to use some of the VNDK
libraries with core variant installed in /system/lib. However, this does
not make sense when VNDK is deprecated. This change is to ignore
TARGET_VNDK_USE_CORE_VARIANT when the VNDK is deprecated.

Bug: 303754049
Test: aosp_cf_x86_go_phone boot succeeded
Change-Id: Ie9fa75e0fa452e48924d51d64201690ffb271f33
2023-10-06 14:12:43 +09:00
Chris Parsons
7123cc5370 Dont write data attrs for cc lib rules
The data attributes for cc library rules is dropped by their starlark
macros, so serves no real purpose. Furthermore, this unused dependency
proves problematic for allowlist v2, as there are many cases at HEAD
where the corner-case "requires" dependency would otherwise mark a module
as unconvertible.

Fixes: 303307456
Test: New unit test
Test: Manual verification to unblock allowlist v2 `bp2build.sh` runs in
AOSP

Change-Id: I6ca6104b958d2b428fc2ca5b3fa794106571acca
2023-10-05 22:07:28 +00:00
Elliott Hughes
3bba0e4bfe Have the sanitizers trap rather than abort.
abort() seems friendlier, but in practice it puts a couple of irrelevant
libc.so frames on the top of the stack trace and clobbers all the
registers that might have helped remotely debug a sanitizer failure.
Let's switch to trapping directly in the sanitized code instead.

Bug: http://b/298741930
Test: treehugger
Change-Id: I6c971920c8506f97133749aaddd73b8cea6a12bc
2023-10-05 14:51:28 -07:00
Dan Albert
5b2fd587c0 Fix error message to still be an error.
Bug: http://b/156513478#comment43
Test: m ndk, actually checked that it actually failed
Change-Id: I1951ddfee3bef7d06ab4561e445d75358e5a4abf
2023-10-05 21:45:41 +00:00
Christopher Parsons
0b5a877f21 Merge changes I5c7f1fc1,I6015581c into main
* changes:
  Fix comment for Bp2buildDepsMutator config.
  Use parameter name hint for BazelLabelModuleDepsWithFn's markAsDeps.
2023-10-05 18:11:28 +00:00
Trevor Radcliffe
e3e930d260 Merge "Implement bp2build for Sysprop Java" into main 2023-10-05 15:59:53 +00:00
Elliott Hughes
3fb5c15adf Merge "riscv64: assume fast unaligned access." into main 2023-10-05 15:03:02 +00:00
Jingwen Chen
863e33471a Delete some api_bp2build dead code.
Follow up of https://android-review.googlesource.com/2630914

Bug: 284029211
Test: presubmits
Change-Id: Idc0ff2f20e54b81cfdf61472a72e9cb027f60554
2023-10-05 10:23:58 +00:00
Jingwen Chen
3e582b8175 Use parameter name hint for BazelLabelModuleDepsWithFn's markAsDeps.
Test: presubmits
Change-Id: I6015581c27ad8b9b5b81d0ed01ba219699b9630b
2023-10-05 10:03:06 +00:00
Yi Kong
577a73a22d Change lto_test to use GlobalThinLTO configuration
This is now the default, and we will be removing non-GlobalThinLTO configuration.

Also changed handling for lto: never, it doesn't need to create an
lto-none variant.

Change-Id: I971baa920df867fb762923d925eed22215a89c27
Test: presubmit
2023-10-05 05:05:40 +00:00
Treehugger Robot
98b3cb2787 Merge "Add more information to the ABI error message." into main 2023-10-05 02:28:23 +00:00
Spandan Das
ee557e4c69 Merge "Create bp2build converter for versioned_ndk_headers" into main 2023-10-05 02:00:55 +00:00
Dan Albert
3440a6697e Add more information to the ABI error message.
Just knowing it failed is pretty useless. Tell people how to update
the ABI dumps.

Bug: http://b/156513478#comment43
Test: m ndk # after breaking the ABI
Change-Id: I7ed6a0acf2d1fbd942410678fc6aba2afbc5a2b6
2023-10-04 23:46:38 +00:00
Elliott Hughes
4b350985eb riscv64: assume fast unaligned access.
We have a CTS test for this, so we may as well let the compiler take
advantage!

Test: treehugger
Change-Id: Icb6dc73be5e6da1155f39ca03245ae6b9d24dfb5
2023-10-04 14:50:03 -07:00
Christopher Parsons
29c559b785 Merge "create, but dont register, bp2build_deps mutator" into main 2023-10-04 21:38:49 +00:00
Justin Yun
ce12ea8f95 Merge "Generate product variants by default" into main 2023-10-04 06:29:31 +00:00
Vinh Tran
85455887b7 Merge "Change bp2build to switch to using custom fdo_profile macro" into main 2023-10-03 14:58:21 +00:00
Chris Parsons
5f1b3c7ad8 create, but dont register, bp2build_deps mutator
This is the bulk of the "allowlist v2" feature. It will disable bp2build
generation for modules which have transitive dependencies without a
bazel build definition.

This CL includes this mutator, but doesn't register it as a bp2build
mutator (outside of a few unit tests). This allows us to easily iterate
on completion of this feature and ensure there are no launch blockers
before we finalize the change in AOSP.

Bug: 285631638
Test: Unit tests
Change-Id: Ifb0a079c409ca19b02cafa3fab2efa0d3deebc50
2023-10-03 00:16:30 +00:00
Treehugger Robot
2eff89a8ce Merge "Remove -Wsign-promo." into main 2023-10-02 23:14:26 +00:00
Spandan Das
a7da3f0e0b Create bp2build converter for versioned_ndk_headers
This module type is used by a single soong module - `common_libc` in
bionic/libc

Implementation details
- Convert this module type to ndk_headers rule. Bazel's ndk_headers rule
  will have a boolean attribute `run_versioner` to determine if
  verioner should be run on the headers
- Add this module type to the alwaysConvert bp2build list
- Add the converted target for `common_libc` to the deps of
  `ndk_sysroot`. This ensures that unbundled apps link against the
  versioned NDK headers of libc

Test: go test ./bp2build
Test: b build //bionic/libc:common_libc --config=android
Test: for f in $(find bazel-bin/bionic/libc/common_libc.versioned -type f); do cmp $f ${f/bazel-bin\/bionic\/libc\/common_libc.versioned/out\/soong\/ndk\/sysroot\/usr\/include}; done # no diff

Bug: 301169067

Change-Id: I55be202f0589db9bdc743c8be41c9c5afd74c352
2023-10-02 17:35:55 +00:00
Krzysztof Kosiński
29c60f34fb Remove -Wsign-promo.
This flag has no effect in Clang:
https://clang.llvm.org/docs/DiagnosticsReference.html#wsign-promo

Bug: 296606895
Test: presubmit
Change-Id: I59c1e6b6cf541529b9f4741accdf26822572426f
2023-09-30 06:15:22 +00:00
Krzysztof Kosiński
1a4572ec9c More documentation for C++ global config.
Bug: 296606895
Test: presubmit
Change-Id: I19a4fa327bf1eac192067caf6d064a740124caf6
2023-09-30 05:49:09 +00:00
Trevor Radcliffe
9b81d79ef6 Implement bp2build for Sysprop Java
Bug: 297356813
Test: bp2build and inspect BUILD files
Test: Conversion Unit Tests
Change-Id: Ib70400eb91bca946df1d99d953d7a0e7e63fb7cf
2023-09-29 15:42:00 +00:00
Aleksei Vetrov
31bbfe911b Merge "NDK library: fix ABI monitoring error message" into main 2023-09-27 16:38:57 +00:00
Vinh Tran
0bc8c956fe Change bp2build to switch to using custom fdo_profile macro
Test: go test
Bug: 260714900
Change-Id: Iead64ac7b30a3e706d8fb10899ecd8a1852bc32c
2023-09-27 11:10:58 -04:00
Sam Delmerico
ec59517f6a Merge changes from topic "reland-rust-sbox-1" into main
* changes:
  Revert^2 "conditionally escape rule builder command"
  Revert^4 "allow Ninja variables in RuleBuilder API"
  Revert^4 "add crate_root property to rust modules"
  Revert^4 "add rust_toolchain_rustc_prebuilt module type"
2023-09-27 08:10:26 +00:00
Justin Yun
af1fde43f9 Generate product variants by default
PRODUCT_PRODUCT_VNDK_VERSION is set to 'current' by default. Now, we
can generate product variants without checking the
PRODUCT_PRODUCT_VNDK_VERSION build variable. Remove reading the
PRODUCT_PRODUCT_VNDK_VERSION variable from soong and generate product
variants by default.

Bug: 302255959
Test: m
Change-Id: I9a9b2076f4367c5ce9a393bbb206f8dee3884bd8
2023-09-27 16:36:40 +09:00
Liz Kammer
ba23cb6436 Fix for ndk having sanitizers
Test: go test soong tests
Test: verify no NeuralNetworksTest_random_graph sdk variants in
    build.ninja when aosp_x86 is lunched
Bug: 302093869
Change-Id: I6429aa75518cca6974abcf7330236a6a07135ea1
2023-09-26 17:06:33 -04:00
Aleksei Vetrov
9c8c5ab3c3 NDK library: fix ABI monitoring error message
Error message in case of not valid "nextAbiDump" included wrong
"prebuiltAbiDump.InvalidReason()". Refactor error message to include
"nextAbiDump.InvalidReason()" instead.

Change-Id: I2581734dd16649af2b282b3459f461658abd3d87
Signed-off-by: Aleksei Vetrov <vvvvvv@google.com>
2023-09-26 11:30:47 +00:00
Treehugger Robot
370e34172f Merge "Generate a ndk_sysroot target in bp2build" into main 2023-09-26 05:16:53 +00:00
Spandan Das
af72583468 Generate a ndk_sysroot target in bp2build
This target will have a dependency edge to every bp2build equivalent of
Soong's ndk_headers. In b builds, sdk variants will compile against this
aggregated CcInfo providing target

A non monolithic alternative was discarded after conversations in
b/300504837#comment1-5

Contents of bp2build generated target: https://paste.googleplex.com/6643820291686400

Implementation details
- Since there is no equivalent Soong module for ndk_sysroot, hardcode
  bp2build/build_conversion.go to collect all ndk_headers soong modules.
  Add them to `deps` of a ndk_sysroot target
- Create `ndk_sysroot` in build/bazel/rules/cc/BUILD.bazel. This is
  expected to be a temporary location. This will use the
  cc_library_headers macro
- Update SetStubsForDynamicDeps so that sdk variant of rdeps depends on
  //build/bazel/rules/cc:ndk_sysroot. This will provide a CcInfo during
  compilation. Since ndk_sysroot is of type cc_library_headers, it will
  not get packaged into the apk.
- Refactor `goBazelTarget` to a generic `bTarget` so that it is
  representative of the expanded usage by ndk_sysroot

Test: b build //build/bazel/examples/android_app/java/com/app:app_with_sdk_variant_of_jni_deps --config=android (with aosp/2755284)

Bug: 300504837

Change-Id: Ifa427dd78115703ab251b0e1a0b71d3f19e91008
2023-09-25 21:27:19 +00:00
Justin Yun
a05a4f6f87 Skip snapshot for sanitizer variants with both cfi and hwasan
cfi and hwasan cannot be enabled at the same time. Skip building
vendor snasphots for the snapshot variants with both cfi and hwasan.

Bug: 277174974
Bug: 290779821
Test: HWASAN_INCLUDE_PATHS=frameworks/native/libs/gui m
Change-Id: Iaae913367a70e150d77a614de5f942aea98d1086
2023-09-25 23:07:49 +09:00
Sam Delmerico
f2b16069bb Revert^4 "add rust_toolchain_rustc_prebuilt module type"
930fd8bfb1

Change-Id: Id3f3a66022a496aab7db93670a7bdf8507384875
2023-09-25 12:13:17 +00:00
Colin Cross
40c7bae1df Merge changes from topics "revert-2629131-sandbox-rust-inputs-JRFPQTIPEY", "revert-2758566-WBNIADIEXA" into main
* changes:
  Revert^3 "add rust_toolchain_rustc_prebuilt module type"
  Revert^3 "add crate_root property to rust modules"
  Revert^3 "allow Ninja variables in RuleBuilder API"
  Revert "conditionally escape rule builder command"
  Revert "support sandboxed rust rules"
  Revert "fix failing rust_aconfig_library test"
  Revert "rustSetToolchainSource to use linux-x86 srcs"
  Revert "remove rust deps on clang prebuilts"
2023-09-23 05:19:13 +00:00
Wen-yi Chu
930fd8bfb1 Revert^3 "add rust_toolchain_rustc_prebuilt module type"
9333ac1249

Change-Id: Ic7f064806553a0cfbc286136a764b5ea3898d06c
2023-09-22 22:05:54 +00:00
Wen-yi Chu
41326c1f41 Revert "support sandboxed rust rules"
Revert submission 2629131-sandbox-rust-inputs

Reason for revert: Fail on android build.

Reverted changes: /q/submissionid:2629131-sandbox-rust-inputs

Change-Id: Ifd9aa46e80a12d8f4ffa0a2daa74b96727cbb7e6
2023-09-22 22:05:54 +00:00
Chris Parsons
6666d0f6b1 Switch bp2build mutator to bottom up
This should be no-op, as the underlying mutator has not changed yet.

Some other refactoring is required and done in this CL:

- Delete some old, dead ApiBp2build code
- Fix casting to TopDownMutator when it's not necessary

This change is required to prepare for allowlist v2 work, as only
BottomUp mutators can AddDependency.

Bug: 285631638
Test: m nothing
Test: presubmits
Change-Id: I5212a5f5634cc13056195783e6df37ff8eb000da
2023-09-22 19:19:22 +00:00
Liz Kammer
596ee5c82d Merge "Do not convert non-unit tests." into main 2023-09-22 14:08:53 +00:00
Spandan Das
7ba007a3c6 Merge "Create a bp2build converter for ndk_headers" into main 2023-09-21 23:11:33 +00:00
Liz Kammer
80b54d2502 Do not convert non-unit tests.
Test: CI
Change-Id: Iab9c134718351187859f34a26bd3a2aa66e009d5
2023-09-21 14:27:42 -04:00
Trevor Radcliffe
44e4102362 Merge "Revert "Block CFI on static libraries"" into main 2023-09-21 18:15:25 +00:00
Yu Liu
62f7302701 Merge "Convert cc_aconfig_library to bazel." into main 2023-09-21 17:43:07 +00:00
Trevor Radcliffe
85d55c2847 Revert "Block CFI on static libraries"
This reverts commit f9abec0987.

Reason for revert:
https://b.corp.google.com/issues/301444094
https://b.corp.google.com/issues/301443813
https://b.corp.google.com/issues/301437374

Change-Id: I6fd03e4d3c0930005178ad347f53156be8f15efc
2023-09-21 17:04:43 +00:00
Trevor Radcliffe
9483e4873c Merge "Block CFI on static libraries" into main 2023-09-21 13:05:21 +00:00
Yu Liu
855cfc2fac Convert cc_aconfig_library to bazel.
Bug: 297358249
Test: Unit test and CI
Change-Id: Ic84128b0df16efe4255b52b83670ec9902c09383
2023-09-20 17:46:46 -07:00
Spandan Das
319711b0bc Create a bp2build converter for ndk_headers
And add this module type to alwaysConvertList

Test: go test ./bp2build
Bug: 300504837
Change-Id: Ic09738ab47e7c497287b73de0f952d52aa78dd17
2023-09-20 23:04:02 +00:00
Spandan Das
9d47a82e27 Add version to stub label
This is a followup fix for aosp/2753352 that added the name of the
`cc_stub_suite` as deps of `unbundled_app` config setting. However,
cc_stub_suite is really a macro that expands to <name>-<ver>.

Add the version explicitly to rdeps

Bug: 298085502
Test: b build //build/bazel/examples/android_app/java/com/app:app_with_sdk_variant_of_jni_deps --config=android (with aosp/2755284)

Change-Id: I8cf2804141bb14589e11b03a138b715538a3f1ee
2023-09-20 23:04:02 +00:00
Sam Delmerico
52d1cc334b Merge changes from topics "revert-2746976-revert-2605644-rulebuilder-ninja-vars-OAAWYCDDLT-KMAGKVIXAT", "sandbox-rust-inputs" into main
* changes:
  support sandboxed rust rules
  conditionally escape rule builder command
  Revert^2 "allow Ninja variables in RuleBuilder API"
  Revert^2 "add crate_root property to rust modules"
  Revert^2 "add rust_toolchain_rustc_prebuilt module type"
2023-09-20 18:48:21 +00:00
Christopher Parsons
c331812a59 Merge "Have ConvertWBp2build use Bp2buildMutatorContext" into main 2023-09-20 17:56:24 +00:00
Trevor Radcliffe
f9abec0987 Block CFI on static libraries
Bug: 295805467
Test: Unit tests and inspecting generated BUILD files
Change-Id: I1bbd2f48ad384e0b5b6f7cc1458b12ded2748e8f
2023-09-20 16:01:20 +00:00
Liz Kammer
8e9ccda5d8 Merge "Don't panic for unhandled product vars" into main 2023-09-20 15:10:18 +00:00
Chris Parsons
637458d326 Have ConvertWBp2build use Bp2buildMutatorContext
This no-op refactoring facilitates some upcoming functional changes for
"bp2build allowlist v2". The work requires that the bp2build conversion
mutator be changed from a TopDown mutator to a BottomUp mutator.
Refactoring all bp2build-related methods so that they use Bp2buildMutatorContext
makes it easier to make this functional change without touching tens of
files and multiple projects.

Bug: 285631638
Test: m bp2build
Change-Id: I3d1ef3064146e959c6f0dc315350fc9764bf2bd2
2023-09-20 14:49:35 +00:00
Liz Kammer
9e12c78637 Merge changes from topic "prebuilt-cc-shared-always" into main
* changes:
  Implement bp2build for java_sdk_library_import
  Always convert prebuilt libraries
  Always convert prebuilt cc library headers
2023-09-20 13:13:51 +00:00
Aleksei Vetrov
ed8fb7a6a6 Merge "NDK library: use prebuilts to check next level ABI" into main 2023-09-20 11:16:59 +00:00
Liz Kammer
9e2a5a7d6d Don't panic for unhandled product vars
Instead, we return an error. This allows us to access some product
variable information earlier when it will not be used as an attribute
without panicing

Test: m nothing
Change-Id: Id094b2b9e1364a8d174d99b3824fa149fb235b3e
2023-09-19 15:58:22 -04:00
Liz Kammer
86a407f284 Always convert prebuilt cc library headers
Test: go tests
Test: CI
Test: patch in CL using prebuilts for mainline modules and build
Bug: 300640274
Change-Id: I73f70dac679e341670e1484ce57bc984f413d409
2023-09-19 15:58:20 -04:00
Aditya Kumar
a1a29b75db Merge "Revert "Revert "riscv64: enable V.""" into main 2023-09-19 16:52:31 +00:00
Aleksei Vetrov
8c02bbc533 NDK library: use prebuilts to check next level ABI
NDK has two ABI checks:

1. Check that prebuilt ABI exactly matches compiled binaries.

2. Check that ABI of level X compatible with level X+1.

The second check used compiled binaries for level X and prebuilts for
level X+1. But this approach may confuse people, because ABI change will
be shown "reversed". For example, adding new field to ABI monitored
binary of level X would be shown as "removed" when compared to level X+1
prebuilt.

This change uses prebuilts for both level X and level X+1. Given, that
prebuilts are checked to match compiled binaries, this should be enough.

Change-Id: If942e4319744bc5a2674cdd65f6a6f664fdfaa7e
Signed-off-by: Aleksei Vetrov <vvvvvv@google.com>
2023-09-19 15:50:47 +00:00
Sami Tolvanen
ed78fc8553 Reapply "Enable CFI for riscv64"
This reverts commit 49dcf79550.

The previous init crash was caused by the kernel defaulting to Sv57 and
the CFI shadow implementation in bionic assuming a 48-bit virtual
address space. With 5-level paging disabled in cuttlefish, we can again
enable CFI.

Bug: 293884796
Link: https://github.com/google/android-riscv64/issues/45
Test: cuttlefish boots
Change-Id: Ibcc02cf7ca6e396fd58674c648abf9f84daa260e
2023-09-18 13:41:29 -07:00
Spandan Das
1f65f9e9bd Stub/Impl selection for sdk variants
If a dependency has ndk stubs, then the sdk variant of the library
should link against the ndk stub variant and not the impl/apex_stubs variant

Unlike module-libapi, the depdendency does not go through an
@api_surfaces external repo indirection. This indirection was created to
support Multi-tree, and will likely  be removed in the future

Test: Added a unit test
Bug: 298085502
Change-Id: Ie081e153fa586b6c22db0b8e42f91149fd8e5d9b
2023-09-16 02:57:29 +00:00
Spandan Das
63acae9af1 bp2build converter for ndk_library
ndk_libary will be converted to a cc_stub_suite target. Its api_surface
attribute will be publicapi

The headers corresponding to this stub target will be added in a followup bug
(tracked in b/300504837)

Bug: 298085502
Test: Added a unit test
Change-Id: If9745083b18e0bcf5ecb89229a0f709b949d401c
2023-09-16 02:57:26 +00:00
Sam Delmerico
a588d153c8 support sandboxed rust rules
This commit adds support for compiling rust rules inside the sbox
sandbox. To compile a rust module with sandboxing enabled, the entry
point to the crate must be specified via the `crate_root` property, and
all input sources and compile-time data must be specified via the `srcs`
and `compile_data` properties.

Bug: 286077158
Change-Id: I8c9dc5cf7578037a583b4be2e2f73cf20ffd4408
2023-09-15 22:46:56 +00:00
Sam Delmerico
9333ac1249 Revert^2 "add rust_toolchain_rustc_prebuilt module type"
400749d1f0

Change-Id: I63f04e13605c43f800f01f45345e4b3dc61aefb7
2023-09-15 22:40:16 +00:00
Elliott Hughes
726b001ae1 Revert "Revert "riscv64: enable V.""
This reverts commit 2583523144.

Change-Id: I5b05d546e17dee497dce1bfeb9290445e1c071c2
2023-09-15 16:36:59 +00:00
Vinh Tran
ce40b92c84 Implement bp2build converter for fdo_profile
Ignore-AOSP-First: ag/24746588, in the same topic, is in an internal repo. This CL will be cherry-picked to AOSP afterward.
Test: go test
Bug: 277091218
Change-Id: I389d9535ea176991a1faa9beb46352b93363acd2
Merged-In: I389d9535ea176991a1faa9beb46352b93363acd2
2023-09-15 10:45:17 -04:00
Spandan Das
0e76a723fc Merge "Parameterize cc_stub_suite for api surface" into main 2023-09-14 21:39:17 +00:00
Spandan Das
c77ca9af3a Merge changes Ib58cc7f6,I780e2564 into main
* changes:
  Create a bp2build converter for ndk_prebuilt_*_stl
  Make ndk_prebuilt_*_stl's libDir relative to module
2023-09-14 17:22:14 +00:00
Spandan Das
04f9f4cf71 Parameterize cc_stub_suite for api surface
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
2023-09-14 17:07:24 +00:00
Aditya Kumar
928c0c436d Merge "Revert "riscv64: enable V."" into main 2023-09-14 16:53:59 +00:00
Aleksei Vetrov
7ab127f7c7 Merge "NDK library: collect NDK headers for ABI monitoring" into main 2023-09-14 12:05:46 +00:00
Jeremy DeHaan
2583523144 Revert "riscv64: enable V."
This reverts commit aa204ec49c.

Reason for revert: b/300158981

Change-Id: I4e969c7fccade0f8e1b29cb6267c27355ddca866
2023-09-14 00:46:21 +00:00
Spandan Das
e12d252e22 Create a bp2build converter for ndk_prebuilt_*_stl
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
2023-09-13 18:08:55 +00:00
Spandan Das
6e332d2266 Make ndk_prebuilt_*_stl's libDir relative to module
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
2023-09-13 18:05:13 +00:00
Zijun Zhao
748f8fb624 Merge "Handle Clang's change of defaults from -fcommon to -fno-common" into main 2023-09-13 17:34:47 +00:00
Aleksei Vetrov
262ed1a347 NDK library: collect NDK headers for ABI monitoring
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>
2023-09-13 15:39:58 +00:00
zijunzhao
5bcebba331 Handle Clang's change of defaults from -fcommon to -fno-common
Remove fcommon and make fno-common by default.

Bug: b/151457797
Test: make checkbuild
Change-Id: Ieb4c1e1bfff05fd0db894e8eab263fb31b376da9
2023-09-13 05:09:11 +00:00
Treehugger Robot
83c0ea6e26 Merge "Use ndk_system STL header library" into main 2023-09-13 00:34:15 +00:00
Elliott Hughes
5c12fb922d Merge "riscv64: enable V." into main 2023-09-12 17:57:50 +00:00
Sam Delmerico
dd6caa739d export SetStubsForDynamicDeps for use in AIDL
Bug: 298249725
Change-Id: Ia93b320783eccf04fef167a26e2efb401c0e4236
2023-09-10 18:15:45 +00:00
Sam Delmerico
1d3740a274 Merge changes from topic "revert-2605644-rulebuilder-ninja-vars-OAAWYCDDLT" into main
* changes:
  Revert "add rust_toolchain_rustc_prebuilt module type"
  Revert "add crate_root property to rust modules"
  Revert "allow Ninja variables in RuleBuilder API"
2023-09-08 20:46:55 +00:00
Sam Delmerico
400749d1f0 Revert "add rust_toolchain_rustc_prebuilt module type"
Revert submission 2605644-rulebuilder-ninja-vars

Reason for revert: b/299568218

Reverted changes: /q/submissionid:2605644-rulebuilder-ninja-vars

Change-Id: Ic3d1ba7e8a61427b52f31cc3f187c9d5a7d9a7bb
2023-09-08 16:10:47 +00:00
Treehugger Robot
9abcf649a7 Merge changes from topics "rulebuilder-ninja-vars", "rustc_prebuilt_build_tool" into main
* changes:
  allow Ninja variables in RuleBuilder API
  add crate_root property to rust modules
  add rust_toolchain_rustc_prebuilt module type
2023-09-08 00:10:18 +00:00
Spandan Das
f7bae9ab3e Fix bp2build's stub/impl selection logic for platform variants
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
2023-09-06 22:15:13 +00:00
Spandan Das
72b8fcbbec Use ndk_system STL header library
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
2023-09-06 19:55:42 +00:00
Treehugger Robot
f3d52683a9 Merge "soong: HWASan exclude path support" into main 2023-09-06 01:14:12 +00:00
Treehugger Robot
ca22dfb5d1 Merge "Enable -Wmultichar." into main 2023-09-05 21:17:21 +00:00
Treehugger Robot
ec6f10f648 Merge "Update OWNERS file for actual Android LLVM members." into main 2023-09-05 17:14:07 +00:00
Yi Kong
798f5d2e7e Merge "Enable MLGO for register allocation" into main 2023-09-03 05:38:34 +00:00
Yi Kong
67a2dee8c5 Enable MLGO for register allocation
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
2023-09-03 05:38:14 +00:00
Treehugger Robot
e56803d74d Merge "Skip device test only configs for auto gen test config" into main 2023-09-02 08:46:56 +00:00
Krzysztof Kosiński
769f5030d4 Enable -Wmultichar.
-Wmultichar is enabled by default, so we don't need to explicitly
enable it.

Bug: 298703966
Test: presubmit
Change-Id: Iae820145e6412365024a97ab3a34d760563785fa
2023-09-02 03:33:00 +00:00
Yabin Cui
74a06516ca Merge "Revert "Disable Global ThinLTO by default"" into main 2023-09-01 22:18:16 +00:00
Stephen Hines
796fcd4174 Update OWNERS file for actual Android LLVM members.
Test: N/A
Change-Id: Ifd24b1a6161ef6bf4e85ab3d1113106f456f1fa4
2023-09-01 14:48:34 -07:00
Treehugger Robot
08e1792144 Merge "Enable -Wsizeof-array-div for 3P code." into main 2023-09-01 17:35:53 +00:00
Yabin Cui
1aa29e6ca9 Revert "Disable Global ThinLTO by default"
This reverts commit 9c81c0cfd9.

Reason for revert: The ThinLTO problem has been fixed in https://android-review.git.corp.google.com/c/platform/bionic/+/2725997. So we can Re-enable Global ThinLTO.

Change-Id: I25dde4910692fd71124b48f45911da5b7b92a089
2023-09-01 17:22:58 +00:00
Treehugger Robot
079efbda94 Merge "Update clang version to clang-r498229b" into main 2023-09-01 08:49:09 +00:00
Sam Delmerico
b45c844ce7 add rust_toolchain_rustc_prebuilt module type
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
2023-08-31 18:03:33 +00:00
Krzysztof Kosiński
24686c5e22 Enable -Wsizeof-array-div for 3P code.
This warning usually indicates an incorrect size being computed,
which can cause severe bugs.

Bug: 296422292
Test: presubmit
Change-Id: I381dea70a6a408883ec772ccc006746ad66b835f
2023-08-31 01:29:59 +00:00
Yu Liu
7ece4aae36 Support memtag sanitizer.
Bug: 295173102
Test: local unit tests
Change-Id: Ib8cd82cd3989d9c120255e149473d8ec00f100f5
2023-08-28 17:14:58 -07:00
Ivan Lozano
5467a39984 rust: Rust sanitized snapshots variations
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
2023-08-25 12:54:56 -04:00
Yi Kong
ed7c73edfe Update clang version to clang-r498229b
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
2023-08-25 15:21:52 +09:00
Colin Cross
55e775f94f Merge "Fix adding manual ubsan runtime to static glibc binaries" into main 2023-08-24 17:11:47 +00:00
Colin Cross
0df8153267 Fix adding manual ubsan runtime to static glibc binaries
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
2023-08-23 22:39:58 -07:00
Treehugger Robot
14d9face53 Merge "Enable -Wgnu-designator" into main 2023-08-23 08:21:57 +00:00
Tomislav Novak
f734f00898 soong: HWASan exclude path support
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
2023-08-22 18:15:14 +00:00
Justin Yun
74217d9177 Use vndk snapshot libraries txt files if exist
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
2023-08-22 10:11:52 +09:00
Krzysztof Kosiński
4353fab901 Enable -Wgnu-designator
Bug: 296606895
Test: presubmit
Change-Id: I2ef67807fef8376ea08f65f60439b7c3b6f73e83
2023-08-21 23:55:44 +00:00
Treehugger Robot
4147e5c1d1 Merge "Handle proto.include_dirs in bp2build for CC" into main 2023-08-21 20:43:02 +00:00
Krzysztof Kosiński
982c588c35 Document why certain warnings are disabled.
Bug: 296606895
Test: presubmit
Change-Id: I0227eb216ddc59cfe2c3b785376cfb8f9ccab441
2023-08-21 17:50:07 +00:00
Treehugger Robot
9ae68ccb2e Merge "Re-enable -Wreserved-id-macro." into main 2023-08-21 08:26:36 +00:00
Treehugger Robot
4f13a40b67 Merge "Allow enabling -Wreorder-init-list from Android.bp." into main 2023-08-21 08:25:04 +00:00
Krzysztof Kosiński
78425e510d Allow enabling -Wreorder-init-list from Android.bp.
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
2023-08-18 21:39:25 +00:00
Krzysztof Kosiński
0c91d64b0b Re-enable -Wreserved-id-macro.
Bug: 296606895
Test: presubmit
Change-Id: Idba7b92f636796b9631db6f100a7d2e31ebb05fe
2023-08-18 21:19:43 +00:00
Alex Buynytskyy
655ad9a236 Merge "Ignore some prebuilt vndk libs for trunk-stable next" into main 2023-08-18 17:51:23 +00:00
Yike Zhang
fd7870f231 Merge "Give cc_test rule information to determine the test types" into main 2023-08-18 17:28:05 +00:00
Treehugger Robot
350c024d33 Merge "Relocate llndk.libraries.txt into system" into main 2023-08-18 15:24:37 +00:00
Justin Yun
f14beafb7c Ignore some prebuilt vndk libs for trunk-stable next
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
2023-08-18 18:01:08 +09:00
Treehugger Robot
bbd3a3ba18 Merge "Dedupe all deps of cc_libraries" into main 2023-08-18 00:06:39 +00:00
yike
fdca7fe03b Give cc_test rule information to determine the test types
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
2023-08-17 21:28:47 +00:00
Spandan Das
f3ab29be2d Dedupe all deps of cc_libraries
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
2023-08-17 21:20:29 +00:00
Trevor Radcliffe
2ec55ba261 Merge "bp2build for sanitizer blocklists long term fix" into main 2023-08-17 21:02:03 +00:00
Spandan Das
ec39d516af Handle proto.include_dirs in bp2build for CC
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
2023-08-17 00:16:00 +00:00
Kiyoung Kim
a2d6deedab Relocate llndk.libraries.txt into system
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
2023-08-16 10:03:16 +09:00
Yabin Cui
9c81c0cfd9 Disable Global ThinLTO by default
Because enabling ThinLTO makes some constructor functions not called
in arm64 executables.

Bug: 295944813
Test: build
Change-Id: Ic0cab5fd80aa86d0d9ca1131564b747a445c6e46
2023-08-14 15:47:36 -07:00
Trevor Radcliffe
d9b7f17f37 bp2build for sanitizer blocklists long term fix
Bug: 286872909
Test: Unit tests
Test: b build relevant targets
Change-Id: I553091f76fca936006651b1ed22c8fe4d176e18f
2023-08-14 19:29:39 +00:00
Juan Yescas
83b86cccda Merge "soong: ARM 32-bit targets must be built with 4k elf alignment" into main 2023-08-14 17:56:55 +00:00
Sharjeel Khan
3c5d4c257d Removed order file use flags from being passed to cflags
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
2023-08-11 23:28:46 +00:00
Chia-Chi Teng
4e0f6451ca Revert "Handle Clang's change of defaults from -fcommon to -fno-common"
This reverts commit a4a4d29509.

Reason for revert: DroidMonitor-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?branch=git_udc-dev-plus-aosp&target=aosp_cheetah-trunk_staging-userdebug&lkgb=10647066&lkbb=10647484&fkbb=10647184, bug 295551355.

Bug: 295551355

Change-Id: I9b68cdac258b26f975e1e575a383b789c87adaa4
2023-08-11 19:59:44 +00:00
Juan Yescas
23cc4aa7aa soong: ARM 32-bit targets must be built with 4k elf alignment
- 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
2023-08-11 12:00:40 -07:00
Zijun Zhao
88df1d3e0b Merge "Handle Clang's change of defaults from -fcommon to -fno-common" into main 2023-08-11 15:29:43 +00:00
Juan Yescas
0106560e34 soong: Add product variable DevicePageSizeAgnostic
The product variable DevicePageSizeAgnostic will determine
whether AOSP is kernel page size agnostic or not.

Test: source build/envsetup.sh
      lunch aosp_cf_arm64_phone_pgagnostic
      m
      cat out/soong/build.aosp_cf_arm64_phone_pgagnostic.ninja | grep __BIONIC_NO_PAGE_SIZE_MACRO
Bug: 289419664
Change-Id: I33a1a4f1967d7e78432b7b8d90357d16b2002dcc
2023-08-09 16:46:07 -07:00
zijunzhao
a4a4d29509 Handle Clang's change of defaults from -fcommon to -fno-common
Remove fcommon and make fno-common by default.

Bug: b/151457797
Test: make checkbuild
Change-Id: I38a858b1d41d6567bdd0fbc91b307b0270ab51b1
2023-08-09 04:54:37 +00:00
Kevin Jeon
51732356b8 Merge "Revert "Add libdumpstateutil to vendor variant list"" into main 2023-08-07 14:38:17 +00:00
Sharjeel Khan
bf4db77c03 Merge "Created an Orderfile go file for the build system. In addition, I added a test file to check if flags are added and propagated correctly." into main 2023-08-03 23:16:34 +00:00
Spandan Das
59b8a6687d Merge "cc Bp2build support for genrules that generate .proto file" into main 2023-08-03 21:51:11 +00:00
Trevor Radcliffe
24e0b13b9c Merge "Export no sanitize link runtime flag" into main 2023-08-03 20:54:39 +00:00
Trevor Radcliffe
0555acc1f7 Merge "Export Minimal Runtime Flags" into main 2023-08-03 20:39:22 +00:00
Spandan Das
a99348dca4 cc Bp2build support for genrules that generate .proto file
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
2023-08-03 18:56:05 +00:00
Kevin Jeon
05518b64b4 Revert "Add libdumpstateutil to vendor variant list"
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
2023-08-03 13:56:54 +00:00
Treehugger Robot
3ff50d5854 Merge "Limit LTO inlining even when profile is present" into main 2023-08-02 22:27:04 +00:00
Dan Shi
ad04250dd1 Skip device test only configs for auto gen test config
Bug: 286659776
Test: m some host test module
Change-Id: I2abe9cc1474691ef5aed17ca51b6f948728d01be
2023-08-02 13:53:00 -07:00
Trevor Radcliffe
da64d91d2e Export no sanitize link runtime flag
Bug: 294219797
Test: Unit tests
Change-Id: Id4bbf78e9ba3893fb857b85e6b7261b11404ebf0
2023-08-02 20:24:29 +00:00
Trevor Radcliffe
3876c5a143 Export Minimal Runtime Flags
Bug: 294219797
Test: Unit Tests
Change-Id: Ia6a617378ccecb01bda4951d223b6c99d6c75060
2023-08-02 15:41:50 +00:00
Matthias Männich
a5e9abe75f Merge "NDK library: remove remnants of abidw usage" into main 2023-08-02 15:18:02 +00:00
Treehugger Robot
eec4bb4ecd Merge changes Ideaa9908,Ie45cb7da into main
* changes:
  NDK library: extract ABI representations with STG
  NDK library: switch abi diffing to STG
2023-08-02 11:24:39 +00:00
Treehugger Robot
c9893274e0 Merge "NDK library: switch to stg ABI format" into main 2023-08-02 11:23:05 +00:00
Yi Kong
d6ab48c660 Limit LTO inlining even when profile is present
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
2023-08-01 18:30:13 +00:00
Kevin Jeon
4b4d61fa2e Merge "Add libdumpstateutil to vendor variant list" into main 2023-08-01 18:25:33 +00:00
Matthias Maennich
e914f2d5c3 NDK library: remove remnants of abidw usage
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>
2023-08-01 17:22:47 +00:00
Matthias Maennich
55486f8674 NDK library: extract ABI representations with STG
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>
2023-08-01 17:22:47 +00:00
Matthias Maennich
ca8ae6564f NDK library: switch to stg ABI format
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>
2023-08-01 17:22:47 +00:00
Matthias Maennich
658bb4dad9 NDK library: switch abi diffing to STG
Bug: 156513478
Change-Id: Ie45cb7daffb9861ed5bc26792f184bffcbe90bdb
Signed-off-by: Matthias Maennich <maennich@google.com>
2023-08-01 17:22:47 +00:00
Sharjeel Khan
c6a93d853b Created an Orderfile go file for the build system.
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
2023-08-01 16:58:58 +00:00
Prashanth Swaminathan
1e079dfdf2 Merge "Convert preview sdkVersion to int for target-api" into main 2023-08-01 01:40:16 +00:00
Florian Mayer
2d8b555f2e Merge "Reland "[hwasan] remove workaround for fixed toolchain issue"" into main 2023-07-31 20:46:55 +00:00
Treehugger Robot
7b4449ae94 Merge "Revert "Enable CFI for riscv64"" into main 2023-07-31 18:54:11 +00:00
Ivan Lozano
17ac9fa93e Merge "Revert "rust: Add SCS sanitizer option for AArch64"" into main 2023-07-31 18:13:40 +00:00
Treehugger Robot
82c298c240 Merge "Convert coverage libs as alwayslink" into main 2023-07-31 18:13:07 +00:00
Ivan Lozano
22823eed4b Revert "rust: Add SCS sanitizer option for AArch64"
This reverts commit 8827113577.

Reason for revert: hwasan builds breaking

Change-Id: I28094e27d5935c6f371fddddf4b6b0334de9b12c
2023-07-31 18:01:26 +00:00
Treehugger Robot
dc3606a81d Merge "Gen a header library when genrules export includes" into main 2023-07-31 17:48:44 +00:00
Ivan Lozano
0e403456b0 Merge "rust: Add SCS sanitizer option for AArch64" into main 2023-07-31 17:27:01 +00:00
Kevin Jeon
501be146db Add libdumpstateutil to vendor variant list
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
2023-07-31 13:08:37 -04:00
Prashanth Swaminathan
49dcf79550 Revert "Enable CFI for riscv64"
This reverts commit 73fe13c9b1.

Reason for revert: b/293884796, crash on boot of riscv64 aosp phone.

Change-Id: Ie90e0e99ddaa7bb5d496e2b1d0ab0302702cb2bc
2023-07-31 16:15:57 +00:00
Prashanth Swaminathan
30f7c79949 Convert preview sdkVersion to int for target-api
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
2023-07-29 11:44:33 -07:00
Florian Mayer
f50eda3b9b Reland "[hwasan] remove workaround for fixed toolchain issue"
This reverts commit e72ee14006.

Bug: 293532332
Reason for revert: Test failure fixed in https://r.android.com/2681595

Change-Id: Id40079133e50492a6e2f3e2794012695562c39f6
2023-07-28 21:22:34 +00:00
Christopher Ferris
6ff7d9e532 Merge "Allow ramdisk targets to set cflags/exclude_srcs." into main 2023-07-28 19:02:48 +00:00
Ivan Lozano
8827113577 rust: Add SCS sanitizer option for AArch64
SCS has been supported in Rust since 1.64.0.

This adds SCS as a sanitizer option in Rust.

Bug: 168914033
Test: Built module with sanitize: { scs: true }
Change-Id: Ie54ac4693286878b98704cf052649a267777d764
2023-07-28 14:34:28 -04:00
Florian Mayer
a09c4bf8cb Merge "Revert "[hwasan] remove workaround for fixed toolchain issue"" into main 2023-07-28 18:28:22 +00:00
Mark White
e72ee14006 Revert "[hwasan] remove workaround for fixed toolchain issue"
This reverts commit 07ca220182.

Reason for revert: b/293532332 - bionic unit tests failing

Change-Id: I11412df55d7131ff0bb36dee7258b75a12024100
2023-07-28 13:54:57 +00:00