CFI Versionscript changes in bp2build
Bug: 261733820 Test: Unit Tests Change-Id: I0bf2f42944738c0fefb10e59e859d2af44402792
This commit is contained in:
parent
3daa129afa
commit
f06dd91420
4 changed files with 17 additions and 2 deletions
|
@ -222,6 +222,7 @@ func TestCcBinaryVersionScriptAndDynamicList(t *testing.T) {
|
||||||
"-Wl,--version-script,$(location vs)",
|
"-Wl,--version-script,$(location vs)",
|
||||||
"-Wl,--dynamic-list,$(location dynamic.list)",
|
"-Wl,--dynamic-list,$(location dynamic.list)",
|
||||||
]`,
|
]`,
|
||||||
|
"features": `["android_cfi_exports_map"]`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -249,6 +250,7 @@ func TestCcBinaryLdflagsSplitBySpaceExceptSoongAdded(t *testing.T) {
|
||||||
"version_script",
|
"version_script",
|
||||||
"dynamic.list",
|
"dynamic.list",
|
||||||
]`,
|
]`,
|
||||||
|
"features": `["android_cfi_exports_map"]`,
|
||||||
"linkopts": `[
|
"linkopts": `[
|
||||||
"--nospace_flag",
|
"--nospace_flag",
|
||||||
"-z",
|
"-z",
|
||||||
|
|
|
@ -900,7 +900,8 @@ cc_library {
|
||||||
"-Wl,--version-script,$(location v.map)",
|
"-Wl,--version-script,$(location v.map)",
|
||||||
"-Wl,--dynamic-list,$(location dynamic.list)",
|
"-Wl,--dynamic-list,$(location dynamic.list)",
|
||||||
]`,
|
]`,
|
||||||
"srcs": `["a.cpp"]`,
|
"srcs": `["a.cpp"]`,
|
||||||
|
"features": `["android_cfi_exports_map"]`,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -958,6 +959,11 @@ cc_library {
|
||||||
"//conditions:default": [],
|
"//conditions:default": [],
|
||||||
})`,
|
})`,
|
||||||
"srcs": `["a.cpp"]`,
|
"srcs": `["a.cpp"]`,
|
||||||
|
"features": `select({
|
||||||
|
"//build/bazel/platforms/arch:arm": ["android_cfi_exports_map"],
|
||||||
|
"//build/bazel/platforms/arch:arm64": ["android_cfi_exports_map"],
|
||||||
|
"//conditions:default": [],
|
||||||
|
})`,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -985,12 +991,15 @@ cc_library {
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
ExpectedBazelTargets: []string{
|
ExpectedBazelTargets: []string{
|
||||||
MakeBazelTarget("cc_library_static", "foo_bp2build_cc_library_static", AttrNameToString{}),
|
MakeBazelTarget("cc_library_static", "foo_bp2build_cc_library_static", AttrNameToString{
|
||||||
|
"features": `["android_cfi_exports_map"]`,
|
||||||
|
}),
|
||||||
MakeBazelTarget("cc_library_shared", "foo", AttrNameToString{
|
MakeBazelTarget("cc_library_shared", "foo", AttrNameToString{
|
||||||
"additional_linker_inputs": `[
|
"additional_linker_inputs": `[
|
||||||
"version_script",
|
"version_script",
|
||||||
"dynamic.list",
|
"dynamic.list",
|
||||||
]`,
|
]`,
|
||||||
|
"features": `["android_cfi_exports_map"]`,
|
||||||
"linkopts": `[
|
"linkopts": `[
|
||||||
"--nospace_flag",
|
"--nospace_flag",
|
||||||
"-z",
|
"-z",
|
||||||
|
|
|
@ -362,6 +362,7 @@ cc_library_shared {
|
||||||
"-Wl,--version-script,$(location version_script)",
|
"-Wl,--version-script,$(location version_script)",
|
||||||
"-Wl,--dynamic-list,$(location dynamic.list)",
|
"-Wl,--dynamic-list,$(location dynamic.list)",
|
||||||
]`,
|
]`,
|
||||||
|
"features": `["android_cfi_exports_map"]`,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -398,6 +399,7 @@ cc_library_shared {
|
||||||
"-Wl,--version-script,$(location version_script)",
|
"-Wl,--version-script,$(location version_script)",
|
||||||
"-Wl,--dynamic-list,$(location dynamic.list)",
|
"-Wl,--dynamic-list,$(location dynamic.list)",
|
||||||
]`,
|
]`,
|
||||||
|
"features": `["android_cfi_exports_map"]`,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -913,6 +915,7 @@ func TestCCLibraryFlagSpaceSplitting(t *testing.T) {
|
||||||
"header.h",
|
"header.h",
|
||||||
]`,
|
]`,
|
||||||
"linkopts": `["-Wl,--version-script,$(location version_script)"]`,
|
"linkopts": `["-Wl,--version-script,$(location version_script)"]`,
|
||||||
|
"features": `["android_cfi_exports_map"]`,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
@ -1257,6 +1257,7 @@ func (la *linkerAttributes) bp2buildForAxisAndConfig(ctx android.BazelConversion
|
||||||
label := android.BazelLabelForModuleSrcSingle(ctx, *props.Version_script)
|
label := android.BazelLabelForModuleSrcSingle(ctx, *props.Version_script)
|
||||||
additionalLinkerInputs.Add(&label)
|
additionalLinkerInputs.Add(&label)
|
||||||
linkerFlags = append(linkerFlags, fmt.Sprintf("-Wl,--version-script,$(location %s)", label.Label))
|
linkerFlags = append(linkerFlags, fmt.Sprintf("-Wl,--version-script,$(location %s)", label.Label))
|
||||||
|
axisFeatures = append(axisFeatures, "android_cfi_exports_map")
|
||||||
}
|
}
|
||||||
|
|
||||||
if props.Dynamic_list != nil {
|
if props.Dynamic_list != nil {
|
||||||
|
|
Loading…
Reference in a new issue