summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Trevor Radcliffe <tradical@google.com> 2023-04-12 20:59:29 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2023-04-12 20:59:29 +0000
commita6784dd6979c7934575002885f6f48dabb03c28d (patch)
tree79c70d0ab96ce98025dada525ab060ec2d9e636f
parent1bb463e31fabc093fcb6231f7363cb1e314d0db1 (diff)
parentd090c16d926f9b70678acc47f6f1c395b0e95635 (diff)
Merge "Separate out Cross DSO flag for Bazel" am: 2a1de1bfe6 am: 30f93466e4 am: d090c16d92
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2525199 Change-Id: I10db56d4b39a930c723ce25a5dfcc9b93e931da3 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--cc/sanitize.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/cc/sanitize.go b/cc/sanitize.go
index f19659cc7..c478e58f9 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -64,12 +64,13 @@ var (
cfiBlocklistPath = "external/compiler-rt/lib/cfi"
cfiBlocklistFilename = "cfi_blocklist.txt"
- cfiCflags = []string{"-flto", "-fsanitize-cfi-cross-dso",
+ cfiCrossDsoFlag = "-fsanitize-cfi-cross-dso"
+ cfiCflags = []string{"-flto", cfiCrossDsoFlag,
"-fsanitize-ignorelist=" + cfiBlocklistPath + "/" + cfiBlocklistFilename}
// -flto and -fvisibility are required by clang when -fsanitize=cfi is
// used, but have no effect on assembly files
cfiAsflags = []string{"-flto", "-fvisibility=default"}
- cfiLdflags = []string{"-flto", "-fsanitize-cfi-cross-dso", "-fsanitize=cfi",
+ cfiLdflags = []string{"-flto", cfiCrossDsoFlag, "-fsanitize=cfi",
"-Wl,-plugin-opt,O1"}
cfiExportsMapPath = "build/soong/cc/config"
cfiExportsMapFilename = "cfi_exports.map"
@@ -393,11 +394,13 @@ func init() {
exportedVars.ExportStringList("DeviceOnlySanitizeFlags", deviceOnlySanitizeFlags)
// Leave out "-flto" from the slices exported to bazel, as we will use the
- // dedicated LTO feature for this
- exportedVars.ExportStringList("CfiCFlags", cfiCflags[1:])
+ // dedicated LTO feature for this. For C Flags and Linker Flags, also leave
+ // out the cross DSO flag which will be added separately by transitions.
+ exportedVars.ExportStringList("CfiCFlags", cfiCflags[2:])
+ exportedVars.ExportStringList("CfiLdFlags", cfiLdflags[2:])
exportedVars.ExportStringList("CfiAsFlags", cfiAsflags[1:])
- exportedVars.ExportStringList("CfiLdFlags", cfiLdflags[1:])
+ exportedVars.ExportString("CfiCrossDsoFlag", cfiCrossDsoFlag)
exportedVars.ExportString("CfiBlocklistPath", cfiBlocklistPath)
exportedVars.ExportString("CfiBlocklistFilename", cfiBlocklistFilename)
exportedVars.ExportString("CfiExportsMapPath", cfiExportsMapPath)