Handle the version_script property.

Doesn't work when depends on arch/target/etc., but good enough for
libdl_android.

Bug: 186650430
Test: Presubmits.
Change-Id: Ib0facb41a89454717c74663e5e078aedd33d1b9c
This commit is contained in:
Lukacs T. Berki
2021-04-30 15:35:09 +02:00
parent f794e8269d
commit 1353e59690
7 changed files with 62 additions and 9 deletions

View File

@@ -246,15 +246,17 @@ func bp2BuildParseCompilerProps(ctx android.TopDownMutatorContext, module *Modul
// Convenience struct to hold all attributes parsed from linker properties.
type linkerAttributes struct {
deps bazel.LabelListAttribute
linkopts bazel.StringListAttribute
deps bazel.LabelListAttribute
linkopts bazel.StringListAttribute
versionScript bazel.LabelAttribute
}
// bp2BuildParseLinkerProps creates a label list attribute containing the header library deps of a module, including
// bp2BuildParseLinkerProps parses the linker properties of a module, including
// configurable attribute values.
func bp2BuildParseLinkerProps(ctx android.TopDownMutatorContext, module *Module) linkerAttributes {
var deps bazel.LabelListAttribute
var linkopts bazel.StringListAttribute
var versionScript bazel.LabelAttribute
for _, linkerProps := range module.linker.linkerProps() {
if baseLinkerProps, ok := linkerProps.(*BaseLinkerProperties); ok {
@@ -265,6 +267,12 @@ func bp2BuildParseLinkerProps(ctx android.TopDownMutatorContext, module *Module)
libs = android.SortedUniqueStrings(libs)
deps = bazel.MakeLabelListAttribute(android.BazelLabelForModuleDeps(ctx, libs))
linkopts.Value = baseLinkerProps.Ldflags
if baseLinkerProps.Version_script != nil {
versionScript = bazel.LabelAttribute{
Value: android.BazelLabelForModuleSrcSingle(ctx, *baseLinkerProps.Version_script),
}
}
break
}
}
@@ -294,8 +302,9 @@ func bp2BuildParseLinkerProps(ctx android.TopDownMutatorContext, module *Module)
}
return linkerAttributes{
deps: deps,
linkopts: linkopts,
deps: deps,
linkopts: linkopts,
versionScript: versionScript,
}
}