From 7a5b46db91651f52c45130ec93d3cf0ab5ce9655 Mon Sep 17 00:00:00 2001 From: Vishwath Mohan Date: Thu, 16 Mar 2017 16:36:16 -0700 Subject: [PATCH] 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 --- cc/sanitize.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cc/sanitize.go b/cc/sanitize.go index 28c6ef526..bccd28deb 100644 --- a/cc/sanitize.go +++ b/cc/sanitize.go @@ -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") }