aboutsummaryrefslogtreecommitdiffstats
path: root/cc/builder.go
diff options
context:
space:
mode:
authorZhizhou Yang <zhizhouy@google.com>2018-02-08 18:32:11 -0800
committerZhizhou Yang <zhizhouy@google.com>2018-02-09 13:47:52 -0800
commit4917049f6efe2d08e67eb26ec77e21dcce5172c5 (patch)
tree182e861d08fe71aa9deef32bca6608485c478d60 /cc/builder.go
parentc72573dcd14e883722ab9fd6f5db12d5de2eb1b5 (diff)
downloadbuild_soong-4917049f6efe2d08e67eb26ec77e21dcce5172c5.tar.gz
build_soong-4917049f6efe2d08e67eb26ec77e21dcce5172c5.tar.bz2
build_soong-4917049f6efe2d08e67eb26ec77e21dcce5172c5.zip
Fix llvm-ar error caused by using lto and sanitizer together
LLVM-AR does not allow passing --plugin options more than once. The --plugin ARFLAGS that lto want to add, may already exist if sanitizer is also turned on. Fixed this by adding a new bool Flags.ArGoldPlugin. Set this variable to true whenever LLVM gold plugin is needed for ArFlags. In function TransformObjToStaticLib(), add this option to arFlags using global value ${config.LLVMGoldPlugin} if the bool value is true. Bug: http://b/73160350 Test: build the image with make and succeeded. Change-Id: I62785829b0a4b663225926e4aed98defc1b6da2c
Diffstat (limited to 'cc/builder.go')
-rw-r--r--cc/builder.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/cc/builder.go b/cc/builder.go
index 06461324..279c1da7 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -256,6 +256,7 @@ type builderFlags struct {
systemIncludeFlags string
groupStaticLibs bool
+ arGoldPlugin bool
stripKeepSymbols bool
stripKeepMiniDebugInfo bool
@@ -512,6 +513,9 @@ func TransformObjToStaticLib(ctx android.ModuleContext, objFiles android.Paths,
if !ctx.Darwin() {
arFlags += " -format=gnu"
}
+ if flags.arGoldPlugin {
+ arFlags += " --plugin ${config.LLVMGoldPlugin}"
+ }
if flags.arFlags != "" {
arFlags += " " + flags.arFlags
}