Fix llvm-ar error caused by using lto and sanitizer together am: 51be632b95
am: 5f4c0d6cb3
Change-Id: Ie257e551f034ad95d8a7082116869128a407e27b
This commit is contained in:
@@ -256,6 +256,7 @@ type builderFlags struct {
|
|||||||
systemIncludeFlags string
|
systemIncludeFlags string
|
||||||
|
|
||||||
groupStaticLibs bool
|
groupStaticLibs bool
|
||||||
|
arGoldPlugin bool
|
||||||
|
|
||||||
stripKeepSymbols bool
|
stripKeepSymbols bool
|
||||||
stripKeepMiniDebugInfo bool
|
stripKeepMiniDebugInfo bool
|
||||||
@@ -512,6 +513,9 @@ func TransformObjToStaticLib(ctx android.ModuleContext, objFiles android.Paths,
|
|||||||
if !ctx.Darwin() {
|
if !ctx.Darwin() {
|
||||||
arFlags += " -format=gnu"
|
arFlags += " -format=gnu"
|
||||||
}
|
}
|
||||||
|
if flags.arGoldPlugin {
|
||||||
|
arFlags += " --plugin ${config.LLVMGoldPlugin}"
|
||||||
|
}
|
||||||
if flags.arFlags != "" {
|
if flags.arFlags != "" {
|
||||||
arFlags += " " + flags.arFlags
|
arFlags += " " + flags.arFlags
|
||||||
}
|
}
|
||||||
|
1
cc/cc.go
1
cc/cc.go
@@ -142,6 +142,7 @@ type Flags struct {
|
|||||||
LdFlagsDeps android.Paths // Files depended on by linker flags
|
LdFlagsDeps android.Paths // Files depended on by linker flags
|
||||||
|
|
||||||
GroupStaticLibs bool
|
GroupStaticLibs bool
|
||||||
|
ArGoldPlugin bool // Whether LLVM gold plugin option is passed to llvm-ar
|
||||||
}
|
}
|
||||||
|
|
||||||
type ObjectLinkerProperties struct {
|
type ObjectLinkerProperties struct {
|
||||||
|
@@ -86,7 +86,7 @@ func (lto *lto) flags(ctx BaseModuleContext, flags Flags) Flags {
|
|||||||
// https://github.com/android-ndk/ndk/issues/498.
|
// https://github.com/android-ndk/ndk/issues/498.
|
||||||
flags.LdFlags = append(flags.LdFlags, "-Wl,-plugin-opt,-emulated-tls")
|
flags.LdFlags = append(flags.LdFlags, "-Wl,-plugin-opt,-emulated-tls")
|
||||||
}
|
}
|
||||||
flags.ArFlags = append(flags.ArFlags, " --plugin ${config.LLVMGoldPlugin}")
|
flags.ArGoldPlugin = true
|
||||||
}
|
}
|
||||||
return flags
|
return flags
|
||||||
}
|
}
|
||||||
|
@@ -38,7 +38,6 @@ var (
|
|||||||
"-fsanitize-blacklist=external/compiler-rt/lib/cfi/cfi_blacklist.txt"}
|
"-fsanitize-blacklist=external/compiler-rt/lib/cfi/cfi_blacklist.txt"}
|
||||||
cfiLdflags = []string{"-flto", "-fsanitize-cfi-cross-dso", "-fsanitize=cfi",
|
cfiLdflags = []string{"-flto", "-fsanitize-cfi-cross-dso", "-fsanitize=cfi",
|
||||||
"-Wl,-plugin-opt,O1"}
|
"-Wl,-plugin-opt,O1"}
|
||||||
cfiArflags = []string{"--plugin ${config.ClangBin}/../lib64/LLVMgold.so"}
|
|
||||||
cfiExportsMapPath = "build/soong/cc/config/cfi_exports.map"
|
cfiExportsMapPath = "build/soong/cc/config/cfi_exports.map"
|
||||||
cfiExportsMap android.Path
|
cfiExportsMap android.Path
|
||||||
cfiStaticLibsMutex sync.Mutex
|
cfiStaticLibsMutex sync.Mutex
|
||||||
@@ -407,7 +406,7 @@ func (sanitize *sanitize) flags(ctx ModuleContext, flags Flags) Flags {
|
|||||||
// See b/72706604 or https://github.com/android-ndk/ndk/issues/498.
|
// See b/72706604 or https://github.com/android-ndk/ndk/issues/498.
|
||||||
flags.LdFlags = append(flags.LdFlags, "-Wl,-plugin-opt,-emulated-tls")
|
flags.LdFlags = append(flags.LdFlags, "-Wl,-plugin-opt,-emulated-tls")
|
||||||
}
|
}
|
||||||
flags.ArFlags = append(flags.ArFlags, cfiArflags...)
|
flags.ArGoldPlugin = true
|
||||||
if Bool(sanitize.Properties.Sanitize.Diag.Cfi) {
|
if Bool(sanitize.Properties.Sanitize.Diag.Cfi) {
|
||||||
diagSanitizers = append(diagSanitizers, "cfi")
|
diagSanitizers = append(diagSanitizers, "cfi")
|
||||||
}
|
}
|
||||||
|
@@ -84,6 +84,7 @@ func flagsToBuilderFlags(in Flags) builderFlags {
|
|||||||
systemIncludeFlags: strings.Join(in.SystemIncludeFlags, " "),
|
systemIncludeFlags: strings.Join(in.SystemIncludeFlags, " "),
|
||||||
|
|
||||||
groupStaticLibs: in.GroupStaticLibs,
|
groupStaticLibs: in.GroupStaticLibs,
|
||||||
|
arGoldPlugin: in.ArGoldPlugin,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user