2019-02-08 20:00:45 +08:00
|
|
|
// Copyright (C) 2019 The Android Open Source Project
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
package cc
|
|
|
|
|
|
|
|
import (
|
|
|
|
"android/soong/android"
|
2020-11-11 10:12:15 +08:00
|
|
|
"android/soong/genrule"
|
2019-02-08 20:00:45 +08:00
|
|
|
)
|
|
|
|
|
2019-12-20 00:01:36 +08:00
|
|
|
func RegisterRequiredBuildComponentsForTest(ctx android.RegistrationContext) {
|
2019-12-19 22:38:36 +08:00
|
|
|
RegisterPrebuiltBuildComponents(ctx)
|
2019-12-20 03:16:28 +08:00
|
|
|
RegisterCCBuildComponents(ctx)
|
2020-01-16 20:14:42 +08:00
|
|
|
RegisterBinaryBuildComponents(ctx)
|
2019-12-19 23:02:40 +08:00
|
|
|
RegisterLibraryBuildComponents(ctx)
|
2020-02-21 18:28:43 +08:00
|
|
|
RegisterLibraryHeadersBuildComponents(ctx)
|
2020-11-11 10:12:15 +08:00
|
|
|
genrule.RegisterGenruleBuildComponents(ctx)
|
2019-12-19 23:02:40 +08:00
|
|
|
|
|
|
|
ctx.RegisterModuleType("toolchain_library", ToolchainLibraryFactory)
|
|
|
|
ctx.RegisterModuleType("llndk_library", LlndkLibraryFactory)
|
2020-12-04 17:02:13 +08:00
|
|
|
ctx.RegisterModuleType("cc_benchmark", BenchmarkFactory)
|
2019-12-19 23:02:40 +08:00
|
|
|
ctx.RegisterModuleType("cc_object", ObjectFactory)
|
2020-07-11 11:33:29 +08:00
|
|
|
ctx.RegisterModuleType("cc_genrule", genRuleFactory)
|
2020-02-16 03:00:10 +08:00
|
|
|
ctx.RegisterModuleType("ndk_prebuilt_shared_stl", NdkPrebuiltSharedStlFactory)
|
|
|
|
ctx.RegisterModuleType("ndk_prebuilt_object", NdkPrebuiltObjectFactory)
|
2020-07-01 03:32:51 +08:00
|
|
|
ctx.RegisterModuleType("ndk_library", NdkLibraryFactory)
|
2019-12-20 00:01:36 +08:00
|
|
|
}
|
|
|
|
|
2020-03-02 18:16:35 +08:00
|
|
|
func GatherRequiredDepsForTest(oses ...android.OsType) string {
|
2019-02-08 20:00:45 +08:00
|
|
|
ret := `
|
|
|
|
toolchain_library {
|
|
|
|
name: "libatomic",
|
2020-07-11 11:33:29 +08:00
|
|
|
defaults: ["linux_bionic_supported"],
|
2019-02-08 20:00:45 +08:00
|
|
|
vendor_available: true,
|
2020-10-29 15:49:43 +08:00
|
|
|
product_available: true,
|
2019-02-08 20:00:45 +08:00
|
|
|
recovery_available: true,
|
2020-02-16 03:29:50 +08:00
|
|
|
native_bridge_supported: true,
|
2019-02-08 20:00:45 +08:00
|
|
|
src: "",
|
|
|
|
}
|
|
|
|
|
|
|
|
toolchain_library {
|
|
|
|
name: "libcompiler_rt-extras",
|
|
|
|
vendor_available: true,
|
2020-10-29 15:49:43 +08:00
|
|
|
product_available: true,
|
2019-02-08 20:00:45 +08:00
|
|
|
recovery_available: true,
|
|
|
|
src: "",
|
|
|
|
}
|
|
|
|
|
|
|
|
toolchain_library {
|
|
|
|
name: "libclang_rt.builtins-arm-android",
|
|
|
|
vendor_available: true,
|
2020-10-29 15:49:43 +08:00
|
|
|
product_available: true,
|
2019-02-08 20:00:45 +08:00
|
|
|
recovery_available: true,
|
2020-02-16 03:29:50 +08:00
|
|
|
native_bridge_supported: true,
|
2019-02-08 20:00:45 +08:00
|
|
|
src: "",
|
|
|
|
}
|
|
|
|
|
|
|
|
toolchain_library {
|
|
|
|
name: "libclang_rt.builtins-aarch64-android",
|
|
|
|
vendor_available: true,
|
2020-10-29 15:49:43 +08:00
|
|
|
product_available: true,
|
2019-02-08 20:00:45 +08:00
|
|
|
recovery_available: true,
|
2020-02-16 03:29:50 +08:00
|
|
|
native_bridge_supported: true,
|
2019-02-08 20:00:45 +08:00
|
|
|
src: "",
|
|
|
|
}
|
|
|
|
|
Enforce apex.min_sdk_version for bundled builds
Previously, when Q-targeting apexes are bundled-built, they are built
against the latest stubs.
It was because unwinder is linked dynamically in R and APIs are provided
by libc while Q apexes should run on Q where libc doesn't provide those
APIs. To make Q apexes run on Q device, libc++ should be linked with
static unwinder. But, because libc++ with static unwinder may cause problem
on HWASAN build, Q apexes were built against the latest stubs for bundled
build.
However, Q apexes should be built against Q stubs.
Now, only for HWASAN builds, Q apexes are built against the latest stubs
(and native modules are not linked with static unwinder).
Bug: 151912436
Test: TARGET_SANITIZE=hwaddress m
=> Q apexes(media, resolv, ..) are linked with the latest stubs
m
=> Q apexes are linked with Q stubs,
and Q apexes' libc++ is linked with static unwinder
Merged-In: If32f1b547e6d93e3955c7521eec8aef5851f908c
Change-Id: If32f1b547e6d93e3955c7521eec8aef5851f908c
(cherry picked from commit 7406660685a9a085c433ba7081cc6984f66fa732)
Exempt-From-Owner-Approval: cp from internal
Change-Id: If32f1b547e6d93e3955c7521eec8aef5851f908c
2020-03-20 03:29:24 +08:00
|
|
|
cc_prebuilt_library_shared {
|
|
|
|
name: "libclang_rt.hwasan-aarch64-android",
|
|
|
|
nocrt: true,
|
|
|
|
vendor_available: true,
|
2020-10-29 15:49:43 +08:00
|
|
|
product_available: true,
|
Enforce apex.min_sdk_version for bundled builds
Previously, when Q-targeting apexes are bundled-built, they are built
against the latest stubs.
It was because unwinder is linked dynamically in R and APIs are provided
by libc while Q apexes should run on Q where libc doesn't provide those
APIs. To make Q apexes run on Q device, libc++ should be linked with
static unwinder. But, because libc++ with static unwinder may cause problem
on HWASAN build, Q apexes were built against the latest stubs for bundled
build.
However, Q apexes should be built against Q stubs.
Now, only for HWASAN builds, Q apexes are built against the latest stubs
(and native modules are not linked with static unwinder).
Bug: 151912436
Test: TARGET_SANITIZE=hwaddress m
=> Q apexes(media, resolv, ..) are linked with the latest stubs
m
=> Q apexes are linked with Q stubs,
and Q apexes' libc++ is linked with static unwinder
Merged-In: If32f1b547e6d93e3955c7521eec8aef5851f908c
Change-Id: If32f1b547e6d93e3955c7521eec8aef5851f908c
(cherry picked from commit 7406660685a9a085c433ba7081cc6984f66fa732)
Exempt-From-Owner-Approval: cp from internal
Change-Id: If32f1b547e6d93e3955c7521eec8aef5851f908c
2020-03-20 03:29:24 +08:00
|
|
|
recovery_available: true,
|
|
|
|
system_shared_libs: [],
|
|
|
|
stl: "none",
|
|
|
|
srcs: [""],
|
|
|
|
check_elf_files: false,
|
|
|
|
sanitize: {
|
|
|
|
never: true,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2019-02-08 20:00:45 +08:00
|
|
|
toolchain_library {
|
|
|
|
name: "libclang_rt.builtins-i686-android",
|
|
|
|
vendor_available: true,
|
2020-10-29 15:49:43 +08:00
|
|
|
product_available: true,
|
2019-02-08 20:00:45 +08:00
|
|
|
recovery_available: true,
|
2020-02-16 03:29:50 +08:00
|
|
|
native_bridge_supported: true,
|
2019-02-08 20:00:45 +08:00
|
|
|
src: "",
|
|
|
|
}
|
|
|
|
|
|
|
|
toolchain_library {
|
|
|
|
name: "libclang_rt.builtins-x86_64-android",
|
2020-07-11 11:33:29 +08:00
|
|
|
defaults: ["linux_bionic_supported"],
|
2019-02-08 20:00:45 +08:00
|
|
|
vendor_available: true,
|
2020-10-29 15:49:43 +08:00
|
|
|
product_available: true,
|
2019-02-08 20:00:45 +08:00
|
|
|
recovery_available: true,
|
2020-02-16 03:29:50 +08:00
|
|
|
native_bridge_supported: true,
|
2019-02-08 20:00:45 +08:00
|
|
|
src: "",
|
|
|
|
}
|
|
|
|
|
2019-07-16 00:34:09 +08:00
|
|
|
toolchain_library {
|
|
|
|
name: "libclang_rt.fuzzer-arm-android",
|
|
|
|
vendor_available: true,
|
2020-10-29 15:49:43 +08:00
|
|
|
product_available: true,
|
2019-07-16 00:34:09 +08:00
|
|
|
recovery_available: true,
|
|
|
|
src: "",
|
|
|
|
}
|
|
|
|
|
|
|
|
toolchain_library {
|
|
|
|
name: "libclang_rt.fuzzer-aarch64-android",
|
|
|
|
vendor_available: true,
|
2020-10-29 15:49:43 +08:00
|
|
|
product_available: true,
|
2019-07-16 00:34:09 +08:00
|
|
|
recovery_available: true,
|
|
|
|
src: "",
|
|
|
|
}
|
|
|
|
|
|
|
|
toolchain_library {
|
|
|
|
name: "libclang_rt.fuzzer-i686-android",
|
|
|
|
vendor_available: true,
|
2020-10-29 15:49:43 +08:00
|
|
|
product_available: true,
|
2019-07-16 00:34:09 +08:00
|
|
|
recovery_available: true,
|
|
|
|
src: "",
|
|
|
|
}
|
|
|
|
|
|
|
|
toolchain_library {
|
|
|
|
name: "libclang_rt.fuzzer-x86_64-android",
|
2020-07-11 11:33:29 +08:00
|
|
|
defaults: ["linux_bionic_supported"],
|
2019-07-16 00:34:09 +08:00
|
|
|
vendor_available: true,
|
2020-10-29 15:49:43 +08:00
|
|
|
product_available: true,
|
2019-07-16 00:34:09 +08:00
|
|
|
recovery_available: true,
|
|
|
|
src: "",
|
|
|
|
}
|
|
|
|
|
|
|
|
toolchain_library {
|
|
|
|
name: "libclang_rt.fuzzer-x86_64",
|
|
|
|
vendor_available: true,
|
2020-10-29 15:49:43 +08:00
|
|
|
product_available: true,
|
2019-07-16 00:34:09 +08:00
|
|
|
recovery_available: true,
|
|
|
|
src: "",
|
|
|
|
}
|
|
|
|
|
2019-12-19 22:38:36 +08:00
|
|
|
// Needed for sanitizer
|
|
|
|
cc_prebuilt_library_shared {
|
|
|
|
name: "libclang_rt.ubsan_standalone-aarch64-android",
|
|
|
|
vendor_available: true,
|
2020-10-29 15:49:43 +08:00
|
|
|
product_available: true,
|
2019-12-19 22:38:36 +08:00
|
|
|
recovery_available: true,
|
2020-02-16 03:29:50 +08:00
|
|
|
system_shared_libs: [],
|
2019-12-19 22:38:36 +08:00
|
|
|
srcs: [""],
|
|
|
|
}
|
|
|
|
|
2019-02-08 20:00:45 +08:00
|
|
|
toolchain_library {
|
|
|
|
name: "libgcc",
|
2020-07-11 11:33:29 +08:00
|
|
|
defaults: ["linux_bionic_supported"],
|
2019-02-08 20:00:45 +08:00
|
|
|
vendor_available: true,
|
2020-10-29 15:49:43 +08:00
|
|
|
product_available: true,
|
2019-02-08 20:00:45 +08:00
|
|
|
recovery_available: true,
|
|
|
|
src: "",
|
2020-11-17 21:21:02 +08:00
|
|
|
apex_available: [
|
|
|
|
"//apex_available:platform",
|
|
|
|
"//apex_available:anyapex",
|
|
|
|
],
|
2019-02-08 20:00:45 +08:00
|
|
|
}
|
|
|
|
|
2019-03-30 11:05:14 +08:00
|
|
|
toolchain_library {
|
|
|
|
name: "libgcc_stripped",
|
2020-07-11 11:33:29 +08:00
|
|
|
defaults: ["linux_bionic_supported"],
|
2019-03-30 11:05:14 +08:00
|
|
|
vendor_available: true,
|
2020-10-29 15:49:43 +08:00
|
|
|
product_available: true,
|
2019-03-30 11:05:14 +08:00
|
|
|
recovery_available: true,
|
2020-04-08 00:50:32 +08:00
|
|
|
sdk_version: "current",
|
2019-03-30 11:05:14 +08:00
|
|
|
src: "",
|
|
|
|
}
|
|
|
|
|
2019-02-08 20:00:45 +08:00
|
|
|
cc_library {
|
|
|
|
name: "libc",
|
2020-07-11 11:33:29 +08:00
|
|
|
defaults: ["linux_bionic_supported"],
|
2019-06-02 15:53:50 +08:00
|
|
|
no_libcrt: true,
|
2019-02-08 20:00:45 +08:00
|
|
|
nocrt: true,
|
2019-12-11 10:37:45 +08:00
|
|
|
stl: "none",
|
2019-02-08 20:00:45 +08:00
|
|
|
system_shared_libs: [],
|
|
|
|
recovery_available: true,
|
2020-02-16 03:29:50 +08:00
|
|
|
stubs: {
|
|
|
|
versions: ["27", "28", "29"],
|
|
|
|
},
|
2020-10-14 09:43:54 +08:00
|
|
|
llndk_stubs: "libc.llndk",
|
2020-10-29 15:49:43 +08:00
|
|
|
}
|
2019-02-08 20:00:45 +08:00
|
|
|
llndk_library {
|
2020-10-14 09:43:54 +08:00
|
|
|
name: "libc.llndk",
|
2019-02-08 20:00:45 +08:00
|
|
|
symbol_file: "",
|
2020-04-08 00:50:32 +08:00
|
|
|
sdk_version: "current",
|
2019-02-08 20:00:45 +08:00
|
|
|
}
|
|
|
|
cc_library {
|
|
|
|
name: "libm",
|
2020-07-11 11:33:29 +08:00
|
|
|
defaults: ["linux_bionic_supported"],
|
2019-06-02 15:53:50 +08:00
|
|
|
no_libcrt: true,
|
2019-02-08 20:00:45 +08:00
|
|
|
nocrt: true,
|
2019-12-11 10:37:45 +08:00
|
|
|
stl: "none",
|
2019-02-08 20:00:45 +08:00
|
|
|
system_shared_libs: [],
|
|
|
|
recovery_available: true,
|
2020-02-16 03:29:50 +08:00
|
|
|
stubs: {
|
|
|
|
versions: ["27", "28", "29"],
|
|
|
|
},
|
|
|
|
apex_available: [
|
|
|
|
"//apex_available:platform",
|
|
|
|
"myapex"
|
|
|
|
],
|
2020-10-14 09:43:54 +08:00
|
|
|
llndk_stubs: "libm.llndk",
|
2019-02-08 20:00:45 +08:00
|
|
|
}
|
|
|
|
llndk_library {
|
2020-10-14 09:43:54 +08:00
|
|
|
name: "libm.llndk",
|
2019-02-08 20:00:45 +08:00
|
|
|
symbol_file: "",
|
2020-04-08 00:50:32 +08:00
|
|
|
sdk_version: "current",
|
2019-02-08 20:00:45 +08:00
|
|
|
}
|
2020-04-09 21:56:02 +08:00
|
|
|
|
|
|
|
// Coverage libraries
|
|
|
|
cc_library {
|
|
|
|
name: "libprofile-extras",
|
|
|
|
vendor_available: true,
|
2020-10-29 15:49:43 +08:00
|
|
|
product_available: true,
|
2020-04-09 21:56:02 +08:00
|
|
|
recovery_available: true,
|
|
|
|
native_coverage: false,
|
|
|
|
system_shared_libs: [],
|
|
|
|
stl: "none",
|
|
|
|
notice: "custom_notice",
|
|
|
|
}
|
|
|
|
cc_library {
|
|
|
|
name: "libprofile-clang-extras",
|
|
|
|
vendor_available: true,
|
2020-10-29 15:49:43 +08:00
|
|
|
product_available: true,
|
2020-04-09 21:56:02 +08:00
|
|
|
recovery_available: true,
|
|
|
|
native_coverage: false,
|
|
|
|
system_shared_libs: [],
|
|
|
|
stl: "none",
|
|
|
|
notice: "custom_notice",
|
|
|
|
}
|
|
|
|
cc_library {
|
|
|
|
name: "libprofile-extras_ndk",
|
|
|
|
vendor_available: true,
|
2020-10-29 15:49:43 +08:00
|
|
|
product_available: true,
|
2020-04-09 21:56:02 +08:00
|
|
|
native_coverage: false,
|
|
|
|
system_shared_libs: [],
|
|
|
|
stl: "none",
|
|
|
|
notice: "custom_notice",
|
|
|
|
sdk_version: "current",
|
|
|
|
}
|
|
|
|
cc_library {
|
|
|
|
name: "libprofile-clang-extras_ndk",
|
|
|
|
vendor_available: true,
|
2020-10-29 15:49:43 +08:00
|
|
|
product_available: true,
|
2020-04-09 21:56:02 +08:00
|
|
|
native_coverage: false,
|
|
|
|
system_shared_libs: [],
|
|
|
|
stl: "none",
|
|
|
|
notice: "custom_notice",
|
|
|
|
sdk_version: "current",
|
|
|
|
}
|
|
|
|
|
2019-02-08 20:00:45 +08:00
|
|
|
cc_library {
|
|
|
|
name: "libdl",
|
2020-07-11 11:33:29 +08:00
|
|
|
defaults: ["linux_bionic_supported"],
|
2019-06-02 15:53:50 +08:00
|
|
|
no_libcrt: true,
|
2019-02-08 20:00:45 +08:00
|
|
|
nocrt: true,
|
2019-12-11 10:37:45 +08:00
|
|
|
stl: "none",
|
2019-02-08 20:00:45 +08:00
|
|
|
system_shared_libs: [],
|
|
|
|
recovery_available: true,
|
2020-02-16 03:29:50 +08:00
|
|
|
stubs: {
|
|
|
|
versions: ["27", "28", "29"],
|
|
|
|
},
|
|
|
|
apex_available: [
|
|
|
|
"//apex_available:platform",
|
|
|
|
"myapex"
|
|
|
|
],
|
2020-10-14 09:43:54 +08:00
|
|
|
llndk_stubs: "libdl.llndk",
|
2019-02-08 20:00:45 +08:00
|
|
|
}
|
|
|
|
llndk_library {
|
2020-10-14 09:43:54 +08:00
|
|
|
name: "libdl.llndk",
|
2019-02-08 20:00:45 +08:00
|
|
|
symbol_file: "",
|
2020-04-08 00:50:32 +08:00
|
|
|
sdk_version: "current",
|
2019-02-08 20:00:45 +08:00
|
|
|
}
|
2019-10-22 18:32:18 +08:00
|
|
|
cc_library {
|
|
|
|
name: "libft2",
|
|
|
|
no_libcrt: true,
|
|
|
|
nocrt: true,
|
|
|
|
system_shared_libs: [],
|
|
|
|
recovery_available: true,
|
2020-10-14 09:43:54 +08:00
|
|
|
llndk_stubs: "libft2.llndk",
|
2019-10-22 18:32:18 +08:00
|
|
|
}
|
|
|
|
llndk_library {
|
2020-10-14 09:43:54 +08:00
|
|
|
name: "libft2.llndk",
|
2019-10-22 18:32:18 +08:00
|
|
|
symbol_file: "",
|
|
|
|
vendor_available: false,
|
2020-04-08 00:50:32 +08:00
|
|
|
sdk_version: "current",
|
2019-10-22 18:32:18 +08:00
|
|
|
}
|
2019-02-08 20:00:45 +08:00
|
|
|
cc_library {
|
|
|
|
name: "libc++_static",
|
2019-06-02 15:53:50 +08:00
|
|
|
no_libcrt: true,
|
2019-02-08 20:00:45 +08:00
|
|
|
nocrt: true,
|
|
|
|
system_shared_libs: [],
|
|
|
|
stl: "none",
|
|
|
|
vendor_available: true,
|
2020-10-29 15:49:43 +08:00
|
|
|
product_available: true,
|
2019-02-08 20:00:45 +08:00
|
|
|
recovery_available: true,
|
2020-02-03 17:06:46 +08:00
|
|
|
host_supported: true,
|
2020-04-15 10:03:39 +08:00
|
|
|
min_sdk_version: "29",
|
2020-03-07 15:35:46 +08:00
|
|
|
apex_available: [
|
|
|
|
"//apex_available:platform",
|
|
|
|
"//apex_available:anyapex",
|
|
|
|
],
|
2019-02-08 20:00:45 +08:00
|
|
|
}
|
|
|
|
cc_library {
|
|
|
|
name: "libc++",
|
2019-06-02 15:53:50 +08:00
|
|
|
no_libcrt: true,
|
2019-02-08 20:00:45 +08:00
|
|
|
nocrt: true,
|
|
|
|
system_shared_libs: [],
|
|
|
|
stl: "none",
|
|
|
|
vendor_available: true,
|
2020-10-29 15:49:43 +08:00
|
|
|
product_available: true,
|
2019-02-08 20:00:45 +08:00
|
|
|
recovery_available: true,
|
2020-02-03 17:06:46 +08:00
|
|
|
host_supported: true,
|
2020-04-15 10:03:39 +08:00
|
|
|
min_sdk_version: "29",
|
2019-02-08 20:00:45 +08:00
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
support_system_process: true,
|
|
|
|
},
|
2020-02-16 03:29:50 +08:00
|
|
|
apex_available: [
|
|
|
|
"//apex_available:platform",
|
2020-12-05 04:05:43 +08:00
|
|
|
"//apex_available:anyapex",
|
2020-02-16 03:29:50 +08:00
|
|
|
],
|
2019-02-08 20:00:45 +08:00
|
|
|
}
|
2019-07-25 03:17:40 +08:00
|
|
|
cc_library {
|
|
|
|
name: "libc++demangle",
|
|
|
|
no_libcrt: true,
|
|
|
|
nocrt: true,
|
|
|
|
system_shared_libs: [],
|
|
|
|
stl: "none",
|
|
|
|
host_supported: false,
|
|
|
|
vendor_available: true,
|
2020-10-29 15:49:43 +08:00
|
|
|
product_available: true,
|
2019-07-25 03:17:40 +08:00
|
|
|
recovery_available: true,
|
2020-04-15 10:03:39 +08:00
|
|
|
min_sdk_version: "29",
|
2020-03-07 15:35:46 +08:00
|
|
|
apex_available: [
|
|
|
|
"//apex_available:platform",
|
|
|
|
"//apex_available:anyapex",
|
|
|
|
],
|
2019-07-25 03:17:40 +08:00
|
|
|
}
|
2019-02-08 20:00:45 +08:00
|
|
|
cc_library {
|
|
|
|
name: "libunwind_llvm",
|
2019-06-02 15:53:50 +08:00
|
|
|
no_libcrt: true,
|
2019-02-08 20:00:45 +08:00
|
|
|
nocrt: true,
|
|
|
|
system_shared_libs: [],
|
|
|
|
stl: "none",
|
|
|
|
vendor_available: true,
|
2020-10-29 15:49:43 +08:00
|
|
|
product_available: true,
|
2019-02-08 20:00:45 +08:00
|
|
|
recovery_available: true,
|
|
|
|
}
|
|
|
|
|
2020-03-07 15:35:46 +08:00
|
|
|
cc_defaults {
|
|
|
|
name: "crt_defaults",
|
2020-07-11 11:33:29 +08:00
|
|
|
defaults: ["linux_bionic_supported"],
|
2020-03-07 15:35:46 +08:00
|
|
|
recovery_available: true,
|
|
|
|
vendor_available: true,
|
2020-10-29 15:49:43 +08:00
|
|
|
product_available: true,
|
2020-03-07 15:35:46 +08:00
|
|
|
native_bridge_supported: true,
|
|
|
|
stl: "none",
|
2020-07-16 04:33:30 +08:00
|
|
|
min_sdk_version: "16",
|
|
|
|
crt: true,
|
2020-03-07 15:35:46 +08:00
|
|
|
apex_available: [
|
|
|
|
"//apex_available:platform",
|
|
|
|
"//apex_available:anyapex",
|
|
|
|
],
|
|
|
|
}
|
|
|
|
|
2019-02-08 20:00:45 +08:00
|
|
|
cc_object {
|
|
|
|
name: "crtbegin_so",
|
2020-03-07 15:35:46 +08:00
|
|
|
defaults: ["crt_defaults"],
|
2019-02-08 20:00:45 +08:00
|
|
|
}
|
|
|
|
|
2019-05-15 07:05:20 +08:00
|
|
|
cc_object {
|
|
|
|
name: "crtbegin_dynamic",
|
2020-03-07 15:35:46 +08:00
|
|
|
defaults: ["crt_defaults"],
|
2019-05-15 07:05:20 +08:00
|
|
|
}
|
|
|
|
|
2019-02-08 20:00:45 +08:00
|
|
|
cc_object {
|
|
|
|
name: "crtbegin_static",
|
2020-03-07 15:35:46 +08:00
|
|
|
defaults: ["crt_defaults"],
|
2019-02-08 20:00:45 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
cc_object {
|
|
|
|
name: "crtend_so",
|
2020-03-07 15:35:46 +08:00
|
|
|
defaults: ["crt_defaults"],
|
2019-02-08 20:00:45 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
cc_object {
|
|
|
|
name: "crtend_android",
|
2020-03-07 15:35:46 +08:00
|
|
|
defaults: ["crt_defaults"],
|
2019-02-08 20:00:45 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
cc_library {
|
|
|
|
name: "libprotobuf-cpp-lite",
|
|
|
|
}
|
2020-02-16 03:00:10 +08:00
|
|
|
|
|
|
|
cc_library {
|
|
|
|
name: "ndk_libunwind",
|
|
|
|
sdk_version: "current",
|
|
|
|
stl: "none",
|
|
|
|
system_shared_libs: [],
|
|
|
|
}
|
|
|
|
|
2020-07-01 03:32:51 +08:00
|
|
|
ndk_library {
|
|
|
|
name: "libc",
|
|
|
|
first_version: "minimum",
|
|
|
|
symbol_file: "libc.map.txt",
|
2020-02-16 03:00:10 +08:00
|
|
|
}
|
|
|
|
|
2020-07-01 03:32:51 +08:00
|
|
|
ndk_library {
|
|
|
|
name: "libm",
|
|
|
|
first_version: "minimum",
|
|
|
|
symbol_file: "libm.map.txt",
|
2020-02-16 03:00:10 +08:00
|
|
|
}
|
|
|
|
|
2020-07-01 03:32:51 +08:00
|
|
|
ndk_library {
|
|
|
|
name: "libdl",
|
|
|
|
first_version: "minimum",
|
|
|
|
symbol_file: "libdl.map.txt",
|
2020-02-16 03:00:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
ndk_prebuilt_shared_stl {
|
|
|
|
name: "ndk_libc++_shared",
|
|
|
|
}
|
2020-12-04 17:02:13 +08:00
|
|
|
|
|
|
|
cc_library_static {
|
|
|
|
name: "libgoogle-benchmark",
|
|
|
|
sdk_version: "current",
|
|
|
|
stl: "none",
|
|
|
|
system_shared_libs: [],
|
|
|
|
}
|
2020-02-16 03:00:10 +08:00
|
|
|
`
|
|
|
|
|
2020-07-11 11:33:29 +08:00
|
|
|
supportLinuxBionic := false
|
2020-03-02 18:16:35 +08:00
|
|
|
for _, os := range oses {
|
|
|
|
if os == android.Fuchsia {
|
|
|
|
ret += `
|
2019-02-08 20:00:45 +08:00
|
|
|
cc_library {
|
|
|
|
name: "libbioniccompat",
|
|
|
|
stl: "none",
|
|
|
|
}
|
|
|
|
cc_library {
|
|
|
|
name: "libcompiler_rt",
|
|
|
|
stl: "none",
|
|
|
|
}
|
|
|
|
`
|
2020-03-02 18:16:35 +08:00
|
|
|
}
|
|
|
|
if os == android.Windows {
|
|
|
|
ret += `
|
|
|
|
toolchain_library {
|
|
|
|
name: "libwinpthread",
|
|
|
|
host_supported: true,
|
|
|
|
enabled: false,
|
|
|
|
target: {
|
|
|
|
windows: {
|
|
|
|
enabled: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
src: "",
|
|
|
|
}
|
|
|
|
`
|
|
|
|
}
|
2020-07-11 11:33:29 +08:00
|
|
|
if os == android.LinuxBionic {
|
|
|
|
supportLinuxBionic = true
|
|
|
|
ret += `
|
|
|
|
cc_binary {
|
|
|
|
name: "linker",
|
|
|
|
defaults: ["linux_bionic_supported"],
|
|
|
|
recovery_available: true,
|
|
|
|
stl: "none",
|
|
|
|
nocrt: true,
|
|
|
|
static_executable: true,
|
|
|
|
native_coverage: false,
|
|
|
|
system_shared_libs: [],
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_genrule {
|
|
|
|
name: "host_bionic_linker_flags",
|
|
|
|
host_supported: true,
|
|
|
|
device_supported: false,
|
|
|
|
target: {
|
|
|
|
host: {
|
|
|
|
enabled: false,
|
|
|
|
},
|
|
|
|
linux_bionic: {
|
|
|
|
enabled: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
out: ["linker.flags"],
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_defaults {
|
|
|
|
name: "linux_bionic_supported",
|
|
|
|
host_supported: true,
|
|
|
|
target: {
|
|
|
|
host: {
|
|
|
|
enabled: false,
|
|
|
|
},
|
|
|
|
linux_bionic: {
|
|
|
|
enabled: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
`
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if !supportLinuxBionic {
|
|
|
|
ret += `
|
|
|
|
cc_defaults {
|
|
|
|
name: "linux_bionic_supported",
|
|
|
|
}
|
|
|
|
`
|
2019-02-08 20:00:45 +08:00
|
|
|
}
|
2020-07-11 11:33:29 +08:00
|
|
|
|
2019-02-08 20:00:45 +08:00
|
|
|
return ret
|
|
|
|
}
|
2019-05-15 06:44:26 +08:00
|
|
|
|
2020-02-16 03:00:10 +08:00
|
|
|
func GatherRequiredFilesForTest(fs map[string][]byte) {
|
|
|
|
}
|
|
|
|
|
2019-12-14 12:41:13 +08:00
|
|
|
func TestConfig(buildDir string, os android.OsType, env map[string]string,
|
|
|
|
bp string, fs map[string][]byte) android.Config {
|
2019-05-15 06:44:26 +08:00
|
|
|
|
2019-12-14 12:41:13 +08:00
|
|
|
// add some modules that are required by the compiler and/or linker
|
|
|
|
bp = bp + GatherRequiredDepsForTest(os)
|
|
|
|
|
2020-06-08 08:02:48 +08:00
|
|
|
mockFS := map[string][]byte{}
|
2019-12-14 12:41:13 +08:00
|
|
|
|
2020-02-16 03:00:10 +08:00
|
|
|
GatherRequiredFilesForTest(mockFS)
|
|
|
|
|
2019-12-14 12:41:13 +08:00
|
|
|
for k, v := range fs {
|
|
|
|
mockFS[k] = v
|
|
|
|
}
|
|
|
|
|
|
|
|
var config android.Config
|
|
|
|
if os == android.Fuchsia {
|
|
|
|
config = android.TestArchConfigFuchsia(buildDir, env, bp, mockFS)
|
|
|
|
} else {
|
|
|
|
config = android.TestArchConfig(buildDir, env, bp, mockFS)
|
|
|
|
}
|
|
|
|
|
|
|
|
return config
|
|
|
|
}
|
|
|
|
|
2020-10-30 08:09:13 +08:00
|
|
|
func CreateTestContext(config android.Config) *android.TestContext {
|
|
|
|
ctx := android.NewTestArchContext(config)
|
2019-11-23 07:25:03 +08:00
|
|
|
ctx.RegisterModuleType("cc_fuzz", FuzzFactory)
|
|
|
|
ctx.RegisterModuleType("cc_test", TestFactory)
|
2020-06-06 05:26:16 +08:00
|
|
|
ctx.RegisterModuleType("cc_test_library", TestLibraryFactory)
|
2019-11-23 07:25:03 +08:00
|
|
|
ctx.RegisterModuleType("llndk_headers", llndkHeadersFactory)
|
|
|
|
ctx.RegisterModuleType("vendor_public_library", vendorPublicLibraryFactory)
|
|
|
|
ctx.RegisterModuleType("filegroup", android.FileGroupFactory)
|
|
|
|
ctx.RegisterModuleType("vndk_prebuilt_shared", VndkPrebuiltSharedFactory)
|
|
|
|
ctx.RegisterModuleType("vndk_libraries_txt", VndkLibrariesTxtFactory)
|
2020-09-07 18:53:31 +08:00
|
|
|
ctx.RegisterModuleType("vendor_snapshot_shared", VendorSnapshotSharedFactory)
|
Add cfi static libraries to vendor snapshot
CFI modules can't link against non-CFI static libraries, and vice versa.
So without capturing both CFI and non-CFI static libraries, vendor
modules won't be able to use CFI, which will be a critical security
hole.
This captures both CFI and non-CFI variants of all static libraries for
vendor snapshot, except for those whose cfi are explicitly disabled.
For example, suppose that "libfoo" is defined as follows.
cc_library_static {
name: "libfoo",
vendor_available: true,
}
As it doesn't have cfi disabled, two libraries "libfoo.a" and
"libfoo.cfi.a" will be captured. When installed, vendor snapshot module
for "libfoo" will look like:
vendor_snapshot_static {
name: "libfoo",
src: "libfoo.a",
cfi: {
src: "libfoo.cfi.a",
},
}
The build system will recognize the "cfi" property, and will create both
CFI and non-CFI variant, allowing any modules to link against "libfoo"
safely, no matter whether CFI is enabled or not.
Two clarification:
1) The reason why we don't create separate modules is that DepsMutator
runs before sanitize mutators. CFI and non-CFI variant of a library
should exist in a single module.
2) We can't capture CFI variant if the source module explicitly disables
cfi variant by specifying the following.
sanitize: {
cfi: false,
}
In this case, only non-CFI variant will be created for the vendor
snapshot module.
Bug: 65377115
Test: m dist vendor-snapshot && install && build against snapshot
Change-Id: Idbf3e3205d581800d6093c8d6cf6152374129ba4
2020-07-29 19:32:10 +08:00
|
|
|
ctx.RegisterModuleType("vendor_snapshot_static", VendorSnapshotStaticFactory)
|
2020-09-07 18:53:31 +08:00
|
|
|
ctx.RegisterModuleType("vendor_snapshot_binary", VendorSnapshotBinaryFactory)
|
2019-09-25 05:55:04 +08:00
|
|
|
ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators)
|
2020-07-30 23:04:17 +08:00
|
|
|
android.RegisterPrebuiltMutators(ctx)
|
2020-04-30 01:27:14 +08:00
|
|
|
RegisterRequiredBuildComponentsForTest(ctx)
|
2019-11-23 07:25:03 +08:00
|
|
|
ctx.RegisterSingletonType("vndk-snapshot", VndkSnapshotSingleton)
|
2019-11-15 08:59:12 +08:00
|
|
|
ctx.RegisterSingletonType("vendor-snapshot", VendorSnapshotSingleton)
|
2020-11-14 04:07:36 +08:00
|
|
|
ctx.RegisterSingletonType("recovery-snapshot", RecoverySnapshotSingleton)
|
2019-05-15 06:44:26 +08:00
|
|
|
|
|
|
|
return ctx
|
|
|
|
}
|