Merge changes Idbeb4819,Ifc02f9e5

* changes:
  Add dynamic_list property
  Split the x86 host toolchain into glibc and musl variants
This commit is contained in:
Colin Cross
2021-07-23 22:08:19 +00:00
committed by Gerrit Code Review
14 changed files with 343 additions and 18 deletions

View File

@@ -194,6 +194,9 @@ type BaseLinkerProperties struct {
// 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"`
@@ -366,6 +369,10 @@ func (linker *baseLinker) linkerDeps(ctx DepsContext, deps Deps) Deps {
indexList("libdl", deps.SystemSharedLibs) < indexList("libc", deps.SystemSharedLibs) {
ctx.PropertyErrorf("system_shared_libs", "libdl must be after libc")
}
} else if ctx.toolchain().Musl() {
if !Bool(linker.Properties.No_libcrt) && !ctx.header() {
deps.LateStaticLibs = append(deps.LateStaticLibs, config.BuiltinsRuntimeLibrary(ctx.toolchain()))
}
}
deps.LateSharedLibs = append(deps.LateSharedLibs, deps.SystemSharedLibs...)
@@ -453,7 +460,7 @@ func (linker *baseLinker) linkerFlags(ctx ModuleContext, flags Flags) Flags {
flags.Global.LdFlags = append(flags.Global.LdFlags, toolchain.Ldflags())
}
if !ctx.toolchain().Bionic() {
if !ctx.toolchain().Bionic() && ctx.Os() != android.LinuxMusl {
CheckBadHostLdlibs(ctx, "host_ldlibs", linker.Properties.Host_ldlibs)
flags.Local.LdFlags = append(flags.Local.LdFlags, linker.Properties.Host_ldlibs...)
@@ -538,6 +545,17 @@ func (linker *baseLinker) linkerFlags(ctx ModuleContext, flags Flags) Flags {
}
}
}
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