Commit graph

8324 commits

Author SHA1 Message Date
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
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