aboutsummaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2018-03-28 14:50:27 -0700
committerColin Cross <ccross@android.com>2018-03-28 19:18:07 -0700
commitfe6edc9a70c9fa4551f4e793f89f380529f084cf (patch)
tree96574a2154e734c38c85ec5b2cacb663dc9940cf /cc
parent2e9f9a2220cd8f8e4096e6ac373436d5ba3f644e (diff)
downloadbuild_soong-fe6edc9a70c9fa4551f4e793f89f380529f084cf.tar.gz
build_soong-fe6edc9a70c9fa4551f4e793f89f380529f084cf.tar.bz2
build_soong-fe6edc9a70c9fa4551f4e793f89f380529f084cf.zip
Fix data race on cfiExportsMap
cfiExportsMap was reinitialized for every module, which caused data races. Create the path from the string on each use instead. Bug: 77234104 Test: m nothing with race detector turned on Change-Id: Ibca3149dcbe8a9d4d9f7ec6dd0b164697e7ae5cd Merged-In: Ibca3149dcbe8a9d4d9f7ec6dd0b164697e7ae5cd (cherry picked from commit 1218a19f0d2217500a1efa5fffde7465df2e4419)
Diffstat (limited to 'cc')
-rw-r--r--cc/library.go1
-rw-r--r--cc/sanitize.go3
2 files changed, 1 insertions, 3 deletions
diff --git a/cc/library.go b/cc/library.go
index 6fe9ca4e..4b2abaf2 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -532,6 +532,7 @@ func (library *libraryDecorator) linkShared(ctx ModuleContext,
flags.LdFlags = append(flags.LdFlags, "-Wl,--version-script,"+versionScript.String())
linkerDeps = append(linkerDeps, versionScript.Path())
if library.sanitize.isSanitizerEnabled(cfi) {
+ cfiExportsMap := android.PathForSource(ctx, cfiExportsMapPath)
flags.LdFlags = append(flags.LdFlags, "-Wl,--version-script,"+cfiExportsMap.String())
linkerDeps = append(linkerDeps, cfiExportsMap)
}
diff --git a/cc/sanitize.go b/cc/sanitize.go
index c47c3194..0bcbb125 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -39,7 +39,6 @@ var (
cfiLdflags = []string{"-flto", "-fsanitize-cfi-cross-dso", "-fsanitize=cfi",
"-Wl,-plugin-opt,O1"}
cfiExportsMapPath = "build/soong/cc/config/cfi_exports.map"
- cfiExportsMap android.Path
cfiStaticLibsMutex sync.Mutex
intOverflowCflags = []string{"-fsanitize-blacklist=build/soong/cc/config/integer_overflow_blacklist.txt"}
@@ -282,8 +281,6 @@ func (sanitize *sanitize) begin(ctx BaseModuleContext) {
ctx.ModuleErrorf(`Use of "coverage" also requires "address"`)
}
}
-
- cfiExportsMap = android.PathForSource(ctx, cfiExportsMapPath)
}
func (sanitize *sanitize) deps(ctx BaseModuleContext, deps Deps) Deps {