Commit graph

224 commits

Author SHA1 Message Date
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
Liz Kammer
9dc6577d55 Add -std user flags to cc test to ensure order
Test: go test soong tests
Change-Id: Iff2b82f59e138089d1c1726d9b51e040b00340ba
2021-12-16 11:38:50 -05:00
Stephen Hines
e24303f71a Add noOverrideExternalGlobalCflags support to Soong
noOverrideExternalGlobalCflags is a new set of flags intended to be
added at the end of the command line for 3rd party projects like
external/, hardware/, vendor/, and more. Our previous flags for external
projects occur way too early on the command line, leading to issues with
use for suppressing diagnostics. Note that support for this variable in
build/make is currently unimplemented, as there are no projects that
would depend on it. It could be added in the future, if it turns out to
be useful.

This change initially applies `-Wno-unused-but-set-variable` and
`-Wno-unused-but-set-parameter` to external projects because these
upstream projects aren't easily fixed, and the risk of actual bugs is
low.

Bug: http://b/197240255
Test: Build and check warnings
Change-Id: I26f56c5c52725dddb70dd8130ad61270eac7a9aa
2021-12-15 03:14:26 -08:00
Ivan Lozano
b993a835c3 Merge "rust: Add data_libs and data_bins to rust_test" 2021-11-16 13:46:49 +00:00
Ivan Lozano
4e5f07d27b rust: Add data_libs and data_bins to rust_test
Allows defining data binaries and libraries that should be installed
alongside a rust_test module, similar to cc_test.

This refactors cc_test as well so it can define rust_ffi_shared and
rust_binary modules as data.

Bug: 171710847
Test: New Soong tests pass.
Test: Example module installs data appropriately.
Change-Id: I0b56098fb475ec54f9b7a761220d260fe68cbee1
2021-11-15 17:18:42 -05:00
Colin Cross
45bce85fc9 Mark vndkLibrariesTxt modules as device modules
vndkcorevariant.libraries.txt needs to be installed onto the device,
mark the vndkLibrariesTxt module type as a device module so that
PathForModuleInstall returns a path in the system partition.

Bug: 204136549
Test: m checkbuild
Change-Id: Ic2aadff27cee6a5e6352ceaf61b707ad3e5b531f
2021-11-12 09:12:22 -08:00
Jooyung Han
07f70c0e92 Pass --min_sdk_version to aidl compiler
cc/java modules can have .aidl files as srcs. Pass min_sdk_version to
the aidl compiler so that it can check some features against it.

For example, ParcelableHolder AIDL type is available since 31.

Bug: 205338951
Test: soong test && m
Change-Id: I7ecab913e00c9b6a3ce870dacbe9773d2ddb7e93
2021-11-06 07:31:50 +09:00
Liz Kammer
08572c6d45 Add unit tests for cpp/assembly flags.
Test: go test soong tests
Change-Id: Idd4b8d558b9bccf92b63c80abff19792ea3ff766
2021-09-30 10:11:04 -04:00
Liz Kammer
067b889762 Correct isThirdParty check
Previously, isThirdParty check was over-selecting for third-party-ness,
the only non-third-party paths were those explicitly excluded from
typically third party directories, results in ~all code being considered
third party.

Updated test to ensure bionic is not considered third party, which fails
without this change.

Test: go soong tests
Change-Id: Id371aaad2ceef2b3163384fa84712397877cbe90
2021-08-02 11:50:34 -07:00
Colin Cross
cb0ac95bde Remove Fuchsia support from Soong
Bug: 194215932
Test: m checkbuild
Change-Id: Id7d3964d9417f8b0938af9b168bb4c00cebe9390
2021-07-21 20:37:46 -07:00
Colin Cross
0523ba2675 Rename ninja variables with Clang in the name
Rename the ninja variables that have an extraneous Clang in the name,
since there are no longer any non-Clang variables.

Bug: 68947919
Test: no change to command lines used to build mmma bionic
Change-Id: I081d5e1d423a66d55faece6cb1d265cd5e504d5f
2021-07-14 20:55:23 -07:00
Colin Cross
dd8b6911ac Merge "Reland "Consistently prepend arch-specific headers"" 2021-06-30 00:19:56 +00:00
Colin Cross
0ed579efd9 Reland "Consistently prepend arch-specific headers"
This reverts commit cacb972dcd.

Relanding along with one more fix in prebuilts/ndk

Change-Id: I65cbc3c5d72bb47bd00e123c63911c9baa1e5f03
Test: m checkbuild
2021-06-29 00:51:12 +00:00
Colin Cross
e86698f28a Merge "Revert "Consistently prepend arch-specific headers"" 2021-06-28 23:59:48 +00:00
Colin Cross
cacb972dcd Revert "Consistently prepend arch-specific headers"
This reverts commit e945a4d212.

Reason for revert: broke full-eng checkbuild

Change-Id: I0036fed96aa727b63c16982151fd661923e77e59
2021-06-28 23:58:59 +00:00
Colin Cross
99f5cc002b Merge "Consistently prepend arch-specific headers" 2021-06-28 22:55:35 +00:00
Liz Kammer
bb8d84f01b Move notememtag tests to sanitize_test.go
Test: go test soong tests
Change-Id: I177fcfd787c3aa8185f94dfcc971d9a0c56f9438
2021-06-25 13:37:18 -04:00
Colin Cross
e945a4d212 Consistently prepend arch-specific headers
Add variant_prepend to Export_include_dirs, Export_system_include_dirs
and Generated_headers to match Local_include_dirs so that
architecture-specific headers are found before common headers.

Test: m checkbuild
Test: TestIncludeDirectoryOrdering
Change-Id: I2bf9d4373fd256e500c1f8d6c84cf593e8fdd170
2021-06-14 18:12:58 -07:00
Colin Cross
c113e3cbe7 Use LateStaticLibs for ndk_libandroid_support
This will obsolete the workaround in prebuilts/ndk/Android.bp to
export the ndk_libandroid_support headers from ndk_libc++_shared,
which would no longer have worked after the next patch.

Test: m checkbuild
Test: TestIncludeDirectoryOrdering
Change-Id: I9b4e5799d939433da547661b862e9db5a4aacb09
2021-06-14 18:12:58 -07:00
Colin Cross
ae62818dd8 Test include directory ordering
Add a test to verify include directory ordering on the command line.

Test: TestIncludeDirectryOrdering
Change-Id: Iaf03c57201e9ec7a8daf417cb91470a5215e4053
2021-06-14 18:12:52 -07:00
Ivan Lozano
d67a6b0a88 Export cc vendor functions for usage by rust.
This CL exports and refactors some cc vendor-snapshot related functions
so they can be reused by rust modules to support vendor snapshotting.

Bug: 184042776
Test: m nothing
Change-Id: I12706e62ce0ac3b2b4298085fafc1d77b8e0a0c4
2021-06-03 08:31:55 -04:00
Treehugger Robot
ebdf61ece2 Merge "Remove versioned LLNDK stubs" 2021-06-01 18:38:52 +00:00
Justin Yun
611e886ca7 Do not filter LLNDK lib from llndk.libraries.txt
llndk.libraries.txt is used to list the LLNDKs for the linkerconfig.
This is also required to define the VNDK snapshot modules of LLNDK
stub libraries.
The list had a filter for hwasan libraries, but the filter must be
used only for the LLNDK_LIBRARIES make variable, but not for the
llndk.libraries.txt file.

Bug: 189070366
Bug: 188716508
Test: m nothing
Test: LLNDK_LIBRARIES in make_vars-*.mk does not include hwasan.
Change-Id: I820dd1161892dc76700aa1d696ea2643764d2052
2021-05-24 20:44:44 +09:00
Ivan Lozano
d7586b6526 Refactor vendor snapshot to use LinkableInterface.
Refactors the vendor snapshot support to use the LinkableInterface
so that support can be extended to Rust. This CL does not add
vendor snapshot support for Rust; that is left for a follow-on CL.

Bug: 184042776
Test: m nothing
Change-Id: Id0c4970ca00053484a52677d182153cbc454c301
2021-05-12 14:01:10 -04:00
Colin Cross
c1b3644e91 Remove versioned LLNDK stubs
Nothing links against the versioned LLNDK stubs, only current and the
implementation are used.  Remove the numbered LLNDK variants.

Also remove llndkStubDepTag, it is never used to add a dependency.

Test: TestLlndkLibrary
Change-Id: Idde62007d77b8e6ceee31144c05756faf9b41f23
2021-05-06 23:50:22 +00:00
Colin Cross
203b421043 Remove obsolete llndk_library
Remove llndk_library in favor of cc_library with llndk.symbol_file.

Bug: 170784825
Test: m checkbuild
Test: TestLlndkLibrary
Change-Id: I43580976589a7a2a176d7442be53fa043c0c8324
2021-04-26 18:41:00 -07:00
Colin Cross
627280f091 Remove llndk_headers
Replace llndk_headers with cc_library_headers with
llndk.llndk_headers: true.

Bug: 170784825
Test: m checkbuild
Test: compare out/soong/build.ninja
Test: TestLlndkHeaders
Change-Id: I33b411cd4d474318796c2073375176b82dd8c216
2021-04-26 18:40:53 -07:00
Colin Cross
f12db530d0 Move TestVendorPublicLibraries into vendor_public_library_test.go
Bug: 178231622
Test: TestVendorPublicLibraries
Change-Id: Ic57202a7e4e186483506ceca3125f3d6a855f3ff
2021-04-26 17:43:32 -07:00
Colin Cross
0fb7fcd3a6 Support cc_library as LLNDK without llndk_library
Allow cc_library modules to configure themselves as an LLNDK library
using llndk.symbol_file instead of llndk_stubs pointing to an
llndk_library module.

Bug: 170784825
Test: TestEmbeddedLlndkLibrary
Change-Id: Id884cdada7094bbea6809a98e687e039778c5dc6
2021-04-20 22:24:11 -07:00
Treehugger Robot
a0b235a9d9 Merge "Move cc_object tests to object_test.go" 2021-04-19 22:48:15 +00:00
Liz Kammer
25f369fdca Move cc_object tests to object_test.go
Test: go test cc tests
Change-Id: I6a138482f678b6168b06b523ddbfeb639bf70364
2021-04-19 12:44:51 -04:00
Justin Yun
450ae72314 Add LLNDK stubs and headers to VNDK snapshot
LLNDK stubs and headers are required to build the vendor modules
against VNDK snapshot libraries. Add the LLNDK stubs and headers to
the VNDK snapshot prebuilt files.
The stub libraries will be included in shared/llndk-stub directory.

Bug: 181815415
Test: development/vndk/snapshot/build.sh --build-artifacts
Change-Id: If518f3e91080e69fa1da94af0aa27320d4e71a08
2021-04-16 23:02:04 +09:00
Evgenii Stepanov
779b64ec5d Fix evaluation order of (Cfi|Memtag) exclude paths.
Before this change, exclude paths disabled sanitization of targets that
would otherwise be enabled by SanitizeDevice product variable (aka
SANITIZE_TARGET).

With this change, in addition to the above logic, exclude path disables
sanitization of targets that would otherwise be enabled by the
corresponding include path.

Effectively, this change disables sanitization of targets that are
covered by *both* include and exclude paths.

Test: build/soong/cc/cc_test.go
Bug: b/184976817
Change-Id: I96f1e2a808d88b352b92b7490fa1df5c010314c3
2021-04-13 10:29:15 -07:00
Justin Yun
7f99ec7c1f Add a test to check the intall partitions
cc modules have complex image variant settings. To avoid setting
wrong partitions to modules, add a test to check the install
partition.

Bug: 184885453
Test: m nothing
Change-Id: I080661335f2da7281d6e6a0d2fedd1fcecb4b2cb
2021-04-12 13:19:28 +09:00
Ryan Prichard
3f3bb83f81 Merge "Remove libgcc toolchain libs for Android" 2021-04-06 21:43:33 +00:00
Treehugger Robot
8c56183fb7 Merge changes Id33bf640,I4d67b9b9
* changes:
  Don't use incorrect version names like VER or BOARD even in tests
  SdkSpec = Scope + ApiLevel
2021-04-06 03:18:16 +00:00
Jiyong Park
f58c46e36f Don't use incorrect version names like VER or BOARD even in tests
All version names will go through ApiLevelFromUser which triggers an
error when the name is not a valid one.

Bug: 175678607
Test: m
Change-Id: Id33bf64085603914d45ad7942cb8908a4734493f
2021-04-05 09:32:06 +09:00
Ryan Prichard
c2018e2ed4 Remove libgcc toolchain libs for Android
Remove Android-targeting gcc toolchain libraries -- libgcc,
libgcc_stripped, libatomic, and libgcov. Also remove libunwind_llvm,
which is replaced with a libunwind toolchain prebuilt.

The __atomic_* library functions are now part of the compiler-rt
builtins library:

https://android-review.googlesource.com/c/toolchain/llvm_android/+/1625025

Bug: http://b/153025717
Test: treehugger
Change-Id: I971d0a4a49f1aaeb3546e80b6d94208277a171ac
2021-04-02 21:07:35 -07:00
Liz Kammer
3cf5211890 Add bazel_module properties to cc_defaults
Test: go soong tests
Test: add bazel_module to Android.bp file and m nothing
Change-Id: I13c3e8d59536dbea88f3495309f4f64e849ede9f
2021-04-02 08:44:31 -04:00
Treehugger Robot
25c47a43a5 Merge ""current" is implicitly added to stubs.versions" 2021-04-01 04:53:55 +00:00
Jiyong Park
d4a3a137ed "current" is implicitly added to stubs.versions
So far, when a library `libfoo` has `stubs.versions: ["10", "11"]`, then
`shared_libs: ["libfoo"]` is linked to the version 11 of the stub.

This requires the author of `libfoo` to manually update the property
whenever a new version is introduced. Otherwise, clients are not able
to use the newly added APIs because the latest stub is for an old
version.

This change eliminates the need for manual updating. "current" version
is always implicitly added to `stubs.versions`. It is added even when
nothing is set on the property, if `stubs.symbol_file` is set. i.e.

```
cc_library {
    name: "libfoo",
    stubs: {
        symbol_file: "libfoo.map.txt",
	// no versions: [...] needed
    },
}

cc_library {
    name: "a_client",
    shared_libs: ["libfoo"],
    apex_available: ["myapex"],
    min_sdk_version: "29",
}

apex {
    name: "myapex",
    native_shared_libraries: ["a_client"],
    min_sdk_version: "29",
}
```

`a_client` links to the "current" stub of `libfoo` that has all symbols
shown in the map file.

Note that, above doesn't mean that the client has unlimited access to
APIs that are introduced even after the min_sdk_version of the client
(29 in this example). The use of such APIs still has to be guarded with
`__builtin_available` check.

Bug: N/A
Test: m
Change-Id: I70bb1600c18e74d36c6b24c3569d2149f02aaf96
2021-04-01 09:58:53 +09:00
Paul Duffin
8567f226e4 Remove ccFixtureFactory
Bug: 182885307
Test: m nothing
Change-Id: Ia3e93b8ab70a7a6a986debd837bd2df84b234847
2021-03-30 23:44:43 +01:00
Paul Duffin
c3e6ce04d9 Remove buildDir from cc package
Bug: 182885307
Test: m nothing
Change-Id: I964af3cb9a3e7a1dfbd9d5176a702591f6b19f16
2021-03-30 23:44:43 +01:00
Paul Duffin
2e6f90e0d0 Extract prepareForCcTest
Bug: 182885307
Test: m nothing
Change-Id: Ica17d20775c6dae00978f0f84f768fdaaf55e031
2021-03-30 23:44:43 +01:00
Paul Duffin
e8366da1f6 Automatically call TestingBuildParams.RelativeToTop()
Fixes the few tests that break due to this and which cannot easily be
separated into their own changes.

Bug: 183650682
Test: m nothing
Change-Id: Ia2f31213a1f114a78e66a81d89279ecde9f4c465
2021-03-30 19:35:35 +01:00
Treehugger Robot
10906f5cc6 Merge changes from topic "min_sdk_version"
* changes:
  Versioned CRT objects are built with correct __ANDROID_API__
  Always respect min_sdk_version
2021-03-26 08:07:28 +00:00
Paul Duffin
db462dd987 Disallow non-existent paths in sdk package
Test behavior was changed a while ago so that tests by default ignore
non-existent source paths (unless they explicitly check for/rely on
them). Prior to that CheckSnapshot() could detect when files were
missing from the snapshot but it no longer can.

This change disallows non-existent source files in all the sdk tests
which means that they are disallowed when processing the snapshots as
they use the same preparers as were used to process the sources.

This caused a test failure which has been temporarily ignored and has
a TODO and bug associated with it.

Bug: 183184375
Test: m nothing
Change-Id: I969d8515d20ef5ae515f2b5f93d8ed4e4f8ede75
2021-03-25 12:53:22 +00:00
Jiyong Park
fdaa5f7164 Versioned CRT objects are built with correct __ANDROID_API__
Background: `min_sdk_version` of a crt object is the oldest SDK version
that the crt object supports. When it's set to for example 16, Soong
creates a number of versioned variants of the crt object starting from
16 to the latest version. The variant for version X is provided to NDK
clients having `min_sdk_version` set to X.

Problem: all versioned variants of a crt object were built with `-target
<arch>-linux-android16`. Therefore they all have been with `#define __ANDROID_API__
16`.  This is because the mutated variants still have the same
min_sdk_version property and the clang triple follows min_sdk_version,
not sdk_version. This is too conservative and against our intention to
provide the latest crt object that matches with the min_sdk_version of
the client.

In the other hand, the platform(non-sdk) variant of the crt object
doesn't have such a problem. min_sdk_version is completely ignored.
However, this is a bug and will be fixed by aosp/1640364. As a side
effect of the fixing, the platform variant will begin to built with a
very old __ANDROID_API__ which unnecessarily turns off the new platform
features like the TLS segment over-alignment.

This change fixes the problems:

* For the versioned variants of crt objects, we set both
`min_sdk_version` and `sdk_versio` to the version that the variant is
created for.

* For the platform variant of crt objects, `min_sdk_version` is force
reset to "current".

Bug: 183191008
Test: m

Change-Id: I8c9d0fcea816de8cd1532dac4a47eee4f726c037
2021-03-23 01:18:31 +09:00
Jiyong Park
a008fb08cf Always respect min_sdk_version
Background:
When compiling cc_* modules, min_sdk_version determines the "version"
part of the clang triple: -target <arch>-linux-android<version>. The
version part is used to make sure that calls to the APIs that are added
after the version are guarded with a runtime check (i.e.
__builtin_available).

Previously, min_sdk_version was used as the version part only when the
cc_* module is unbundled (e.g. built for an APEX or built with SDK). In
other words, min_sdk_version has been ignored for the platform variants.
They were built with the version number 10000.

This was problematic for Mainline module tests. Since they are neither
part of an APEX nor built with SDK (because they need to have access to
some of the module-only APIs), they are built with the version number
10000. As a side effect, __builtin_available macro are expanded to 1 at
build time - because 10000 is higher than any API versions. When such a
test built in the latest platform source tree runs on a device running
an old platform, it tries to call an API that might not be available on
the platform and experience a crash, due to the lack of the runtime
check.

This change fixes the problem by using min_sdk_version as the "version"
part of the clang triple, regardless of the module's variant. Then
__builtin_available macro in the tests doesn't expand to 1, but to a
function call to the libclang_rt.builtin library which checks the system
property ro.build.version.sdk.

Bug: N/A
Test: run resolv_stress_test

Change-Id: I88f64c5a35f1b5276c3350e177b116932011a940
2021-03-23 01:18:31 +09:00
Justin Yun
13decfb0bb Define __ANDROID_VENDOR__ and __ANDROID_PRODUCT__
__ANDROID_VNDK__ is defined for the modules that are able to use the
VNDK libraries. As both product and vendor variants define
__ANDROID_VNDK__, we don't know if a module is built for vendor or
product on build time.

__ANDROID_VENDOR__ and __ANDROID_PRODUCT__ macros can be used to
specify the image-variant-dependent codes.

Bug: 180646847
Test: m nothing
Change-Id: Id6c3e1e3d47deaf3684c0c02964718658cf2fec5
2021-03-15 17:28:59 +09:00