Merge "Disable prebuilt_test"
diff --git a/cc/compiler.go b/cc/compiler.go
index db4c076..198b792 100644
--- a/cc/compiler.go
+++ b/cc/compiler.go
@@ -233,6 +233,7 @@
if !ctx.noDefaultCompilerFlags() {
flags.GlobalFlags = append(flags.GlobalFlags, instructionSetFlags)
+ flags.ConlyFlags = append(flags.ConlyFlags, "${config.CommonGlobalConlyflags}")
if flags.Clang {
flags.AsFlags = append(flags.AsFlags, tc.ClangAsflags())
@@ -241,8 +242,6 @@
tc.ClangCflags(),
"${config.CommonClangGlobalCflags}",
fmt.Sprintf("${config.%sClangGlobalCflags}", hod))
-
- flags.ConlyFlags = append(flags.ConlyFlags, "${config.ClangExtraConlyflags}")
} else {
flags.CppFlags = append(flags.CppFlags, "${config.CommonGlobalCppflags}")
flags.GlobalFlags = append(flags.GlobalFlags,
diff --git a/cc/config/clang.go b/cc/config/clang.go
index 13a7e66..10f4cea 100644
--- a/cc/config/clang.go
+++ b/cc/config/clang.go
@@ -93,10 +93,6 @@
"-Wno-expansion-to-defined",
}, " "))
- pctx.StaticVariable("ClangExtraConlyflags", strings.Join([]string{
- "-std=gnu99",
- }, " "))
-
pctx.StaticVariable("ClangExtraCppflags", strings.Join([]string{
// Disable -Winconsistent-missing-override until we can clean up the existing
// codebase for it.
diff --git a/cc/config/global.go b/cc/config/global.go
index 7209d16..9b77662 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -37,6 +37,10 @@
"-UDEBUG",
}
+ commonGlobalConlyflags = []string{
+ "-std=gnu99",
+ }
+
deviceGlobalCflags = []string{
"-fdiagnostics-color",
@@ -72,6 +76,7 @@
}
pctx.StaticVariable("CommonGlobalCflags", strings.Join(commonGlobalCflags, " "))
+ pctx.StaticVariable("CommonGlobalConlyflags", strings.Join(commonGlobalConlyflags, " "))
pctx.StaticVariable("DeviceGlobalCflags", strings.Join(deviceGlobalCflags, " "))
pctx.StaticVariable("HostGlobalCflags", strings.Join(hostGlobalCflags, " "))
pctx.StaticVariable("NoOverrideGlobalCflags", strings.Join(noOverrideGlobalCflags, " "))
diff --git a/cc/makevars.go b/cc/makevars.go
index ea32121..098ec02 100644
--- a/cc/makevars.go
+++ b/cc/makevars.go
@@ -44,6 +44,10 @@
ctx.Strict("GLOBAL_CLANG_CPPFLAGS_NO_OVERRIDE", "")
ctx.Strict("NDK_PREBUILT_SHARED_LIBRARIES", strings.Join(ndkPrebuiltSharedLibs, " "))
+ ctx.Strict("ADDRESS_SANITIZER_CONFIG_EXTRA_CFLAGS", asanCflags)
+ ctx.Strict("ADDRESS_SANITIZER_CONFIG_EXTRA_LDFLAGS", asanLdflags)
+ ctx.Strict("ADDRESS_SANITIZER_CONFIG_EXTRA_STATIC_LIBRARIES", asanLibs)
+
includeFlags, err := ctx.Eval("${config.CommonGlobalIncludes} ${config.CommonGlobalSystemIncludes}")
if err != nil {
panic(err)
@@ -113,7 +117,9 @@
toolchain.ToolchainCflags(),
productExtraCflags,
}, " "))
- ctx.Strict(makePrefix+"GLOBAL_CONLYFLAGS", "")
+ ctx.Strict(makePrefix+"GLOBAL_CONLYFLAGS", strings.Join([]string{
+ "${config.CommonGlobalConlyflags}",
+ }, " "))
ctx.Strict(makePrefix+"GLOBAL_CPPFLAGS", strings.Join([]string{
"${config.CommonGlobalCppflags}",
toolchain.Cppflags(),
@@ -161,7 +167,6 @@
clangExtras,
productExtraCflags,
}, " "))
- ctx.Strict(clangPrefix+"GLOBAL_CONLYFLAGS", "${config.ClangExtraConlyflags}")
ctx.Strict(clangPrefix+"GLOBAL_CPPFLAGS", strings.Join([]string{
"${config.CommonClangGlobalCppflags}",
toolchain.ClangCppflags(),
diff --git a/cc/sanitize.go b/cc/sanitize.go
index bb1a2ad..2676373 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -24,6 +24,12 @@
"android/soong/cc/config"
)
+const (
+ asanCflags = "-fno-omit-frame-pointer"
+ asanLdflags = "-Wl,-u,__asan_preinit"
+ asanLibs = "libasan"
+)
+
type sanitizerType int
func boolPtr(v bool) *bool {
@@ -175,7 +181,7 @@
if ctx.Device() {
if Bool(sanitize.Properties.Sanitize.Address) {
- deps.StaticLibs = append(deps.StaticLibs, "libasan")
+ deps.StaticLibs = append(deps.StaticLibs, asanLibs)
}
if Bool(sanitize.Properties.Sanitize.Address) || Bool(sanitize.Properties.Sanitize.Thread) {
deps.SharedLibs = append(deps.SharedLibs, "libdl")
@@ -236,8 +242,8 @@
// TODO: put in flags?
flags.RequiredInstructionSet = "arm"
}
- flags.CFlags = append(flags.CFlags, "-fno-omit-frame-pointer")
- flags.LdFlags = append(flags.LdFlags, "-Wl,-u,__asan_preinit")
+ flags.CFlags = append(flags.CFlags, asanCflags)
+ flags.LdFlags = append(flags.LdFlags, asanLdflags)
// ASan runtime library must be the first in the link order.
runtimeLibrary := config.AddressSanitizerRuntimeLibrary(ctx.toolchain())