Commit graph

8437 commits

Author SHA1 Message Date
Elliott Hughes
69cf8a3221 Merge "Have the sanitizers trap rather than abort." into main 2023-10-09 16:08:05 +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
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