Commit Graph

8230 Commits

Author SHA1 Message Date
Florian Mayer
7410d28356 [MTE] temporarily disable memtag-stack with exceptions
unwinding through tagged frames is fixed in upstream and cherry-picked
onto Android toolchain in https://r.android.com/2251926. until then, we
can disable stack tagging for code that uses exception, so we can get
some coverage before the toolchain update.

Test: stack_tagging_helper exception_cleanup from https://r.android.com/2175188
      fails with assertion "GetTag(&y) !=
      GetTag(__builtin_frame_address(0))" as expected
Bug: 174878242
Change-Id: I1597b21f64a92874dbccb64ffebbef7bb9bf8214
2022-10-20 11:17:42 -07:00
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux
c5184ec089 Rename prebuilt_library_* to cc_prebuilt_library_*
Follow the convention of everything else in `cc`

Test: CI
Change-Id: I133d0b7119d4e9b357aada3467bc079f20dc0f60
2022-10-20 14:51:55 +00:00
Yi Kong
a9e1df1522 Enable ICF=safe for host binaries as well
We regressed binary size when we switch Darwin to use LLD, because
Darwin LD64 does ICF by default. Turn on ICF for host binaries to regain
the binary size savings (saves some space for Linux as well).

Test: presubmit
Bug: 236924555
Change-Id: I433062c3d263d69e431c1552faf1f18b13c5da42
2022-10-20 14:45:52 +09:00
Jingwen Chen
230c57af16 Merge "Make cc_genrule.srcs configurable." 2022-10-20 05:34:02 +00:00
Muhammad Haseeb Ahmad
431ddf9b76 Output shared dependendencies of JNI libs for Java fuzzers
Test: m example_java_jni_fuzzer
Bug: 252846698
Change-Id: Ib583de335482350bfe293f9c3d021a595edd4f44
2022-10-20 00:55:58 +00:00
Chih-hung Hsieh
47907191e2 Merge "Disable external/grpc-grpc even with TIDY_EXTERNAL_VENDOR=1" 2022-10-19 19:36:03 +00:00
Yu Liu
d6201013eb Make cc_genrule.srcs configurable.
Also disallow arch variant of genrule.out.

This is to be consistent with bazel where we are migrating to.

Bug: 254114674
Test: Manual
Change-Id: I685a2e64102b7bb68128b39931f0bc85878bc6de
2022-10-19 12:35:26 -07:00
Kiyoung Kim
bdb7495fe5 Remove unused module definitions in library stub
There are some module definitions which are implemented for the proof of
concept, but these modules are not in use now. This change removes
unused module definitions to reduce confusion.

Bug: N/A
Test: m nothing passed
Change-Id: I9b8efbc368436eaef66a4e6557006e87c0c27713
2022-10-19 04:04:55 +00:00
Chih-Hung Hsieh
ff2efae9b0 Disable external/grpc-grpc even with TIDY_EXTERNAL_VENDOR=1
Some projects do not allow or fix tidy warnings to
avoid warnings-as-errors. They should not run
clang-tidy even with TIDY_EXTERNAL_VENDOR=1.

Bug: 244631413
Test: presubmit; TIDY_EXTERNAL_VENDOR=1 make tidy-external_subset
Change-Id: Id86a55c222fdad813c1c3434245c86bb97d0cad6
2022-10-18 18:58:50 -07:00
Chih-Hung Hsieh
d21c46a5f8 Allow default clang-tidy checks
This will avoid suppressing all checks in user defined
.clang-tidy config files.

Bug: 252877310
Test: TIDY_EXTERNAL_VENDOR=1 make tidy-soong_subset
Change-Id: I99032300542e9b83cba60b00f8d328c63b5728e2
2022-10-18 21:12:19 +00:00
Spandan Das
f0beebc523 Skip existence check for stub library files
Switch from `PathForModuleSrc` to `PathForSource`. The latter does not
check that the target path exists in the tree. This is necessary since
the prebuilt stub and header directories are not guaranteed to exist
when Soong analysis begins (Step 2a)

Build orchestrator will be responsible for putting these files in the
right place as part of Multi-tree ninja invocation (Step 4)

Test: go test ./cc
Change-Id: I27175a8440fca6bba21197b1e106a22b733da882
2022-10-18 19:11:38 +00:00
Sam Delmerico
a8762ad673 add comments to keep STL code in sync with Bazel
Change-Id: I95869f97ade5c76db7f341327629e45315a9f6d5
2022-10-14 12:25:13 -04:00
Alexander Smundak
c34d91436a Merge "Add CcUnstrippedInfo provider and use it in mixed builds" 2022-10-13 21:04:40 +00:00
Colin Cross
21c71a35bd Merge "Move checking of minApiForArch for apex into cc" 2022-10-13 20:15:30 +00:00
Stephen Hines
a92c177c42 Merge "Update clang version to clang-r468909b" 2022-10-13 17:26:07 +00:00
Sasha Smundak
edd16668c6 Add CcUnstrippedInfo provider and use it in mixed builds
The build uses unstripped binary/shared library to extract function
signatures, so for each each target of this kind Bazel should return
its unstripped version, too.

Fixes: 220164721
Test: treehugger

Change-Id: Id5f6143340519bf2ae98791a9e981d1306bb08d1
2022-10-12 17:36:47 -07:00
Pirama Arumuga Nainar
f9cf38ca6b Merge "[coverage] On coverage+hwasan build, disable hwasan global instrumentation" 2022-10-12 21:36:20 +00:00
Pirama Arumuga Nainar
2bcdf5edd7 [coverage] On coverage+hwasan build, disable hwasan global instrumentation
Bug: http://b/248022906
Bug: http://b/247941801

HWAsan global instrumentation on __llvm_profile_filename causes
duplicate symbol errors when linked together with libraries where hwasan
is disabled.  Disable hwasan global instrumentation since those type of
errors are rare.

In the future, we may fix this in llvm to skip hwasan global
instrumentation on symbols added for coverage.

Test: m CLANG_COVERAGE=true NATIVE_COVERAGE_PATHS=* \
          SANITIZE_TARGET=hwaddress
Test: Add `hwaddress: true` to libc_defaults; m CLANG_COVERAGE=true

Change-Id: I8506cfd567d212262a2a54b9881a8f64cdbf7a76
2022-10-12 19:32:48 +00:00
Florian Mayer
029b0fce7c Merge "Revert "Disable HWASan if UBSan is enabled"" 2022-10-12 19:18:07 +00:00
Florian Mayer
cc9b675f4d Revert "Disable HWASan if UBSan is enabled"
This reverts commit bb158a34c3.

Reason for revert: b/253035046

Change-Id: Id0fc9251283a7fba2eee5e18aecb16ddf80c6253
2022-10-12 19:09:02 +00:00
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux
d5384e8393 Merge "Support mixed building for cc_prebuilt_binary" 2022-10-12 13:55:02 +00:00
Colin Cross
58fecb427f Merge "Disable stripping for riscv64" 2022-10-11 20:51:18 +00:00
Colin Cross
1deeade634 Disable stripping for riscv64
create_minidebuginfo doesn't support riscv64 yet, disable stripping
for riscv64 until it does.

Test: m ALLOW_MISSING_DEPENDENCIES=true LLVM_PREBUILTS_VERSION=clang-r468909b LLVM_RELEASE_VERSION=15.0.3 libc -k
Change-Id: Iaad7ec0e4befe1652b413e20a7095cdde56d57bc
2022-10-11 11:50:55 -07:00
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux
256e3b4597 Support mixed building for cc_prebuilt_binary
Enable cc_prebuilt_binary to also take part in mixed builds.

Bug: 241415823
Test: TestPrebuiltBinaryWithBazel
Test: mixed_droid yields stats-log-api-gen under bazel-out/
Change-Id: I18b2906c91ea90370ab851a1287c2890546d633f
2022-10-11 18:13:54 +00:00
Florian Mayer
bb158a34c3 Disable HWASan if UBSan is enabled
Test: `atest inputflinger_tests libinput_tests` does not crash
Bug: 251249010
Change-Id: Ic6bab1d2361ecfbad038acf9f124d4b9d4cee6d1
2022-10-10 17:11:30 -07:00
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux
49b59385da Merge "Support cc_prebuilt_binary building with Bazel" 2022-10-10 21:37:35 +00:00
Spandan Das
40fb2e202a Merge "Converters for contributions to systemapi and vendorapi" 2022-10-10 21:33:21 +00:00
Elliott Hughes
8cddc00b02 Add riscv64.
Otherwise we hit an unknown --arch error in ndkstubgen as soon as we try
to build an NDK library (such as libc/libdl/libm, which are the very
first libraries we need to build).

Test: treehugger
Change-Id: Id633248d1fa80eeddfd234301355931bb1309dc3
2022-10-10 15:33:50 +00:00
Spandan Das
4238c65a17 Converters for contributions to systemapi and vendorapi
The module types in scope of this conversion are
1. cc_library and cc_library_shared (non-null llndk or stubs prop)
2. cc_library_headers (all)

For (2), we need some postprocessing on the results of the parser
bp2BuildParseBaseProps. This is necessary because arch and os specific
API exports need to be flattened and added to the generateed API headers
target along NoConfigAxis
e.g.
```
The api equivalent of
cc_library_headers (
  name = "lifoo",
  deps = select({
  	"//build/bazel/platforms/arch:arm": ["arm_deps"],
  	"//build/bazel/platforms/arch:arm64": ["arm64_deps"],
	}),
)
should be
cc_api_library_headers (
  name = "lifoo",
  deps = ["arm_deps", "arm64_deps"],
)
```

For (1), we also need to generate 1:many header api targets so that
arch-specific deps can propagate arch metadata to the top-level
api_domain rule

Test: go test ./bp2build
Test: go test ./cc

Change-Id: Ie40cba1ac8e89f290b3d926c190d5e93abd52859
2022-10-07 23:48:00 +00:00
Colin Cross
8ca61c1820 Move checking of minApiForArch for apex into cc
I49220cbec628f1508709741dc56b62aaac7786d9 attempted to allow
apexes to depend on native code whose min_sdk_version had been
increased to meet the minimum supported API level for a new
architecture.  It wasn't quite right, as it assumed that the
primary architecture of the apex would be the newest, and
it applied to all dependencies, not just ones that were
specfiic to the new architecture.  Move the checking into
cc.ShouldSupportSdkVersion, where it can be specific to an
individual architecture variant.

Bug: 250918230
Test: TestApexMinSdkVersion_MinApiForArch
Change-Id: I303cf485ba54b4c6bf63a9f9b49286ff9b2c9c83
2022-10-07 16:04:50 -07:00
Trevor Radcliffe
4e503ec09d Merge "Split ldflags in bp2build" 2022-10-07 17:31:29 +00:00
Stephen Hines
6186318b72 Update clang version to clang-r468909b
Bug: http://b/241011085
Bug: http://b/235405318
Test: Builds
Change-Id: Ib415277284fc69f5a6b59b6998f6cdbcaefdd13e
2022-10-07 00:33:59 -07:00
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux
b12ff59f0b Support cc_prebuilt_binary building with Bazel
Bp2build-enable cc_prebuilt_binary -> cc_prebuilt_binary

Bug: 241415823
Test: cc_prebuilt_binary_conversion_test.go
Change-Id: I007deef8d44f68993012f2114314d1cb52cfbb0e
2022-10-06 19:39:09 +00:00
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux
a44a4e079f Merge "Add Soong tests for cc_prebuilt_binary for bad srcs" 2022-10-06 17:48:15 +00:00
Treehugger Robot
e81503e161 Merge "Fix Errorf format string for error" 2022-10-06 17:43:07 +00:00
Chih-hung Hsieh
55d3e2ba14 Merge "Add TIDY_EXTERNAL_VENDOR" 2022-10-06 17:12:05 +00:00
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux
7a11dc8689 Fix Errorf format string for error
Also go ahead and mark `checkOverrides` as a `t.Helper()`

Test: go test
Change-Id: I368aabf4d032c02773416f27affa12eb40e77b40
2022-10-06 15:24:11 +00:00
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux
b1bd77048d Add Soong tests for cc_prebuilt_binary for bad srcs
Test: TestPrebuiltBinary{NoSrcsNoError,MultipleSrcs}
Change-Id: I1c803e38bae68e452cebf6208412cefed900c7f6
2022-10-06 14:10:49 +00:00
Inseob Kim
a12594a4b6 Merge "Add overrides support for snapshots" 2022-10-05 23:43:00 +00:00
Chih-Hung Hsieh
140c40a217 Add TIDY_EXTERNAL_VENDOR
Allow external/vendor owners and toolchain developers
to run clang-tidy with external/vendor files,
by setting TIDY_EXTERNAL_VENDOR=1 or true
instead of touching .bp or .go files.

Bug: 244631413
Test: TIDY_EXTERNAL_VENDOR=1 make tidy-soong_subset
Change-Id: I0c903f32eb0e5daa0f8dfa2f6dc892b8f8c4ebcc
2022-10-05 16:10:40 -07:00
Colin Cross
ec731a83e3 Merge "Use MinApiForArch to set minSdkVersion for apexes" 2022-10-05 22:03:22 +00:00
Colin Cross
a497606f1d Merge changes I154a6f3a,I79f0c20a,I605ae9af,I647c7305,I95e96e3e, ...
* changes:
  Move fuzzer's CollectAllSharedDependencies into GenerateAndroidBuildActions
  Support AllowMissingDependencies in prebuilt_apex modules
  Support AllowMissingDependencies for apex dependencies
  Add AllowMissingDependencies support for prebuilt_etc module with no src property
  Make OutputFileForModule work for AllowMissingDependencies
  Fix panics when target arch is riscv64
2022-10-05 21:25:17 +00:00
Spandan Das
e191ae76b6 Merge "Move API providing modules from bp2build to api_bp2build workspace" 2022-10-05 19:40:01 +00:00
Chih-hung Hsieh
1832b5ccf1 Merge "Remove flags rejected by RBE input processor" 2022-10-05 18:19:37 +00:00
Jihoon Kang
0b5f7f153f Merge "Specify jnilib partition in Android-<target>.mk" 2022-10-05 16:19:51 +00:00
Colin Cross
56534df14f Use MinApiForArch to set minSdkVersion for apexes
Apexes for new architectures have to increase their minSdkVersion
to the minimum supported version for the architecture.

Bug: 250918230
Test: lunch aosp_riscv64-userdebug && m ALLOW_MISSING_DEPENDENCIES=true nothing
Change-Id: I49220cbec628f1508709741dc56b62aaac7786d9
2022-10-04 19:15:45 -07:00
Colin Cross
31d89b4e0c Move fuzzer's CollectAllSharedDependencies into GenerateAndroidBuildActions
Make rust and cc fuzzers collect their shared libraries once in
GenerateAndroidBuildActions and store it for later use by the
packaging singleton.  Also use android.OutputFileForModule to get
the paths.  Together this will fix fuzzers that depend on architecture
specific prebuilt shared libraries that are missing a prebuilt for an
architecture when building with AllowMissingDependencies.

Bug: 250918230
Test: lunch aosp_riscv64-userdebug && m ALLOW_MISSING_DEPENDENCIES=true nothing
Change-Id: I154a6f3a767c883e9fe7067003615db73ee78e2d
2022-10-04 19:15:45 -07:00
Jiyong Park
aa27c082dc Mandate #apex or #systemapi tag for the Mainline APIs
Currently, tagging a symbol with #apex is not required when the symbol
is in a non-NDK library. However, this is considered dangerous because
such a symbol will automatically be promoted to NDK APIs when the
library is promoted to an NDK library. When that happens, the native API
council won't be able to notice the promotion because promoting a
non-NDK library into an NDK library doesn't require an update of the
map.txt file, but Android.bp only.

To prevent that, we should mandate #apex (or #systemapi if the api is
provided by the system, not apex) tag for Mainline APIs regardless of
whether the library the API belongs to is an NDK library or not.

Bug: 184712170
Test: m
Change-Id: Iad589b606bc6ed06ef1237f4c9f0c22518b0db75
2022-10-05 09:07:27 +09:00
Jiyong Park
4ecbdb6dfd Add --no-ndk to ndkstubgen
By default, ndkstubgen does not omit NDK symbols as long as they
satisfy the API version and the CPU architecture requirements. This
change adds a new flag --no-ndk to ndkstubgen which is used to
override the default behavior. If the flag is set, NDK symbols are
omitted leaving only the annotated symbols (e.g. #apex, #systemapi,
etc.).

This will be used for stub libraries that are not part of NDK. So far,
symbols in such libraries haven't needed to be annotated as #apex, and
that has caused a confusion that those symbols belong to NDK. The
follow-up change will ensure that those symbols are always annoated as
either #apex or #systemapi so that their roles are clearly visible.

Bug: 184712170
Test: atest test_ndkstubgen
Test: atest test_symbolfile
Change-Id: Ic8d2c7d0b32bdef79f7563621035e60f406e4131
2022-10-05 09:06:49 +09:00
Chih-Hung Hsieh
a4724a0c4e Remove flags rejected by RBE input processor
* This is a temporary work around until the RBE input processor
  can handle those flags.
* It's okay to remove some cflags in clang-tidy command
  if they do not affect tidy check results.

Bug: 248371171
Test: enable RBE; RBE_CLANG_TIDY_EXEC_STRATEGY=remote; make tidy-soong_subset
Change-Id: If499bd7e1f0f89ccc3b7f7df7d67cfc64dc67028
2022-10-04 16:52:36 -07:00