Commit Graph

8973 Commits

Author SHA1 Message Date
Treehugger Robot
4e3486b0ba Merge "cc: clearer OS mismatch error." into main 2024-08-28 00:32:32 +00:00
Steven Moreland
aaae81f5fd cc: clearer OS mismatch error.
Bugs: me
Test: clear error message, for instance:

    error: frameworks/native/libs/binder/ndk/Android.bp:252:1: module "libbinder_ndk.ndk" variant "android_x86_64_silvermont_sdk_shared_29": OS mismatch between "libbinder_ndk.ndk" (android) and "libbinder_headers_platform_shared" (linux_glibc)

Change-Id: Idfa6d27daeb89056781c93a893e4080e49b3fcb0
2024-08-27 23:30:31 +00:00
Spandan Das
a6f4b6b104 Merge changes from topic "cc_prebuilt_stubs" into main
* changes:
  Skip `-Wl,--version-script` on libclang_rt.* stubs (temp hack)
  Special case the stubgen args for bionic libs
  Add stub generation support to cc_prebuilt_library
2024-08-27 19:37:08 +00:00
Spandan Das
5922333d5c Skip -Wl,--version-script on libclang_rt.* stubs (temp hack)
The checked-in libclang_rt.* prebuilts do not contain versioned symbols,
but the autogenerated map.txt file for these libraries contain versions
e.g.
LIBCLANG_RT_ASAN {
  global:
...
}
```

This causes a discrepancy between the symbols in the stubs and impl
variants of these libraries. After https://r.android.com/3236596 is
submitted and a new set of libclang_rt.* prebuilts are generated, this
discrepancy will go away.

For now, skip `-Wl,version-script` when generating the stub
variants of these libraries to prevent link errors at build time.

Test: lunch aosp_panther_hwasan-trunk_staging-userdebug && m crash_dump
Bug: 3222365
Change-Id: Ic1e06cb58ec33b761136ac325f191da7ac900151
2024-08-26 19:43:31 +00:00
Priyanka Advani (xWF)
109e77abcd Revert "Enable -Wfortify-source"
This reverts commit 608779b224.

Reason for revert: Droidmonitor created revert due to build breakages in b/362287839.

Change-Id: I6ff96539ae714698692794209d8e76e6062378b0
2024-08-26 18:22:13 +00:00
Aditya Kumar
608779b224 Enable -Wfortify-source
Bug: 315245071
Change-Id: I6a75787f5244c5e89b188113839a2c95c805450e
2024-08-23 19:02:46 +00:00
Treehugger Robot
6154ac62d6 Merge "Prevent duplicate dist rules for source and prebuilt C api cov" into main 2024-08-21 19:06:46 +00:00
Spandan Das
c27dd3393c Special case the stubgen args for bionic libs
IsNdk and NotInPlatform can return incorrect values in minimal branches
that do not contain the source bionic libraries. (e.g. in
aosp-master-art)

Bug: 275273834
Test: presbumits (which will build aosp-master-art)
Change-Id: I5e9216a40c0fd2d077bb6c53ba6628e311d99737
2024-08-21 17:59:36 +00:00
Yu Liu
fed2be9f98 Merge "Access output files thru providers in Soong tests." into main 2024-08-21 17:27:21 +00:00
Elliott Hughes
9423b3f784 Merge "Use -fno-omit-frame-pointer for host linux." into main 2024-08-21 12:25:30 +00:00
Yu Liu
51c2231eab Access output files thru providers in Soong tests.
The outputFiles field on ModuleBase will be removed next.

Bug: 358425833
Test: CI
Change-Id: I6d665ac13134d9278e5908f64c454366bc6bca5e
2024-08-21 00:03:50 +00:00
Treehugger Robot
800bde1021 Merge "Encode directly into file" into main 2024-08-20 19:36:46 +00:00
Elliott Hughes
8f977d2982 Merge "Use -fno-omit-frame-pointer for host windows." into main 2024-08-20 19:20:21 +00:00
Elliott Hughes
7ae6c16f51 Use -fno-omit-frame-pointer for host windows.
Helps with debugging/profiling.

Bug: http://b/245707217
Change-Id: I6c163c67a04ab53a0b8a00edb233e6d60404f0a4
2024-08-20 15:09:39 +00:00
Elliott Hughes
67612c37f1 Use -fno-omit-frame-pointer for host darwin.
Helps with debugging/profiling.

Bug: http://b/245707217
Change-Id: Ifbe2f6d05059d4ffee5c33ddec743188164100ef
2024-08-20 15:07:30 +00:00
Elliott Hughes
0b5dce6dae Use -fno-omit-frame-pointer for host linux.
Helps with debugging/profiling.

Bug: http://b/245707217
Change-Id: I6b2d4f73edbdbcdc36b3bf531341dd2dfb51a87c
2024-08-20 15:06:00 +00:00
Cole Faust
5b1a39a92a Merge "Make the WholeStatic/Static/Shared libs properties configurable" into main 2024-08-19 22:48:16 +00:00
Cole Faust
f0006e7137 Make the WholeStatic/Static/Shared libs properties configurable
So that you can use selects with them.

Bug: 342006386
Bug: 358377461
Test: m nothing --no-skip-soong-tests
Change-Id: I5a8350f670d51b7da411ad5c3cdbf5f2d6cdd63b
2024-08-19 14:39:19 -07:00
Yu Liu
d46e5ae670 Remove more internal fields from ModuleBase.
Bug: 358425833
Test: Manual compare the generated ninja and mk files and CI.
Change-Id: I4edd0dc646ac035594f47cd9044cc4eb5f710e64
2024-08-16 00:20:27 +00:00
Spandan Das
357ffcc146 Add stub generation support to cc_prebuilt_library
The `stubs` property in `cc_prebuilt_library` currently does not support
generating stubs from an API symbol file. Reverse dependencies are
always linked against the .so file listed in `srcs`. This CL adds
support to generate the shared library from the .map.txt symbol file of
the prebuilt library.

Implementation details:
1. Add a compiler. This will convert the .map.txt file to a stub .c file.
  The build rules for this are common to the compiler of the source cc_*
moudule types. This has been refactored into a new function named
`compileModuleLibApiStubs`
2. Update the linker to link the aforementioned stub.c file into a .so
  file. Since this happens only for stub variants, it is conditionally
called only when p.buildStubs is true.
3. Call `addStubDependencyProviders`. This will populate the impl
   variant of the library with Stub information. cc#ChooseStubOrImpl
will use this information to resolve rdeps to the stub .so file if the
dependency crosses an api domain boundary.

(2) requires some special casing for now, since the module sdk at HEAD
does not contain symbol files, so the stub.c files will be empty. Once
the symbol files are added to module sdk, the special casing will be
removed.

Test: m nothing --no-skip-soong-tests
Bug: 275273834
Change-Id: I57f5b0a97fac4dfc8c24e07b06a330015add977d
2024-08-15 22:18:48 +00:00
Spandan Das
24b3e534c3 Prevent duplicate dist rules for source and prebuilt C api cov
Adding stub generation support for C prebuilt libraries creates
duplicate dist rules for api coverage files
```
overriding commands for target `<out_dir>/../cc_apis/libc.xml', previously defined at
```

This CL hides the incorrect api coverage file using `IsModulePreferred`.

Bug: 275273834
Test: EMMA_INSTRUMENT=true EMMA_INSTRUMENT_FRAMEWORK=true CLANG_COVERAGE=true NATIVE_COVERAGE_PATHS="*" m droid dist
(no duplicate dist rules)

Change-Id: Id1caade7e80119ed1dfbbef638feb22adf116d63
2024-08-15 21:51:32 +00:00
Yu Liu
e89b6dd497 Merge "Remove installFiles from ModuleBase." into main 2024-08-15 17:23:59 +00:00
Yu Liu
ddc2833b7f Remove installFiles from ModuleBase.
This is to limit the direct accesses to the internal fields of a
module in order to better support incremental caching. To access
the install files data from singleton context or other modules'
context use providers thru the provided wrapper; to access it
from the same module inside GenerateBuildActions use ctx which is
short-lived only inside this method.

Bug: 358425833
Test: CI
Change-Id: I337b07a2ef95fb2a898ac2f9277160a3f76a603c
2024-08-14 22:56:30 +00:00
Dan Albert
61bd3d11e9 Merge "Revert^2 "Verify that ndk_headers headers are valid C."" into main 2024-08-14 22:25:10 +00:00
Treehugger Robot
67e25d144a Merge "Always generate PDB for Windows executable" into main 2024-08-14 21:26:48 +00:00
Fabien Sanglard
aa8020ac13 Always generate PDB for Windows executable
Test: NA
Bug: 350154912
Change-Id: I0a4ebfb62643eb2c8d2b20992e728bcb8b5219a9
2024-08-14 13:31:55 -07:00
Dan Albert
266f991cc5 Revert^2 "Verify that ndk_headers headers are valid C."
181934cc26

Change-Id: I7720331ee8132ead8d0b5624a0b99841884300d3
2024-08-13 22:01:23 +00:00
Yu Liu
246b43049c Merge "Merge SingletonProviderContext with OtherModuleProviderContext" into main 2024-08-13 15:56:16 +00:00
Yi Kong
c128a6808e Merge "Remove workaround for old libc++" into main 2024-08-13 02:07:31 +00:00
Treehugger Robot
aa65374cc1 Merge "Make the srcs and exclude_srcs properties configurable" into main 2024-08-13 01:20:23 +00:00
Yu Liu
663e4508dc Merge SingletonProviderContext with OtherModuleProviderContext
Bug: 358425833
Test: CI
Change-Id: I8e3f40dc3cfc5337008b419801f8e6bf2d48e8b2
2024-08-12 22:50:19 +00:00
Cole Faust
96a692bfa9 Make the srcs and exclude_srcs properties configurable
Bug: 358377461
Bug: 342006386
Test: Presubmits
Change-Id: I21c20254a3ad3e75dd401ab807eb57ddbbeac047
2024-08-12 15:27:02 -07:00
Yi Kong
703c2e3d64 Merge "Bump pessimizing-move from -Wno to -Wno-error" into main 2024-08-12 18:31:42 +00:00
Yi Kong
f4801135a6 Remove workaround for old libc++
We now have a modern libc++, and no longer needs to explicitly turn off
deprecated-dynamic-exception-spec warning for it.

Test: presubmit
Change-Id: Ie282b32ed9ac2b0246fd8245f4c5d29526cbda76
2024-08-12 23:53:30 +08:00
Yi Kong
fd50d175ad Bump pessimizing-move from -Wno to -Wno-error
This is a useful warning that can point out lower performance code.

https://r.android.com/q/hashtag:pessimizing-move-cleanup cleaned up many
cases. Let's bump this up to a non-error warning while we fix up the
remaining cases.

The warning remains off for all external code.

Test: presubmit
Bug: 154270751
Change-Id: If6b69cbaa1384e81336b6842607a587bf6c7f38b
2024-08-12 17:51:38 +08:00
Colin Cross
a66b4630f6 Add PrepareForTestWithBuildFlag
Add a helper function that creates a test fixture preparer that
sets a build flag, and use it everywhere that was setting build flags
manually.

Test: all soong tests
Flag: EXEMPT refactor
Change-Id: I68d50d68787a30d091f0827e8caa51f5c5a762ef
2024-08-09 16:47:45 -07:00
Dan Albert
fbe5780312 Disable ABI tracking for bionic.
This is being done with a path-based filter rather than as a property
of ndk_library because there would be no way to prevent people from
disabling ABI tracking without API council review if it were a
property, since there's no per-module OWNERS.

Bug: http://b/358653811
Test: m ndk
Change-Id: If6af638accc917294eee18cb08551c5df25462ad
2024-08-09 21:16:56 +00:00
Tamir Duberstein
cc5ce659fc Encode directly into file
This avoids allocating an intermediate buffer in memory *and* avoids an
unchecked error on `(*File).Write` which can mask partial writes.

Check error on `(*File).Close` while I'm here.

Change-Id: I9f7c70f1eb267155c080e44c50a99bdca62dea05
2024-08-09 08:52:26 -07:00
Yi Kong
2e2d753760 Move -Wno-error=format from external NoOverride to external flags
Test: presubmit
Bug: 315250603
Change-Id: Ib1ed2aed52818e177c1b40da17e192606308243a
2024-08-09 14:56:58 +09:00
Priyanka Advani (xWF)
d882a0c92d Merge "Revert "Verify that ndk_headers headers are valid C."" into main 2024-08-08 23:29:41 +00:00
Priyanka Advani (xWF)
181934cc26 Revert "Verify that ndk_headers headers are valid C."
Revert submission 3207854-ensure-c-ndk-headers

Reason for revert: Droidmonitor created revert due to b/358445530.

Reverted changes: /q/submissionid:3207854-ensure-c-ndk-headers

Change-Id: I649941a4d063d76a1c6a8e58fb885da2c44331c0
2024-08-08 22:49:18 +00:00
Treehugger Robot
894a93840d Merge "Verify that ndk_headers headers are valid C." into main 2024-08-08 21:37:29 +00:00
Yi Kong
9b94da79cd Re-enable -Wformat warning
Change-Id: I9af8606a1e782dfb809d7f4df7b043d53ea7ba9f
Test: presubmit
Bug: 315250603
2024-08-08 15:12:42 +09:00
Dan Albert
a866829885 Verify that ndk_headers headers are valid C.
https://github.com/android/ndk/issues/1920 recently reported a handful
of NDK headers where C-incompatible syntax had slipped in which wasn't
caught by review. This is also something that we often manually catch
in API review, but the manual inspection is, as can be seen from that
bug, error prone.

This check is pretty stupid. I've tried on other occasions to do a
more thorough check that would build each header using the same flags
as cc_library or similar would, but was never able to get that
working. This isn't as thorough, but that's maybe not such a bad
thing, since it saves on build time to only check on variant. In
practice the rudimentary approach I've taken here would have caught
every instance reported in the bug above, and probably all the other
cases that we'd previously caught in API review as well, so it's
definitely a step in the right direction if not good enough forever.

Bug: http://b/113359184
Test: m ndk
Change-Id: Id4e8cc511413acc61c4f625f25c3004d7439263c
2024-08-06 00:10:17 +00:00
Yi Kong
3d9bed9204 Do not enable AFDO for coverage builds
This works around an incompatibility between coverage and the
-fdebug-info-for-profiling flag.

also moved -fdebug-info-for-profiling flag so that it is only applied to
the libraries that enabled AFDO.

Test: gzip -cd out/verbose.log.gz | grep debug-info-for-profiling
Bug: 345593672
Change-Id: I68493511da1e61091209d0ed1b2c86c7ba0e21f4
2024-08-05 07:07:09 +00:00
Inseob Kim
af2994ccb6 Remove HWADDRESS_SANITIZER_GLOBAL_OPTIONS
It doesn't need to be a Makefile variable exported from Soong as it's
hard-coded.

Bug: 353429422
Test: boot shiba with SANITIZE_TARGET=hwaddress
Change-Id: I4a98eaaf1002aa7aba5d5131ff251bdcbdd2e0ef
2024-08-01 10:30:02 +09:00
Zijun
09fdda5b3b Turn on relaxed-template-template-args as a workaround
Update compiler to r536225 and the error: argument '-fno-relaxed-template-template-args' is deprecated arises.

Bug: b/341084395
Test: presubmit
Change-Id: If714f96e4537b5f8d695cd7c0d1cd0a8ddcbb96e
2024-07-31 05:12:41 +00:00
Yu Liu
8975548e9c Merge "Only add darwin specific rules/variables when building on mac." into main 2024-07-30 22:18:01 +00:00
Ryan Prichard
d49f0868c3 Merge "Revert "Revert "Switch NDK libc++ from prebuilts/ndk to prebuilt..."" into main 2024-07-30 21:42:23 +00:00
Yu Liu
2c0327695c Only add darwin specific rules/variables when building on mac.
To support skipping ninja file writing during incremental build, we
add all the global rules/variable/pools from static sources because
when we restore from cache we don't have the build defs available to
build the globals. This means all the global rules and variables are
added blindly, so we need to exclude these darwin specific ones since
they will fail due to they depends on the tool that only exists on MAC.

Bug: 335718784
Test: local tests and CI
Change-Id: Ife835545f0f76ffaec77e48bdd89ab7384a1b995
2024-07-30 18:22:43 +00:00