Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e0a73183 authored by Yu Liu's avatar Yu Liu Committed by Gerrit Code Review
Browse files

Merge "Add CFI flags to Compile Action"

parents 921292b1 f1836e47
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -64,13 +64,14 @@ var (

	cfiBlocklistPath     = "external/compiler-rt/lib/cfi"
	cfiBlocklistFilename = "cfi_blocklist.txt"
	cfiEnableFlag        = "-fsanitize=cfi"
	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", cfiCrossDsoFlag, "-fsanitize=cfi",
	cfiLdflags = []string{"-flto", cfiCrossDsoFlag, cfiEnableFlag,
		"-Wl,-plugin-opt,O1"}
	cfiExportsMapPath      = "build/soong/cc/config"
	cfiExportsMapFilename  = "cfi_exports.map"
@@ -395,8 +396,8 @@ func init() {

	// Leave out "-flto" from the slices exported to bazel, as we will use the
	// 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:])
	// out the cross DSO flag which will be added separately under the correct conditions.
	exportedVars.ExportStringList("CfiCFlags", append(cfiCflags[2:], cfiEnableFlag))
	exportedVars.ExportStringList("CfiLdFlags", cfiLdflags[2:])
	exportedVars.ExportStringList("CfiAsFlags", cfiAsflags[1:])