convert hidden visibility flag to feature
in bp2build. The context here is that `-fvisibility=default` should only be added for CFI if `-fvisibility=hidden` is not already specified. This will be achieved using toolchain features. Note that Soong itself never adds `-fvisibility=hidden`. This is only ever added in the `cflags` property of a bp file. Bug: 261733820 Test: Unit tests Change-Id: Ib821e8c30a9cd03d2929b4bd2e771bec7b33fa66
This commit is contained in:
@@ -996,3 +996,44 @@ func TestCcBinaryWithThinLtoAndWholeProgramVtables(t *testing.T) {
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestCcBinaryHiddenVisibilityConvertedToFeature(t *testing.T) {
|
||||
runCcBinaryTestCase(t, ccBinaryBp2buildTestCase{
|
||||
description: "cc_binary changes hidden visibility to feature",
|
||||
blueprint: `
|
||||
{rule_name} {
|
||||
name: "foo",
|
||||
cflags: ["-fvisibility=hidden"],
|
||||
}`,
|
||||
targets: []testBazelTarget{
|
||||
{"cc_binary", "foo", AttrNameToString{
|
||||
"local_includes": `["."]`,
|
||||
"features": `["visibility_hidden"]`,
|
||||
}},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestCcBinaryHiddenVisibilityConvertedToFeatureOsSpecific(t *testing.T) {
|
||||
runCcBinaryTestCase(t, ccBinaryBp2buildTestCase{
|
||||
description: "cc_binary changes hidden visibility to feature for specific os",
|
||||
blueprint: `
|
||||
{rule_name} {
|
||||
name: "foo",
|
||||
target: {
|
||||
android: {
|
||||
cflags: ["-fvisibility=hidden"],
|
||||
},
|
||||
},
|
||||
}`,
|
||||
targets: []testBazelTarget{
|
||||
{"cc_binary", "foo", AttrNameToString{
|
||||
"local_includes": `["."]`,
|
||||
"features": `select({
|
||||
"//build/bazel/platforms/os:android": ["visibility_hidden"],
|
||||
"//conditions:default": [],
|
||||
})`,
|
||||
}},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user