Merge "Revert "Split the x86 host toolchain into glibc and musl variants""
diff --git a/android/module.go b/android/module.go
index 5f34e62..84e78d1 100644
--- a/android/module.go
+++ b/android/module.go
@@ -2389,8 +2389,7 @@
if !b.BazelConversionMode() {
panic("cannot call ModuleFromName if not in bazel conversion mode")
}
- if len(name) > 1 && (name[0] == ':' || (name[0] == '/' && name[1] == '/')) {
- moduleName, _ := SrcIsModuleWithTag(name)
+ if moduleName, _ := SrcIsModuleWithTag(name); moduleName != "" {
return b.bp.ModuleFromName(moduleName)
} else {
return b.bp.ModuleFromName(name)
diff --git a/bp2build/cc_object_conversion_test.go b/bp2build/cc_object_conversion_test.go
index df4924b..9ac28a5 100644
--- a/bp2build/cc_object_conversion_test.go
+++ b/bp2build/cc_object_conversion_test.go
@@ -46,7 +46,7 @@
blueprint: `cc_object {
name: "foo",
local_include_dirs: ["include"],
- default_shared_libs: [],
+ system_shared_libs: [],
cflags: [
"-Wno-gcc-compat",
"-Wall",
@@ -84,7 +84,7 @@
moduleTypeUnderTestBp2BuildMutator: cc.ObjectBp2Build,
blueprint: `cc_object {
name: "foo",
- default_shared_libs: [],
+ system_shared_libs: [],
local_include_dirs: ["include"],
srcs: [
"a/b/*.h",
@@ -137,14 +137,14 @@
},
blueprint: `cc_object {
name: "foo",
- default_shared_libs: [],
+ system_shared_libs: [],
srcs: ["a/b/c.c"],
objs: ["bar"],
}
cc_object {
name: "bar",
- default_shared_libs: [],
+ system_shared_libs: [],
srcs: ["x/y/z.c"],
}
`,
@@ -182,7 +182,7 @@
},
blueprint: `cc_object {
name: "foo",
- default_shared_libs: [],
+ system_shared_libs: [],
srcs: ["a/b/c.c"],
include_build_directory: false,
}
@@ -204,7 +204,7 @@
moduleTypeUnderTestBp2BuildMutator: cc.ObjectBp2Build,
blueprint: `cc_object {
name: "foo",
- default_shared_libs: [],
+ system_shared_libs: [],
include_build_directory: false,
product_variables: {
platform_sdk_version: {
@@ -235,7 +235,7 @@
moduleTypeUnderTestBp2BuildMutator: cc.ObjectBp2Build,
blueprint: `cc_object {
name: "foo",
- default_shared_libs: [],
+ system_shared_libs: [],
srcs: ["a.cpp"],
arch: {
x86: {
@@ -275,7 +275,7 @@
moduleTypeUnderTestBp2BuildMutator: cc.ObjectBp2Build,
blueprint: `cc_object {
name: "foo",
- default_shared_libs: [],
+ system_shared_libs: [],
srcs: ["base.cpp"],
arch: {
x86: {
@@ -331,7 +331,7 @@
moduleTypeUnderTestBp2BuildMutator: cc.ObjectBp2Build,
blueprint: `cc_object {
name: "foo",
- default_shared_libs: [],
+ system_shared_libs: [],
srcs: ["base.cpp"],
target: {
android: {
diff --git a/cc/cc.go b/cc/cc.go
index e3ca4d7..7aec7f2 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -554,8 +554,7 @@
sharedLibs []string
// Note nil and [] are semantically distinct. [] prevents linking against the defaults (usually
// libc, libm, etc.)
- systemSharedLibs []string
- defaultSharedLibs []string
+ systemSharedLibs []string
}
// installer is the interface for an installer helper object. This helper is responsible for
diff --git a/cc/config/vndk.go b/cc/config/vndk.go
index 425e349..112e5a6 100644
--- a/cc/config/vndk.go
+++ b/cc/config/vndk.go
@@ -62,6 +62,7 @@
"android.system.keystore2-V1-ndk_platform",
"android.system.keystore2-ndk_platform",
"android.system.keystore2-unstable-ndk_platform",
+ "android.system.suspend-V1-ndk_platform",
"libbinder",
"libcrypto",
"libexpat",
diff --git a/cc/library.go b/cc/library.go
index 56c460c..8f302fc 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -147,12 +147,11 @@
Cflags []string `android:"arch_variant"`
- Enabled *bool `android:"arch_variant"`
- Whole_static_libs []string `android:"arch_variant"`
- Static_libs []string `android:"arch_variant"`
- Shared_libs []string `android:"arch_variant"`
- System_shared_libs []string `android:"arch_variant"`
- Default_shared_libs []string `android:"arch_variant"`
+ Enabled *bool `android:"arch_variant"`
+ Whole_static_libs []string `android:"arch_variant"`
+ Static_libs []string `android:"arch_variant"`
+ Shared_libs []string `android:"arch_variant"`
+ System_shared_libs []string `android:"arch_variant"`
Export_shared_lib_headers []string `android:"arch_variant"`
Export_static_lib_headers []string `android:"arch_variant"`
@@ -1163,17 +1162,11 @@
if library.StaticProperties.Static.System_shared_libs != nil {
library.baseLinker.Properties.System_shared_libs = library.StaticProperties.Static.System_shared_libs
}
- if library.StaticProperties.Static.Default_shared_libs != nil {
- library.baseLinker.Properties.Default_shared_libs = library.StaticProperties.Static.Default_shared_libs
- }
} else if library.shared() {
// Compare with nil because an empty list needs to be propagated.
if library.SharedProperties.Shared.System_shared_libs != nil {
library.baseLinker.Properties.System_shared_libs = library.SharedProperties.Shared.System_shared_libs
}
- if library.SharedProperties.Shared.Default_shared_libs != nil {
- library.baseLinker.Properties.Default_shared_libs = library.SharedProperties.Shared.Default_shared_libs
- }
}
deps = library.baseLinker.linkerDeps(ctx, deps)
@@ -1255,11 +1248,6 @@
} else {
specifiedDeps.systemSharedLibs = append(specifiedDeps.systemSharedLibs, properties.System_shared_libs...)
}
- if specifiedDeps.defaultSharedLibs == nil {
- specifiedDeps.defaultSharedLibs = properties.Default_shared_libs
- } else {
- specifiedDeps.defaultSharedLibs = append(specifiedDeps.defaultSharedLibs, properties.Default_shared_libs...)
- }
specifiedDeps.sharedLibs = android.FirstUniqueStrings(specifiedDeps.sharedLibs)
if len(specifiedDeps.systemSharedLibs) > 0 {
@@ -1267,11 +1255,6 @@
// retained.
specifiedDeps.systemSharedLibs = android.FirstUniqueStrings(specifiedDeps.systemSharedLibs)
}
- if len(specifiedDeps.defaultSharedLibs) > 0 {
- // Skip this if defaultSharedLibs is either nil or [], to ensure they are
- // retained.
- specifiedDeps.defaultSharedLibs = android.FirstUniqueStrings(specifiedDeps.defaultSharedLibs)
- }
return specifiedDeps
}
diff --git a/cc/library_sdk_member.go b/cc/library_sdk_member.go
index 9ad2742..9010a1a 100644
--- a/cc/library_sdk_member.go
+++ b/cc/library_sdk_member.go
@@ -258,12 +258,6 @@
outputProperties.AddPropertyWithTag("system_shared_libs", libInfo.SystemSharedLibs, builder.SdkMemberReferencePropertyTag(false))
}
- // SystemSharedLibs needs to be propagated if it's a list, even if it's empty,
- // so check for non-nil instead of nonzero length.
- if libInfo.DefaultSharedLibs != nil {
- outputProperties.AddPropertyWithTag("default_shared_libs", libInfo.DefaultSharedLibs, builder.SdkMemberReferencePropertyTag(false))
- }
-
// Map from property name to the include dirs to add to the prebuilt module in the snapshot.
includeDirs := make(map[string][]string)
@@ -393,12 +387,6 @@
// This field is exported as its contents may not be arch specific.
SystemSharedLibs []string `android:"arch_variant"`
- // The set of default shared libraries. Note nil and [] are semantically
- // distinct - see BaseLinkerProperties.Default_shared_libs.
- //
- // This field is exported as its contents may not be arch specific.
- DefaultSharedLibs []string `android:"arch_variant"`
-
// The specific stubs version for the lib variant, or empty string if stubs
// are not in use.
//
@@ -474,7 +462,6 @@
}
}
p.SystemSharedLibs = specifiedDeps.systemSharedLibs
- p.DefaultSharedLibs = specifiedDeps.defaultSharedLibs
}
p.ExportedGeneratedHeaders = exportedInfo.GeneratedHeaders
diff --git a/cc/library_test.go b/cc/library_test.go
index ba372a8..6b349b6 100644
--- a/cc/library_test.go
+++ b/cc/library_test.go
@@ -286,3 +286,37 @@
gotFlags := entries.EntryMap["LOCAL_EXPORT_CFLAGS"]
android.AssertDeepEquals(t, "androidmk exported cflags", expectedFlags, gotFlags)
}
+
+func TestLibraryVersionScript(t *testing.T) {
+ result := PrepareForIntegrationTestWithCc.RunTestWithBp(t, `
+ cc_library {
+ name: "libfoo",
+ srcs: ["foo.c"],
+ version_script: "foo.map.txt",
+ }`)
+
+ libfoo := result.ModuleForTests("libfoo", "android_arm64_armv8-a_shared").Rule("ld")
+
+ android.AssertStringListContains(t, "missing dependency on version_script",
+ libfoo.Implicits.Strings(), "foo.map.txt")
+ android.AssertStringDoesContain(t, "missing flag for version_script",
+ libfoo.Args["ldFlags"], "-Wl,--version-script,foo.map.txt")
+
+}
+
+func TestLibraryDynamicList(t *testing.T) {
+ result := PrepareForIntegrationTestWithCc.RunTestWithBp(t, `
+ cc_library {
+ name: "libfoo",
+ srcs: ["foo.c"],
+ dynamic_list: "foo.dynamic.txt",
+ }`)
+
+ libfoo := result.ModuleForTests("libfoo", "android_arm64_armv8-a_shared").Rule("ld")
+
+ android.AssertStringListContains(t, "missing dependency on dynamic_list",
+ libfoo.Implicits.Strings(), "foo.dynamic.txt")
+ android.AssertStringDoesContain(t, "missing flag for dynamic_list",
+ libfoo.Args["ldFlags"], "-Wl,--dynamic-list,foo.dynamic.txt")
+
+}
diff --git a/cc/linker.go b/cc/linker.go
index 82449a6..5dd757a 100644
--- a/cc/linker.go
+++ b/cc/linker.go
@@ -46,18 +46,11 @@
// list of module-specific flags that will be used for all link steps
Ldflags []string `android:"arch_variant"`
- // list of system libraries that will be dynamically linked to shared library and executable
- // modules that build against bionic (device or Linux bionic modules). If unset, generally
- // defaults to libc, libm, and libdl. Set to [] to prevent linking against the defaults.
- // Equivalent to default_shared_libs for modules that build against bionic, and ignored on
- // modules that do not build against bionic.
+ // list of system libraries that will be dynamically linked to
+ // shared library and executable modules. If unset, generally defaults to libc,
+ // libm, and libdl. Set to [] to prevent linking against the defaults.
System_shared_libs []string `android:"arch_variant"`
- // list of system libraries that will be dynamically linked to shared library and executable
- // modules. If unset, generally defaults to libc, libm, and libdl. Set to [] to prevent
- // linking against the defaults. Equivalent to system_shared_libs, but applies to all modules.
- Default_shared_libs []string `android:"arch_variant"`
-
// allow the module to contain undefined symbols. By default,
// modules cannot contain undefined symbols that are not satisified by their immediate
// dependencies. Set this flag to true to remove --no-undefined from the linker flags.
@@ -201,6 +194,9 @@
// local file name to pass to the linker as --version_script
Version_script *string `android:"path,arch_variant"`
+ // local file name to pass to the linker as --dynamic-list
+ Dynamic_list *string `android:"path,arch_variant"`
+
// list of static libs that should not be used to build this module
Exclude_static_libs []string `android:"arch_variant"`
@@ -239,18 +235,6 @@
linker.Properties.Ldflags = append(linker.Properties.Ldflags, flags...)
}
-// overrideDefaultSharedLibraries returns the contents of the default_shared_libs or
-// system_shared_libs properties, and records an error if both are set.
-func (linker *baseLinker) overrideDefaultSharedLibraries(ctx BaseModuleContext) []string {
- if linker.Properties.System_shared_libs != nil && linker.Properties.Default_shared_libs != nil {
- ctx.PropertyErrorf("system_shared_libs", "cannot be specified if default_shared_libs is also specified")
- }
- if linker.Properties.System_shared_libs != nil {
- return linker.Properties.System_shared_libs
- }
- return linker.Properties.Default_shared_libs
-}
-
// linkerInit initializes dynamic properties of the linker (such as runpath).
func (linker *baseLinker) linkerInit(ctx BaseModuleContext) {
if ctx.toolchain().Is64Bit() {
@@ -351,13 +335,13 @@
deps.SharedLibs = append(deps.SharedLibs, linker.Properties.Target.Platform.Shared_libs...)
}
- deps.SystemSharedLibs = linker.overrideDefaultSharedLibraries(ctx)
+ deps.SystemSharedLibs = linker.Properties.System_shared_libs
// In Bazel conversion mode, variations have not been specified, so SystemSharedLibs may
// inaccuarately appear unset, which can cause issues with circular dependencies.
if deps.SystemSharedLibs == nil && !ctx.BazelConversionMode() {
- // Provide a default set of shared libraries if default_shared_libs and system_shared_libs
- // are unspecified. Note: If an empty list [] is specified, it implies that the module
- // declines the default shared libraries.
+ // Provide a default system_shared_libs if it is unspecified. Note: If an
+ // empty list [] is specified, it implies that the module declines the
+ // default system_shared_libs.
deps.SystemSharedLibs = append(deps.SystemSharedLibs, ctx.toolchain().DefaultSharedLibraries()...)
}
@@ -557,6 +541,17 @@
}
}
}
+
+ dynamicList := android.OptionalPathForModuleSrc(ctx, linker.Properties.Dynamic_list)
+ if dynamicList.Valid() {
+ if ctx.Darwin() {
+ ctx.PropertyErrorf("dynamic_list", "Not supported on Darwin")
+ } else {
+ flags.Local.LdFlags = append(flags.Local.LdFlags,
+ "-Wl,--dynamic-list,"+dynamicList.String())
+ flags.LdFlagsDeps = append(flags.LdFlagsDeps, dynamicList.Path())
+ }
+ }
}
return flags
@@ -577,11 +572,6 @@
} else {
specifiedDeps.systemSharedLibs = append(specifiedDeps.systemSharedLibs, linker.Properties.System_shared_libs...)
}
- if specifiedDeps.defaultSharedLibs == nil {
- specifiedDeps.defaultSharedLibs = linker.Properties.Default_shared_libs
- } else {
- specifiedDeps.defaultSharedLibs = append(specifiedDeps.defaultSharedLibs, linker.Properties.Default_shared_libs...)
- }
return specifiedDeps
}
diff --git a/cc/object.go b/cc/object.go
index 0f983c8..bd9f228 100644
--- a/cc/object.go
+++ b/cc/object.go
@@ -78,7 +78,7 @@
// list of default libraries that will provide headers for this module. If unset, generally
// defaults to libc, libm, and libdl. Set to [] to prevent using headers from the defaults.
- Default_shared_libs []string `android:"arch_variant"`
+ System_shared_libs []string `android:"arch_variant"`
// names of other cc_object modules to link into this module using partial linking
Objs []string `android:"arch_variant"`
@@ -219,9 +219,9 @@
deps.StaticLibs = append(deps.StaticLibs, object.Properties.Static_libs...)
deps.ObjFiles = append(deps.ObjFiles, object.Properties.Objs...)
- deps.SystemSharedLibs = object.Properties.Default_shared_libs
+ deps.SystemSharedLibs = object.Properties.System_shared_libs
if deps.SystemSharedLibs == nil {
- // Provide a default set of shared libraries if default_shared_libs is unspecified.
+ // Provide a default set of shared libraries if system_shared_libs is unspecified.
// Note: If an empty list [] is specified, it implies that the module declines the
// default shared libraries.
deps.SystemSharedLibs = append(deps.SystemSharedLibs, ctx.toolchain().DefaultSharedLibraries()...)
@@ -278,12 +278,12 @@
func (object *objectLinker) linkerSpecifiedDeps(specifiedDeps specifiedDeps) specifiedDeps {
specifiedDeps.sharedLibs = append(specifiedDeps.sharedLibs, object.Properties.Shared_libs...)
- // Must distinguish nil and [] in default_shared_libs - ensure that [] in
+ // Must distinguish nil and [] in system_shared_libs - ensure that [] in
// either input list doesn't come out as nil.
- if specifiedDeps.defaultSharedLibs == nil {
- specifiedDeps.defaultSharedLibs = object.Properties.Default_shared_libs
+ if specifiedDeps.systemSharedLibs == nil {
+ specifiedDeps.systemSharedLibs = object.Properties.System_shared_libs
} else {
- specifiedDeps.defaultSharedLibs = append(specifiedDeps.defaultSharedLibs, object.Properties.Default_shared_libs...)
+ specifiedDeps.systemSharedLibs = append(specifiedDeps.systemSharedLibs, object.Properties.System_shared_libs...)
}
return specifiedDeps
diff --git a/cc/testing.go b/cc/testing.go
index 19513e3..59e8497 100644
--- a/cc/testing.go
+++ b/cc/testing.go
@@ -365,7 +365,7 @@
stl: "none",
min_sdk_version: "16",
crt: true,
- default_shared_libs: [],
+ system_shared_libs: [],
apex_available: [
"//apex_available:platform",
"//apex_available:anyapex",
diff --git a/rust/config/global.go b/rust/config/global.go
index 1b56237..39ed992 100644
--- a/rust/config/global.go
+++ b/rust/config/global.go
@@ -24,7 +24,7 @@
var pctx = android.NewPackageContext("android/soong/rust/config")
var (
- RustDefaultVersion = "1.51.0"
+ RustDefaultVersion = "1.52.1"
RustDefaultBase = "prebuilts/rust/"
DefaultEdition = "2018"
Stdlibs = []string{
diff --git a/rust/rust.go b/rust/rust.go
index 931cb9d..80be496 100644
--- a/rust/rust.go
+++ b/rust/rust.go
@@ -861,6 +861,8 @@
if mod.installable(apexInfo) {
mod.compiler.install(ctx)
}
+
+ ctx.Phony("rust", ctx.RustModule().OutputFile().Path())
}
}
diff --git a/sdk/cc_sdk_test.go b/sdk/cc_sdk_test.go
index 60fbccf..25e35fc 100644
--- a/sdk/cc_sdk_test.go
+++ b/sdk/cc_sdk_test.go
@@ -347,7 +347,7 @@
cc_object {
name: "crtobj",
stl: "none",
- default_shared_libs: [],
+ system_shared_libs: [],
sanitize: {
never: true,
},
@@ -365,7 +365,7 @@
apex_available: ["//apex_available:platform"],
stl: "none",
compile_multilib: "both",
- default_shared_libs: [],
+ system_shared_libs: [],
sanitize: {
never: true,
},
@@ -390,7 +390,7 @@
apex_available: ["//apex_available:platform"],
stl: "none",
compile_multilib: "both",
- default_shared_libs: [],
+ system_shared_libs: [],
sanitize: {
never: true,
},
@@ -2192,7 +2192,7 @@
result := testSdkWithCc(t, `
sdk {
name: "mysdk",
- native_shared_libs: ["sslnil", "sslempty", "sslnonempty", "dslnil", "dslempty", "dslnonempty"],
+ native_shared_libs: ["sslnil", "sslempty", "sslnonempty"],
}
cc_library {
@@ -2209,21 +2209,6 @@
name: "sslnonempty",
system_shared_libs: ["sslnil"],
}
-
- cc_library {
- name: "dslnil",
- host_supported: true,
- }
-
- cc_library {
- name: "dslempty",
- default_shared_libs: [],
- }
-
- cc_library {
- name: "dslnonempty",
- default_shared_libs: ["sslnil"],
- }
`)
CheckSnapshot(t, result, "mysdk", "",
@@ -2279,62 +2264,13 @@
},
},
}
-
-cc_prebuilt_library_shared {
- name: "dslnil",
- prefer: false,
- visibility: ["//visibility:public"],
- apex_available: ["//apex_available:platform"],
- compile_multilib: "both",
- arch: {
- arm64: {
- srcs: ["arm64/lib/dslnil.so"],
- },
- arm: {
- srcs: ["arm/lib/dslnil.so"],
- },
- },
-}
-
-cc_prebuilt_library_shared {
- name: "dslempty",
- prefer: false,
- visibility: ["//visibility:public"],
- apex_available: ["//apex_available:platform"],
- compile_multilib: "both",
- default_shared_libs: [],
- arch: {
- arm64: {
- srcs: ["arm64/lib/dslempty.so"],
- },
- arm: {
- srcs: ["arm/lib/dslempty.so"],
- },
- },
-}
-
-cc_prebuilt_library_shared {
- name: "dslnonempty",
- prefer: false,
- visibility: ["//visibility:public"],
- apex_available: ["//apex_available:platform"],
- compile_multilib: "both",
- default_shared_libs: ["sslnil"],
- arch: {
- arm64: {
- srcs: ["arm64/lib/dslnonempty.so"],
- },
- arm: {
- srcs: ["arm/lib/dslnonempty.so"],
- },
- },
-}`))
+`))
result = testSdkWithCc(t, `
sdk {
name: "mysdk",
host_supported: true,
- native_shared_libs: ["sslvariants", "dslvariants"],
+ native_shared_libs: ["sslvariants"],
}
cc_library {
@@ -2346,16 +2282,6 @@
},
},
}
-
- cc_library {
- name: "dslvariants",
- host_supported: true,
- target: {
- android: {
- default_shared_libs: [],
- },
- },
- }
`)
CheckSnapshot(t, result, "mysdk", "",
@@ -2392,37 +2318,6 @@
},
},
}
-
-cc_prebuilt_library_shared {
- name: "dslvariants",
- prefer: false,
- visibility: ["//visibility:public"],
- apex_available: ["//apex_available:platform"],
- host_supported: true,
- compile_multilib: "both",
- target: {
- host: {
- enabled: false,
- },
- android: {
- default_shared_libs: [],
- },
- android_arm64: {
- srcs: ["android/arm64/lib/dslvariants.so"],
- },
- android_arm: {
- srcs: ["android/arm/lib/dslvariants.so"],
- },
- linux_glibc_x86_64: {
- enabled: true,
- srcs: ["linux_glibc/x86_64/lib/dslvariants.so"],
- },
- linux_glibc_x86: {
- enabled: true,
- srcs: ["linux_glibc/x86/lib/dslvariants.so"],
- },
- },
-}
`),
checkVersionedAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
@@ -2459,46 +2354,11 @@
},
}
-cc_prebuilt_library_shared {
- name: "mysdk_dslvariants@current",
- sdk_member_name: "dslvariants",
- visibility: ["//visibility:public"],
- apex_available: ["//apex_available:platform"],
- host_supported: true,
- installable: false,
- compile_multilib: "both",
- target: {
- host: {
- enabled: false,
- },
- android: {
- default_shared_libs: [],
- },
- android_arm64: {
- srcs: ["android/arm64/lib/dslvariants.so"],
- },
- android_arm: {
- srcs: ["android/arm/lib/dslvariants.so"],
- },
- linux_glibc_x86_64: {
- enabled: true,
- srcs: ["linux_glibc/x86_64/lib/dslvariants.so"],
- },
- linux_glibc_x86: {
- enabled: true,
- srcs: ["linux_glibc/x86/lib/dslvariants.so"],
- },
- },
-}
-
sdk_snapshot {
name: "mysdk@current",
visibility: ["//visibility:public"],
host_supported: true,
- native_shared_libs: [
- "mysdk_sslvariants@current",
- "mysdk_dslvariants@current",
- ],
+ native_shared_libs: ["mysdk_sslvariants@current"],
target: {
host: {
enabled: false,