Commit graph

273 commits

Author SHA1 Message Date
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
Jingwen Chen
6ee23ad2f7 cc_test mixed builds: suffix bazel label with __tf_internal.
To support `b test //path/to:my_test` command line, the actual
executable in the cc_test macro now has the __tf_internal suffix in its
name, so that the top level test suite target can be named without any suffixes.

See other CLs in this topic for more info.

Test: presubmits
Fixes: 292159775
Change-Id: I2d0bfc4276717ae881f6f3eb6aefa88bb47f25da
2023-07-25 08:02:11 +00:00
Yi Kong
13beeedff7 Turn off Global ThinLTO for LP32 again
LP32 has many subtle issues and less test coverage.

Bug: 290859519
Bug: 169004486
Test: presubmit
Change-Id: I33fcf1a08b9e7a905ba81030250a9578532da5a0
2023-07-15 03:18:06 +09:00
Yi Kong
add6375a10 Turn on Global ThinLTO by default
Build C/C++ targets with ThinLTO with "--lto-O0" by default. This takes
advantage of better dead code elimination and CFG simplification due to
ThinLTO's global view of the program, but do not enable the costly LTO
optimizations. This also makes builds faster because we can avoid doing
codegen for the dead code.

Code size for panther-userdebug:
                   /system/bin  /system/lib  /system/lib64
Original           57648        86264        181700
Global ThinLTO     55764        84916        175728
                   -3.27%       -1.56%       -3.29%

Build time for aosp_arm64-userdebug:
                   clang time   linker time
Original           56993.87s    1712.36s
Global ThinLTO     52839.18s    3114.93s

saving 4.68% build time in total.

Bug: 169004486
Test: presubmit
Change-Id: Idb0f4675ca4750b8b12b24f4679579419d3448c8
2023-07-11 21:26:52 +09:00
Colin Cross
313d32f730 Merge "Use generics for DepSets" 2023-06-22 20:57:01 +00:00
Colin Cross
c85750bfe3 Use generics for DepSets
Use Go's generics for DepSets so they don't require a type-specific
wrapper and reflection.

Test: depsets_test.go
Change-Id: I22ba0b7d680d37d2cd05230b0f560d166c4dd20b
2023-06-22 08:18:33 -07:00
Elliott Hughes
fb294e39bf Bump the platform default up to C17.
This is already the "default default" for gcc and clang.

Bug: http://b/232413369
Test: treehugger
Change-Id: I3c0df7c63e8fca1b7692ad867d349a645559c209
2023-06-14 10:42:45 -07:00
Yu Liu
95497dc89b Allow cfi enabled modules in mixed build.
Bug: None
Test: Locally tested
Change-Id: I53c4ad8428cf05ceee3d73b4f97c2b9db2285c38
2023-06-05 17:10:14 -07:00
Vinh Tran
095819530a Sandbox inputs to aidl rule in cc
Bug: 279960133
Test: go test
Test: Remove hdrs prop from IDropBoxManagerService_aidl && run  BUILD_BROKEN_DISABLE_BAZEL=true m libservices && Expect an error from aidl
Change-Id: Ifdb260d8e2da9a5767f1e212393de4134b210616
2023-05-23 15:53:10 -04:00
Vinh Tran
e684294fb2 Pass includes attrs to cc_aidl_library
https://source.android.com/docs/core/architecture/aidl/aidl-backends#custom-parcelables

Some aidl files have custom parcelables with references to cpp headers. Hence, we need to pass the include dirs from cc libs to cc_aidl_library so that custom cpp headers are findable by the generated cpp/h files.

Test: go test
Bug: 278704136
Change-Id: I4ede1d23fbc04bdbfb69823d955c6df6b0a7b4ee
2023-05-16 16:08:15 -04:00
Vinh Tran
367d89da78 Use aidl_library in cc libraries
Introduce aidl.libs prop on cc libraries to pass in aidl_library. The goal is to eventually disallow aidl.include_dirs (a pattern for passing aidl headers dir for aidl compilation) and enforce aidl headers to be explicitly specified in Android.bp.

Bug: 278704136
Test: go test
Change-Id: Ia78bc11dfa12f47d2d1bb90dc65372ddb17f7e14
2023-05-15 17:09:22 -04:00
Spandan Das
c0f9a2178f Merge "Re-enable TestMixedBuildUsesStubs" 2023-04-27 23:11:14 +00:00
MarkDacek
f47e142ffd Refactor MixedBuildsEnabled and add --ensure-allowlist-integrity.
Currently, there is little verification around allowlisted modules
actually being mixed-built. This flag would allow us to verify
that a module allowlisted is mixed-built for at least one variant.

Bug: 278910100
Test: m nothing --bazel-mode-staging --ensure-allowlist-integrity
Test: m nothing --bazel-mode-staging --ensure-allowlist-integrity
--bazel-force-enabled-modules=com.google.android.neuralnetworks (This
fails, as expected)
Test: build/soong/test/mixed_mode_test.sh

Change-Id: Icd5976f4f44f1a8caca1e5247d986642f7995f97
2023-04-25 20:55:07 +00:00
Spandan Das
00bafc6693 Re-enable TestMixedBuildUsesStubs
This was disabled because of some non-determinism in Soong, which has
been been fixed in aosp/2559590

Bug: 275313114
Test: go test ./cc -run TestMixedBuildUsesStubs -count 1000
Change-Id: I261dc785c832e66f8e213132c19111b8b90e40e9
2023-04-25 17:50:05 +00:00
Treehugger Robot
d7b50181d9 Merge "Use copy of apex_available in AvailableToSameApexes" 2023-04-25 17:27:00 +00:00
Sam Delmerico
75dbca2eae Revert "Revert "mixed builds correctly reference stubs libs""
This reverts commit 1db4348734.

Changes from original:
  - extracted function to add the current version to stub
    versions for bp2build.
  - added libc++ to mixed builds denylist

Reason for revert: re-uploading with fix in topic

Change-Id: Ifa0ed456bf8cb4a7f861d6826263adfedb4fdd9c
2023-04-25 00:25:20 +00:00
Spandan Das
4e1bfa06e9 Use copy of apex_available in AvailableToSameApexes
Modifying the list in-place causes some non-determinism.

Test: go test ./cc -run TestStubsForLibraryInMultipleApexes -count 1000
Bug: 275313114
Change-Id: Ia2519e146d97667ad5900cf68ab9935fcbaf08a4
2023-04-24 22:45:14 +00:00
Sam Delmerico
ef69d47d03 disable mixed builds for sanitized cc modules
The Bazel rules don't currently support any sanitizers other than ubsan,
so we should disable mixed builds for modules which are sanitized.

Test: go test
Bug: 278772861
Bug: 253433725
Change-Id: Ia01fb8cb59154bdfb21a111b04af0350e1876b0b
2023-04-24 10:36:12 -04:00
Usta (Tsering) Shrestha
1db4348734 Revert "mixed builds correctly reference stubs libs"
This reverts commit ca438e6b72.

Reason for revert: ci post-submit failures in aosp-master-bazel of targets mixed-droid-clean and mixed-droid-incremental:
FAILED: ninja: 'out/target/product/generic_arm64/obj/SHARED_LIBRARIES/libc_intermediates/libc.so.toc', needed by 'out/target/product/generic_arm64/obj/EXECUTABLES/updater_intermediates/LINKED/updater', missing and no known rule to make it
12:21:27 ninja failed with: exit status 1

Change-Id: I081b499d23f2568cdf6227c4e3b0278164086b69
2023-04-19 14:02:52 +00:00
Sam Delmerico
ca438e6b72 mixed builds correctly reference stubs libs
Bug: 270408757
Test: go test
Test: m NeuralNetworksTest_shared_partial --bazel-mode-staging
  && verify that Ninja commands link libneuralnetworks via stubs
Change-Id: I19bf5a829cea7fd00c0f82511ad2bddbc40fae4f
2023-04-14 12:42:23 -04:00
Liz Kammer
a22c4b6a79 Disable flaky test temporarily
Test: go test . -run TestStubsForLibraryInMultipleApexes -count 1000
Bug: 275313114
Change-Id: Iee0ffa0c182840f036325b67c15d3731566151b2
2023-03-27 10:06:02 -04:00
Liz Kammer
48cdbeba29 Handle stubs within an apex with apex_available
Note this doesn't entirely match Soong's logic but is an improvement to
allow linking against implementation when two cc modules are
apex_available to the same module.

It is not possible to recreate the logic for "directly in" without
significant changes to bp2build as we do not add dependencies nor run
apex mutators. Rather than trying to replicate this, we would be better
off refactoring Soong to no longer support the "directly in apex" logic
and require users to correctly specify apex_available.

Bug: 272378496
Test: go test conversion tests
Change-Id: I17ac426f9b4bdad0c2ab661484e5d994f63568ce
2023-03-27 13:05:37 +00:00
Cole Faust
18994c73f1 Replace SortedStringKeys with SortedKeys
Now that we have generics.

Bug: 193460475
Test: presubmits
Change-Id: I1594fd8feb505175d5c09c03ef397e5ffd5b09cb
2023-02-28 16:51:32 -08:00
Yu Liu
e43124023c Support DCLA
Bug: 240424572
Test: Manual tests:
1. m --dev-mode-staging com.android.adbd com.android.media.swcodec.
2. verify the DCLA libs from the two apexes have the same size and
   sha1sum, and also match the libs in bazel-out.
3. empty the DCLA libs list in allowlist.go and repeat step 1
4. repeat step 2 and verify the opposite result
5. build git_master: mainline_modules_bundles-userdebug in ABTD
   with the cl, then follow go/build-sideload-dcla-locally to
   download the adbd and swcodec aab files, run the DCLA trimming
   workflow locally, and verify the symlinks in the two trimmed
   apexes are identical and also match the lib path in the DCLA
   apex that was created by the workflow.

Change-Id: Ib2f8a29126a54829c0e10eba17b256a79930fd70
2023-02-21 10:12:47 -08:00
Sam Delmerico
5fb794ae37 clean up CL for androidmk variables
Change-Id: If14d1925bea78f467740f8395f1d529db00b618c
2023-01-27 16:01:37 -05:00
Sam Delmerico
4e115cc90d add androidmk cc-related variables to androidmk
The adbd_test androidmk definition is missing some cc-related variables
for cc_test in mixed builds. These variables should be populated from
information from Bazel.

Bug: 265758350
Change-Id: I59d017e2eb2f139188ba3383c457cc0055372b61
2023-01-25 15:14:03 -05:00
zijunzhao
933e38093d Add noOverride64GlobalCflags support to Soong
Bug: b/261642850
Test: Build and check warnings. Add two xfail tests in bionic and see the
results locally.

Change-Id: I68fca0084787c329b6c49ce4dff6fd132f820735
2023-01-25 04:02:29 +00:00
Liz Kammer
7c5d1591bc Make more cc tests parallel
Test: go test soong cc tests
Change-Id: I5ade33b1579ae46571728e051471147e627a7d38
2022-12-05 13:43:29 -05:00
Liz Kammer
83cf81b54a Add tests verifying link actions for cc libraries
Test: run go tests
Change-Id: I3aada847df8f7c2523f31d8e7f293e502eb166ee
2022-09-30 12:57:00 -04:00
Alix Espino
ef47e54bec Revert^2 "deletion of clang_cflags & clang_asflags from Soong"
e9a6865bc7

Change-Id: I20be0561628ee9da5c1431975f364459b6184330
2022-09-14 19:10:51 +00:00
Alix Espino
e9a6865bc7 Revert "deletion of clang_cflags & clang_asflags from Soong"
Revert submission 2154033-delete clang_cflags clang_asflags

Reason for revert: Broke build on git_tm-dev-plus-aosp and downstream branches

Reverted Changes:
I5c499a37e:Default BuildBrokenClangCFlags &  BuildBrokenClang...
Ic1d90b72d:deletion of clang_cflags & clang_asflags from Soon...

Change-Id: Ic55dd85a824cf1a543249e0b00072b8c08a475b8
2022-09-12 18:51:23 +00:00
Alix
1879c68261 deletion of clang_cflags & clang_asflags from Soong
Clang_cflags and clang_asflags are depecrated.
Set up BUILD_BROKEN flags so partners can bypass errors
from using them

Bug: 226636335
Test: m nothing & treehugger
Change-Id: Ic1d90b72decc4c6c1f7e6dda95a2c56ab2c26d86
2022-09-09 21:03:34 +00:00
Trevor Radcliffe
ad7b2220be Merge "Write Soong tests to confirm Sysprop directories" 2022-08-31 15:13:31 +00:00
Trevor Radcliffe
3092a8e573 Write Soong tests to confirm Sysprop directories
These tests will break if the sysprop output files and directory
paths are changed. At the very least, this is a good warning to
let us know to change other places accordingly, like the Bazel
rule.

Bug: 235131252
Test: tests
Change-Id: I80f037a6e8fe68cdd2042c64175e0d3bd3fefde3
2022-08-29 18:46:50 +00:00
Alix
b5f6d9ea51 Deprecating clang Property
Clang has defaulted to true since 2018. Clang property is deprecated.
Set up a BUILD_BROKEN_CLANG_PROPERTY flag so partners can bypass \
errors from using clang.

Bug: 208980553
Test: m nothing & treehugger
Change-Id: I8fd7d3e6bdbb963279248d3482e8a590238727e3
2022-08-26 20:05:07 +00:00
Dan Albert
6bfb6bbde4 Drop support for KitKat.
The NDK is dropping support for this.

Bug: https://github.com/android/ndk/issues/1751
Test: treehugger
Change-Id: I6c03dfc364e7612ce4f45fb58746726983cf5b74
2022-08-19 20:56:28 +00:00
Cory Barker
9cfcf6d4e9 Revert^2 "Update the way we build AFL++ fuzz binaries"
Test: Built AFL fuzzers individually and built all using haiku command
and built libfuzzers individually and also by using haiku command. Ran
selected fuzzers manually to ensure fuzzing still worked.

Description: Previously we needed to add cc_afl_fuzz to build an afl fuzz binary,
however, to turn current libFuzzers into AFL fuzzers this would required
an update to each Android.bp file which is a lot of work, and would also
require an approval from each Android.bp file owner, which is even more
work.

To get around this (and also to match how AFL fuzzers are built in G3)
we will build AFL++ fuzz binaries by command line option FUZZ_FRAMEWORK.
When FUZZ_FRAMEWORK=AFL is set, all cc_fuzz modules will be built
for AFL rather than libFuzzer. Devs can also specify if a cc_fuzz module
is only for libFuzzer or AFL by using fuzzing_frameworks. If
fuzzing_frameworks is left blank then it will be assumed that the
cc_fuzz module can be built for all available fuzzing frameworks.

Change-Id: If57d3038f05e52775177eaeb26f8ed2bdc73443a
2022-08-08 20:26:09 +00:00
Cory Barker
74aea6c5ee Revert "Updated the way we build AFL++ fuzz binaries"
Revert submission 2164482-Build AFL from Command line option

Reason for revert: Unit test fails on MAC builds
Reverted Changes:
Ia7a822462:Updated the way we build AFL++ fuzz binaries
I994bde63b:Updated the way we build AFL++ fuzz binaries
Ie863853b4:Updated the way we build AFL++ fuzz binaries
I577d6ae7b:Updated the way we build AFL++ fuzz binaries
Ic4fd34f8d:Updated the way we build AFL++ fuzz binaries

Change-Id: Ic2cda7733d206d7ed178f1db5e38268bc915e57b
2022-08-08 15:55:12 +00:00
Cory Barker
cecb7546db Updated the way we build AFL++ fuzz binaries
Test: Built AFL fuzzers individually and built all using haiku command
and built libfuzzers individually and also by using haiku command. Ran
selected fuzzers manually to ensure fuzzing still worked.

Description: Previously we needed to add cc_afl_fuzz to build an afl fuzz binary,
however, to turn current libFuzzers into AFL fuzzers this would required
an update to each Android.bp file which is a lot of work, and would also
require an approval from each Android.bp file owner, which is even more
work.

To get around this (and also to match how AFL fuzzers are built in G3)
we will build AFL++ fuzz binaries by command line option FUZZ_FRAMEWORK.
When FUZZ_FRAMEWORK=AFL is set, all cc_fuzz modules will be built
for AFL rather than libFuzzer. Devs can also specify if a cc_fuzz module
is only for libFuzzer or AFL by using fuzzing_frameworks. If
fuzzing_frameworks is left blank then it will be assumed that the
cc_fuzz module can be built for all available fuzzing frameworks.

Change-Id: Ia7a8224627f2de61606b410d1d1a56d7bdc0955f
2022-08-05 21:46:26 +00:00
Cory Barker
a1da26fa9b Adding support for building AFLpp
Test: Build AFL fuzzers locally and ran them

Change-Id: Ie4fbd258c87663cf81d7d64d575b3da1d5febc17
2022-07-12 21:31:47 +00:00
Vinh Tran
dd3ea92609 Merge "Replace API level codename with number" 2022-06-28 13:39:37 +00:00
Vinh Tran
f192474a60 Replace API level codename with number
This CL fixes a bug when Soong pass `-target` with a non-digit suffix in Clang. As mentioned in b/236753843, Clang's version parsing expects to see an integer in the target string so it ignores the
S suffix.

Test: m gwp_asan_crash_handler && make sure -target is aarch64-linux-androidS instead of aarch64-linux-android31
Test: go test -run ^TestNonDigitMinSdkVersionInClangTriple$ android/soong/cc
Bug: 236753843
Change-Id: I258ecc52083dbf3471d23cf310e0ad54440f1908
2022-06-28 01:33:18 +00:00
Liz Kammer
e4d1bdaa57 Move global asflags to config to share with Bazel
Test: CI
Change-Id: Ib76bd63f9d021f581b232522d1206d968d7b1599
2022-06-22 21:02:08 +00:00
Colin Cross
cdcb680dbd Use -fdebug-default-version=4 for assembly files
-fdebug-default-version=5 is causing $TMPDIR to end up in the dwarf
debug data, which causes the buildbot results to be nondeterministic.
Pass -fdebug-default-version=4 for assembly files as a workaround.

Bug: 235105792
Test: lunch aosp_arm-userdebug && m libbase && llvm-dwarfdump --debug-line out/target/product/generic/symbols/system/lib/libbase.so
Change-Id: Ife04e3c898bbb1291f71b8365fbca854cd2d2b66
2022-06-09 11:08:50 -07:00
Elliott Hughes
ed4a27b2e1 Only set -Wall once.
We set -Wall in the global cflags, and then again at the point where we
decide whether or not to add -Werror. The trouble with this is that it
undoes the effect of any attempt to disable a warning implied by -Wall.

Discovered while trying to enable -Wmisleading-indentation (which is
part of -Wall) in a way that doesn't apply to external/ or vendor/.

Test: treehugger
Change-Id: I68d74fb05922dd9f6bd4c8423ca69b485c15e3d2
2022-05-18 13:15:00 -07:00
Elliott Hughes
94361dc903 Merge "Try to bump the C default to C11." 2022-05-12 16:23:47 +00:00
Trevor Radcliffe
f389cb4e35 Add support for test_suites to cc_test_library
Some cc_test_library modules will need to be installed for
compatibility test. This CL adds the capacity to use the
test_suites property to enable this behavior.

Fixes: 226402757
Test: Wrote unit tests, confirmed installation to proper dirs,
      and verified conversion that necessitated this change
Change-Id: I7313d4927d28aacad9e444962fd2a7efc6c3bc1f
2022-04-04 19:10:13 +00:00
Elliott Hughes
ab5e4c63e8 Try to bump the C default to C11.
Even the Linux kernel's moved, so let's see if we can too...

Test: treehugger
Change-Id: Ic8ceb3b6e7a83acc5defee46618a9345a366d87d
2022-03-28 16:58:22 -07:00
Colin Cross
4c4c1be915 Use single module for clang runtime libraries
The clang prebuilts now provide a single module with per-architecture
variants instead of a module per architecture.

Bug: 220019988
Test: m checkbuild
Change-Id: I39e2cf8ae14edf8510276dab38011afaef85822c
Merged-In: I39e2cf8ae14edf8510276dab38011afaef85822c
2022-03-07 14:56:32 -08:00
Chih-Hung Hsieh
57da82697a Do not add non-existing -Bprebuilts/gcc/.../bin
* Only prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/x86_64-w64-mingw32/bin
  exists for x86_windows_host.
* Remove config.ToolPath;
  add required -B flags into ToolchainCflags and ToolchainLdflags.

Bug: 218883919
Test: make droid tidy-soong_subset
Change-Id: I9a18bf8cc0cf84e091c7463b3bda316eaab53aa3
2022-02-16 15:49:39 -08:00