Commit graph

8676 commits

Author SHA1 Message Date
Yi Kong
949157d582 Merge "Remove ThinLTO workaround for VNDK" into main 2024-03-25 07:14:29 +00:00
Treehugger Robot
e58af3da5a Merge "Add required, host_required, and target_required as dependencies" into main 2024-03-25 04:10:50 +00:00
Treehugger Robot
bfa7f261d1 Merge "Revert "Enable full LTO optimization by default"" into main 2024-03-22 09:01:23 +00:00
Yi Kong
55019c43f4 Revert "Enable full LTO optimization by default"
Revert submission 2988057-default-full-lto

Reason for revert: broken test

Reverted changes: /q/submissionid:2988057-default-full-lto
Bug: 330811070

Change-Id: I46487ad92d25741347c7f30e944a5794941d5d69
2024-03-22 05:51:09 +00:00
Yi Kong
2703b42ccb Merge "Enable full LTO optimization by default" into main 2024-03-22 02:15:46 +00:00
Yi Kong
e022cf58dd Remove ThinLTO workaround for VNDK
VNDK is deprecated. The build is passing without the workaround.

Test: presubmit
Bug: 169217596
Change-Id: I7cf2c33984c50d06f3e69ebc916ce6a89468204a
2024-03-21 16:34:56 +00:00
Pirama Arumuga Nainar
950e8c97fe [cc:riscv64] Do not pass -mno-strict-align while linking
Bug: http://b/327307773

Newer clang rejects this flag as unsupported.  It is not necessary while linking because the flag is passed as an IR feature.

Change-Id: I781afd913be7c07612196e736c3ae58773791071
2024-03-20 17:25:20 +00:00
Elliott Hughes
bc7c97b15b Merge "Defer to clang for --hash-style." into main 2024-03-20 16:47:40 +00:00
Elliott Hughes
b48fb83936 Defer to clang for --hash-style.
We fixed the clang driver to "do the right thing" based on target api level years ago, but these manual workarounds predate that (or were copy & pasted from places that predated that). We don't need them any more.

See https://github.com/android/ndk/issues/2005 for more detail.

Change-Id: I995741b8606e389e8de8272f1cc532624516245a
2024-03-20 14:50:26 +00:00
Jiyong Park
8bcf3c64f1 Add required, host_required, and target_required as dependencies
So far, the installation of required modules were handled by Make. This
prevents us from implementing the module installation and packaging
entirely in Soong.

This CL is the first step towards that goal. Soong now correctly tracks
the dependencies and they are correctly returned by
TransitivePackagingSpecs(), which is used by packaging modules like
android_system_image.

Bug: 321626681
Test: build
Change-Id: I9192b5333ceaa0b7d1c5c4abeec2af62febcd976
2024-03-20 17:05:17 +09:00
Treehugger Robot
1f4ffda2ed Merge "Support multilib property for cc_genrule" into main 2024-03-20 02:38:30 +00:00
kellyhung
750334a0c0 Support multilib property for cc_genrule
Change genrule Out to `android:"arch_variant"` for supporting
multilib variants.

Bug: 323295272
Test: go test -run TestMultilibGenruleOut

Change-Id: I102d64b45a5a2a5193f813001fc32da0d1fe9d36
2024-03-20 09:25:41 +08:00
Pirama Arumuga Nainar
0593537f58 [cc:riscv64] change -munaligned-access to -mno-strict-align
Bug: http://b/327307773

cd071253c7 removed -munaligned-access

Change-Id: I7a102fa1cdc49564cb0b724e6f177d33b3636f55
Test: presubmit
2024-03-19 16:28:31 +00:00
Elliott Hughes
c2600464c7 Fully document all the riscv64 flags.
In particular, make it clearer when/how we can remove each of them.

Change-Id: Ic3156e53ea56479324781fea737390588bc086b5
2024-03-18 19:37:13 +00:00
Yu Liu
f509eba41d Merge "Validate aconfig libs are built with the correct modes." into main 2024-03-14 18:39:12 +00:00
Jooyung Han
ed9005b556 Merge "Clean up LLNDK stubs" into main 2024-03-14 03:58:14 +00:00
Jooyung Han
2b8b2b2064 Merge "ndkstubgen: use llndk=<version> for new llndk stub" into main 2024-03-14 01:48:36 +00:00
Jooyung Han
33eb615eb0 ndkstubgen: use llndk=<version> for new llndk stub
We want LLNDK symbols to be explicitly marked with llndk tag to
handle LLNDK freezing which happens before SDK freezing. If symbols
need to be frozen as LLNDK, those symbols must be marked explicitly with
correct vFRC version.

In the following example,

LIBFOO { # introduced=35
  foo;
  bar;
  bar; # llndk=202404
  baz; # llndk=202404
  qux; # llndk=202505
};

NDK libfoo will have foo and bar while LLNDK libfoo stub will have bar
and baz for 202404.

Bug: 329012338
Test: test_ndkstubgen test_symbolfile
Change-Id: I384f589b240fa047e8871964bf9550f426024dfc
2024-03-14 06:06:26 +09:00
Kalesh Singh
9f38694fc3 Merge "soong: ldflags: Add separate-loadable-segments" into main 2024-03-13 18:41:14 +00:00
Kalesh Singh
fa1ebf5943 soong: ldflags: Add separate-loadable-segments
To suport >4KB page sizes, the loader may extend LOAD segment mappings
to be contiguous in the virtual address space. This is done in order to
reduce the use of unreclaimable kernel slab memory for the otherwise
necessary gap VMAs (when the runtime-page-size < ELF-segment-p_align).

Such mappings may beyond the end of the backing file when extended;
which breaks the common userspace assumption that file memory maps are
entirely backed by the underlying file.

Existing apps (not yet updated for larger page size support) may
encounter breakages if they parse /proc/self/[s]maps and use the
[start, end] addresses to operate on system libraries that have
crt_pad_segment optimization (VMA extension) [1].

In order to avoid breaking exisiting apps, update the build system to
ensure the platform ELFs' segments are entirely backed by the file
even when the VMA is extended to be contiguous with the subsequent
segment's. This is achieved using the linker flag
-z separate-loadable-segments, which inserts enough padding (zeros)
to also align each segment's offset on file by it's p_align
(max-page-size).

Although laying out the ELF segments on disk to respect the p_align
causes an increase in the file's apparent size (i_size), on Android the
actual disk usage increase is not significant due to most of the padding
being zero blocks which don't get alloacted in the read-only partitions.

The following results were obtained on an ARM64 device on a recent
git_main build:

 No Separate     Separate     Delta         Delta %   Partition
   Loadable      Loadable
   Segments      Segments

   4208.90MB    4214.6MB       5.70MB       0.14%     All RO Partitions

Note: The overhead of -z separate-loadable-segments is minimized by the
fact that ARM64 android already builds with -z separate-code. [2]

[1] https://cs.android.com/android/platform/superproject/main/+/main:bionic/libc/arch-common/bionic/crt_pad_segment.S
[2] 733198152d:build/soong/cc/config/arm64_device.go;l=53

Bug: 328797737
Test: Manually test previously crashing application
Change-Id: Icb14ad10b5c9282855d54c7945b065b7b4184163
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
2024-03-12 17:04:50 -07:00
Jooyung Han
5e8994e5ed Clean up LLNDK stubs
So far we created {"", "current"} stubs for LLNDK modules. But we don't
need "current" because "" itself is a stub.

This change only removes unused LLNDK stub modules with "current"
version, which aren't used at all.

Bug: 329183083
Test: m blueprint_tests
Change-Id: Ib8e880b6d88952b489657ea1ac557a48afe562a4
2024-03-12 16:26:18 +09:00
Hsin-Yi Chen
f1f276c904 Let header ABI checker load core variants' version scripts
Header ABI checker dumps the ABI from core variants and filters it by
version scripts. Ideally it should load different version scripts for
LLNDK, NDK, APEX, etc, but the build rules have not been completed. The
current solution is to load core variants' version scripts. It works
for every existing library because a library's variants share one
version script.

Test: make
Bug: 329078703
Change-Id: I4e26275e24daf93c7d3bb7e70b542a1197ae2129
2024-03-12 04:40:59 +00:00
Yu Liu
67a28425a7 Validate aconfig libs are built with the correct modes.
Bug: 323071835
Test: Unit tests and manual tests.
Change-Id: I32de90826c7c8bb4d8495608e959d554820ab9a2
2024-03-07 18:51:16 +00:00
Yi Kong
ce23b9ba16 Enable full LTO optimization by default
We set the default optimization mode to --lto-O0 for LTO enabled
projects, in order to save build time. This is missing some performance
optimizations, esp. related to vectorization. Now that we suggest eng
build for developers, we can enable full optimization by default.

When we introduced --lto-O0, we achieved a 4.2% saving in
system-processes-memory-direct. Enabling full LTO optimization will
trade some of the memory / binary size savings for better code
performance. For system-processes-memory-direct, it is 2.0% increase
compared to --lto-O0, or a net 2.2% saving compared to baseline.

Test: presubmit
Bug: 328163089
Change-Id: Ia4d0f74e668ed057d6d9d6fc6c60196c2e355fb9
2024-03-07 07:02:45 +00:00
Spandan Das
972917d794 Support partial module variants with apex_contributions
Some libraries like `libnativehelper_compat_libc++` only exist as shared
library in module sdk. When prebuilt of this library is selected using
apex_contritbutions, only shared linkages should be redirected to the
prebuilt version. The static linkage should come from source.

Test: Added a unit test
Bug: 322175508

Change-Id: Ic65d376b2354b4a42c7b9ea3ed1cd80c37e2840f
2024-03-04 08:39:20 +00:00
Spandan Das
f2c1057586 Fix non-determinism in prebuilt selection
This relands aosp/2978137 with acknowledgement of soong namespaces.

If multiple versions of the prebuilt module sdk share the same soong
config namespace, then PrebuiltPostDepsMutator rewrites rdeps to one of
those prebuilts in a non-deterministic way.

This CL uses apex_contributions to make this deterministic. Multiple
prebuilts will not be allowed to have their prefer evaluate to true. If
this happens, one of the prebuilts must be explicitly declared in
apex_contributions.

This CL also fixes the special-casing of the top-level
java_sdk_library_import in ReplaceDirectDependencies. For
framework-foo.v2, it will use BaseModuleName framework-foo instead of
SdkLibraryName framework-foo.v2 to determine if the source module has
been selected.

Test: ran the previously failing cmd of b/327552112
Test: Added a unit test
Test: aninja -t query
    out/soong/.intermediates/packages/modules/Permission/SafetyCenter/Config/safety-center-config/android_common/javac/safety-center-config.jar
    | grep module_sdk is empty (should not cause a regression for
    323454855)
Change-Id: Id484a41192085c50b7e34ad415c6e195edb0d006
2024-03-04 07:59:34 +00:00
Ryan Prichard
45ac47edab Merge changes I34385c48,I1e48947c into main
* changes:
  disablePrebuilt: also clear sanitizer-dependent Srcs
  Define libc++ config macros to nothing
2024-02-29 20:51:48 +00:00
Spandan Das
af66212522 Revert "Fix non-determinism in prebuilt selection"
This reverts commit 2d8884a377.

Reason for revert: Build breakage https://groups.google.com/a/google.com/g/android-build-police-core/c/00mM-B9unVg/m/0FxBxpMbAwAJ. The validation does not check for namespace isolation which breaks libtonemap

Change-Id: Ieb4d3bc4f3ade856877ebb62a567620f5a1ed08c
2024-02-29 08:57:08 +00:00
Spandan Das
2d8884a377 Fix non-determinism in prebuilt selection
If multiple versions of the prebuilt module sdk share the same soong
config namespace, then PrebuiltPostDepsMutator rewrites rdeps to one of
those prebuilts in a non-deterministic way.

This CL uses apex_contributions to make this deterministic. Multiple
prebuilts will not be allowed to have their prefer evaluate to true. If
this happens, one of the prebuilts must be explicitly declared in
apex_contributions.

This CL also fixes the special-casing of the top-level
java_sdk_library_import in ReplaceDirectDependencies. For
framework-foo.v2, it will use BaseModuleName framework-foo instead of
SdkLibraryName framework-foo.v2 to determine if the source module has
been selected.

Test: Added a unit test
Test: aninja -t query
    out/soong/.intermediates/packages/modules/Permission/SafetyCenter/Config/safety-center-config/android_common/javac/safety-center-config.jar
    | grep module_sdk is empty (should not cause a regression for
    323454855)

Bug: TODO
Change-Id: I7191200c330c5bcb9d5532006d3c573a60db61cc
2024-02-29 06:34:49 +00:00
Ryan Prichard
21e2c10cd2 disablePrebuilt: also clear sanitizer-dependent Srcs
The new libc++ prebuilt has HWASan and non-HWASan variants for arm64.

Bug: 175635923
Test: checkout use-prebuilt-libcxx topic, build libc++demangle, verify
  that libc++demangle-install is not a valid build target

Change-Id: I34385c48aa7ad1401e2547d65d30a14fa342e304
2024-02-28 19:14:59 -08:00
Ryan Prichard
718cf5bf19 Define libc++ config macros to nothing
libc++[abi] always check whether one of these macros is defined, not
the value the macro is defined to. With the new libc++, there is a
Windows __config_site header that automatically defines
_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS and _LIBCPP_HAS_THREAD_API_WIN32
to nothing, so these definitions need to match to avoid a redefinition
error.

Bug: 175635923
Test: treehugger
Test: m adb
Change-Id: I1e48947c3b45e59804cdacd48776c7f3bd9a18c6
2024-02-28 19:14:24 -08:00
Aditya Kumar
592b54c443 Merge "Update unaligned-vector-mem to -munaligned-access" into main 2024-02-28 19:35:39 +00:00
Spandan Das
3faa792093 Use BaseModuleName of dep when writing to make
Since BaseModuleName of the dep becomes its LOCAL_MODULE name in the
generated mk file, we should also use BaseModuleName of dep for populating
properties such as LOCAL_SHARED_LIBS of rdeps

Test: m nothing --no-skip-soong-tests
Bug: 322175508

Change-Id: I6b47112faa63f85d19b5b71e0e102cea0ab68e3b
2024-02-28 18:03:00 +00:00
AdityaK
2c90a92d77 Update unaligned-vector-mem to -munaligned-access
Latest compiler has merged both unaligned access flags into one.

TODO:  This is needed until we change clang driver to enable -munaligned access by default.for Android b/327307773

Bug: 326790418
Change-Id: Ia8c29dc56104d2cffb8ac41aae6eeacccae68e61
2024-02-28 06:14:57 +00:00
Aditya Kumar
6edbaa369f Merge "Remove wtautological warnings added during toolchain update" into main 2024-02-21 18:43:28 +00:00
Aditya Kumar
30aec0dfb1 Merge "Error on the usage of -target flag" into main 2024-02-21 06:30:45 +00:00
Treehugger Robot
3ce80aef7f Merge "Version LLNDK ABI dumps with VendorApiLevel" into main 2024-02-17 05:58:03 +00:00
Hsin-Yi Chen
53eb289ad0 Merge "Separate LLNDK ABI diff reports from the other variants" into main 2024-02-17 02:15:39 +00:00
AdityaK
a0ad736b91 Remove wtautological warnings added during toolchain update
Bug: b/301328082

Change-Id: I0bf10e4a9456dff1b3a521ca13cb5170e738f80a
2024-02-16 19:44:26 +00:00
AdityaK
f6fbaac34c Error on the usage of -target flag
Bug: http://b/323415017
Change-Id: I31897ff0101965088280ad9adc7a23a7c190536a
2024-02-16 19:42:15 +00:00
Colin Cross
a82de712b3 Merge changes from topic "revert-2952265-revert-2925209-KVPWEBRQHT-BBCOVJBOVF" into main
* changes:
  Remove fdoProfileMutator
  Convert AFDO mutators to TransitionMutator
2024-02-12 19:31:00 +00:00
Yu Liu
b882375fe0 Merge "Only link the profile extras lib for device variant." into main 2024-02-12 18:12:14 +00:00
Pirama Arumuga Nainar
7493929ff2 Enable -Wambiguous-reversed-operator
Bug: http://b/323152930
Bug: http://b/324323434

The ambiguity in frameworks/av/media/codec2 is resolved.

Test: build partner branch, and presubmit
Change-Id: Ie1aa0b6c965b1a9076333d7d25fd9f9664467a31
2024-02-09 22:45:58 +00:00
Colin Cross
09e1e8d1fb Merge "Fix TestAfdoDeps for darwin" into main 2024-02-09 22:41:46 +00:00
Colin Cross
3513fb17cd Remove fdoProfileMutator
Add the dependency on the fdo_profile module in afdoTransitionMutator
and read the provider in GenerateAndroidBuildActions.

This relands Ied8fd7b52d5694a3691652318e87b8fe14dda126 with a fix
to use the correct LTO ldflag when an afdo variant doesn't have a
profile.

Bug: 319288033
Bug: 324141705
Test: afdo_test.go
Change-Id: I024ca316cfb565b5fb0251793f05a54ce16cc1cb
2024-02-09 13:49:02 -08:00
Colin Cross
e00614ecba Fix TestAfdoDeps for darwin
LTO does not set the -import-instr-limit flag when building for
darwin, don't test it on darwin host modules.

Test: afdo_test.go
Change-Id: I83f77006a875f8b0a6af9ae11eb3bad88b0681b1
2024-02-09 12:22:13 -08:00
Treehugger Robot
c7c666a354 Merge "Remove macros that the Linux host no longer needs." into main 2024-02-09 19:39:06 +00:00
Colin Cross
545ebf0c40 Merge changes I255fcbb8,I3ed4ce03 into main
* changes:
  Disable more of AFDO for host modules
  Add more AFDO tests
2024-02-09 19:30:29 +00:00
Elliott Hughes
49e8f25966 Remove macros that the Linux host no longer needs.
We patched our ancient glibc to match current glibc (and bionic/musl).

Test: treehugger
Change-Id: I6377b5dfb94d3a0e2209d4c2f0661ef81d362fc3
2024-02-09 16:43:34 +00:00
AdityaK
12f239fd37 Move Wno-ambiguous-reversed-operator to noOverrideGlobalCflags
Some builds were still failing when it was in noOverrideExternalGlobalCflags

Bug: b/324323434
Change-Id: Ibaaa611f085d94e7defac7f2a6aa70b9eef08552
2024-02-08 16:28:20 -08:00