Add dynamic_list property

Add a dynamic_list property that is similar to version_script but uses
a -Wl,--dynamic-list flag instead of -Wl,--version-script.

Bug: 190084016
Test: TestLibraryDynamicList
Change-Id: Idbeb4819ce4d92e50c4e9b27ec8f150d566d380a
This commit is contained in:
Colin Cross
2021-07-22 16:35:24 -07:00
parent 4fb4ef2242
commit 5942238966
2 changed files with 48 additions and 0 deletions

View File

@@ -201,6 +201,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"`
@@ -561,6 +564,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