Add ar flags for CFI enabled components in Soong.

CFI enabled components need ar to use the gold linker. This CL adds
that.

Bug: 36290748
Test: Enabling CFI for a Soong component builds without error.
Change-Id: Icbf78fa1ca0d845350516b4dd345b54fbb7ef847
This commit is contained in:
Vishwath Mohan 2017-03-16 16:36:16 -07:00
parent 83d9f71cc5
commit 7a5b46db91
1 changed files with 2 additions and 0 deletions

View File

@ -34,6 +34,7 @@ const (
// FIXME: revert the __cfi_check flag when clang is updated to r280031.
cfiLdflags = "-flto -fsanitize-cfi-cross-dso -fsanitize=cfi " +
"-Wl,-plugin-opt,O1 -Wl,-export-dynamic-symbol=__cfi_check"
cfiArflags = "--plugin ${config.ClangBin}/../lib64/LLVMgold.so"
)
type sanitizerType int
@ -332,6 +333,7 @@ func (sanitize *sanitize) flags(ctx ModuleContext, flags Flags) Flags {
sanitizers = append(sanitizers, "cfi")
flags.CFlags = append(flags.CFlags, cfiCflags)
flags.LdFlags = append(flags.LdFlags, cfiLdflags)
flags.ArFlags = append(flags.ArFlags, cfiArflags)
if Bool(sanitize.Properties.Sanitize.Diag.Cfi) {
diagSanitizers = append(diagSanitizers, "cfi")
}