Merge "Freeze environment reading after saving deps"
diff --git a/cc/arm64_device.go b/cc/arm64_device.go
index 201c0f2..887e1a4 100644
--- a/cc/arm64_device.go
+++ b/cc/arm64_device.go
@@ -21,7 +21,6 @@
"-fno-short-enums",
"-no-canonical-prefixes",
"-fno-canonical-system-headers",
- "-include ${SrcDir}/build/core/combo/include/arch/linux-arm64/AndroidConfig.h",
// Help catch common 32/64-bit errors.
"-Werror=pointer-to-int-cast",
@@ -47,6 +46,7 @@
"-Wl,--fatal-warnings",
"-Wl,-maarch64linux",
"-Wl,--hash-style=gnu",
+ "-Wl,--fix-cortex-a53-843419",
// Disable transitive dependency library symbol resolving.
"-Wl,--allow-shlib-undefined",
diff --git a/cc/arm_device.go b/cc/arm_device.go
index b935348..58553b2 100644
--- a/cc/arm_device.go
+++ b/cc/arm_device.go
@@ -22,7 +22,6 @@
"-fno-short-enums",
"-no-canonical-prefixes",
"-fno-canonical-system-headers",
- "-include ${SrcDir}/build/core/combo/include/arch/linux-arm/AndroidConfig.h",
"-fno-builtin-sin",
"-fno-strict-volatile-bitfields",
@@ -130,6 +129,7 @@
replaceFirst(armClangArchVariantCflags["armv5te"], "-march=armv5te", "-march=armv5t")
armClangCpuVariantCflags["krait"] = []string{
"-mcpu=krait",
+ "-mfpu=neon-vfpv4",
}
pctx.StaticVariable("armGccVersion", "4.9")
diff --git a/cc/cc.go b/cc/cc.go
index e9d3884..7f40066 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -97,7 +97,10 @@
commonGlobalCppflags = []string{
"-Wsign-promo",
- "-std=gnu++11",
+ }
+
+ illegalFlags = []string{
+ "-w",
}
)
@@ -218,10 +221,20 @@
// that module.
Include_dirs []string `android:"arch_variant"`
+ // list of files relative to the root of the source tree that will be included
+ // using -include.
+ // If possible, don't use this.
+ Include_files []string `android:"arch_variant"`
+
// list of directories relative to the Blueprints file that will
// be added to the include path using -I
Local_include_dirs []string `android:"arch_variant"`
+ // list of files relative to the Blueprints file that will be included
+ // using -include.
+ // If possible, don't use this.
+ Local_include_files []string `android:"arch_variant"`
+
// list of directories relative to the Blueprints file that will
// be added to the include path using -I for any module that links against this module
Export_include_dirs []string `android:"arch_variant"`
@@ -447,6 +460,13 @@
includeDirsToFlags(rootIncludeDirs),
includeDirsToFlags(localIncludeDirs))
+ rootIncludeFiles := pathtools.PrefixPaths(c.Properties.Include_files, ctx.AConfig().SrcDir())
+ localIncludeFiles := pathtools.PrefixPaths(c.Properties.Local_include_files, common.ModuleSrcDir(ctx))
+
+ flags.GlobalFlags = append(flags.GlobalFlags,
+ includeFilesToFlags(rootIncludeFiles),
+ includeFilesToFlags(localIncludeFiles))
+
if !c.Properties.No_default_compiler_flags {
if c.Properties.Sdk_version == "" || ctx.Host() {
flags.GlobalFlags = append(flags.GlobalFlags,
@@ -543,6 +563,20 @@
flags = c.ccModuleType().flags(ctx, flags)
+ if c.Properties.Sdk_version == "" {
+ if ctx.Host() && !flags.Clang {
+ // The host GCC doesn't support C++14 (and is deprecated, so likely
+ // never will). Build these modules with C++11.
+ flags.CppFlags = append(flags.CppFlags, "-std=gnu++11")
+ } else {
+ flags.CppFlags = append(flags.CppFlags, "-std=gnu++14")
+ }
+ }
+
+ flags.CFlags, _ = filterList(flags.CFlags, illegalFlags)
+ flags.CppFlags, _ = filterList(flags.CppFlags, illegalFlags)
+ flags.ConlyFlags, _ = filterList(flags.ConlyFlags, illegalFlags)
+
// Optimization to reduce size of build.ninja
// Replace the long list of flags for each file with a module-local variable
ctx.Variable(pctx, "cflags", strings.Join(flags.CFlags, " "))
@@ -757,7 +791,6 @@
switch c.Properties.Stl {
case "libc++", "libc++_static",
- "stlport", "stlport_static",
"libstdc++":
return c.Properties.Stl
case "none":
@@ -805,13 +838,10 @@
} else {
flags.LdFlags = append(flags.LdFlags, hostDynamicGccLibs...)
}
- }
- case "stlport", "stlport_static":
- if ctx.Device() {
- flags.CFlags = append(flags.CFlags,
- "-I${SrcDir}/external/stlport/stlport",
- "-I${SrcDir}/bionic/libstdc++/include",
- "-I${SrcDir}/bionic")
+ } else {
+ if ctx.Arch().ArchType == common.Arm {
+ flags.LdFlags = append(flags.LdFlags, "-Wl,--exclude-libs,libunwind_llvm.a")
+ }
}
case "libstdc++":
// Using bionic's basic libstdc++. Not actually an STL. Only around until the
@@ -875,10 +905,6 @@
depNames.SharedLibs = append(depNames.SharedLibs, "libdl")
}
}
- case "stlport":
- depNames.SharedLibs = append(depNames.SharedLibs, "libstdc++", "libstlport")
- case "stlport_static":
- depNames.StaticLibs = append(depNames.StaticLibs, "libstdc++", "libstlport_static")
case "":
// None or error.
case "ndk_system":
@@ -1549,7 +1575,7 @@
func (c *CCBenchmark) depNames(ctx common.AndroidBaseContext, depNames CCDeps) CCDeps {
depNames = c.CCBinary.depNames(ctx, depNames)
- depNames.StaticLibs = append(depNames.StaticLibs, "libbenchmark")
+ depNames.StaticLibs = append(depNames.StaticLibs, "libbenchmark", "libbase")
return depNames
}
diff --git a/cc/clang.go b/cc/clang.go
index 347efbe..92061f3 100644
--- a/cc/clang.go
+++ b/cc/clang.go
@@ -10,10 +10,13 @@
"-finline-functions",
"-finline-limit=64",
"-fno-canonical-system-headers",
+ "-Wno-clobbered",
+ "-fno-devirtualize",
"-fno-tree-sra",
"-fprefetch-loop-arrays",
"-funswitch-loops",
"-Wmaybe-uninitialized",
+ "-Wno-error=clobbered",
"-Wno-error=maybe-uninitialized",
"-Wno-error=unused-but-set-parameter",
"-Wno-error=unused-but-set-variable",
@@ -50,6 +53,7 @@
// mips + mips64
"-msynci",
+ "-mno-synci",
"-mno-fused-madd",
// x86 + x86_64
@@ -70,6 +74,7 @@
// Disable overly aggressive warning for macros defined with a leading underscore
// This happens in AndroidConfig.h, which is included nearly everywhere.
+ // TODO: can we remove this now?
"-Wno-reserved-id-macro",
// Disable overly aggressive warning for format strings.
diff --git a/cc/util.go b/cc/util.go
index 9ce84ee..efc89f0 100644
--- a/cc/util.go
+++ b/cc/util.go
@@ -28,6 +28,10 @@
return common.JoinWithPrefix(dirs, "-I")
}
+func includeFilesToFlags(dirs []string) string {
+ return common.JoinWithPrefix(dirs, "-include ")
+}
+
func ldDirsToFlags(dirs []string) string {
return common.JoinWithPrefix(dirs, "-L")
}
diff --git a/cc/x86_darwin_host.go b/cc/x86_darwin_host.go
index bed977d..be40933 100644
--- a/cc/x86_darwin_host.go
+++ b/cc/x86_darwin_host.go
@@ -14,7 +14,6 @@
"-fPIC",
"-funwind-tables",
- "-include ${SrcDir}/build/core/combo/include/arch/darwin-x86/AndroidConfig.h",
// Workaround differences in inttypes.h between host and target.
//See bug 12708004.
@@ -52,11 +51,13 @@
darwinX86Ldflags = []string{
"-m32",
"-Wl,-rpath,@loader_path/../lib",
+ "-Wl,-rpath,@loader_path/lib",
}
darwinX8664Ldflags = []string{
"-m64",
"-Wl,-rpath,@loader_path/../lib64",
+ "-Wl,-rpath,@loader_path/lib64",
}
darwinClangCflags = append([]string{
diff --git a/cc/x86_linux_host.go b/cc/x86_linux_host.go
index b39c0b4..8f24b05 100644
--- a/cc/x86_linux_host.go
+++ b/cc/x86_linux_host.go
@@ -16,11 +16,9 @@
"-fPIC",
"-no-canonical-prefixes",
- "-include ${SrcDir}/build/core/combo/include/arch/linux-x86/AndroidConfig.h",
- // TODO: Set _FORTIFY_SOURCE=2. Bug 20558757.
"-U_FORTIFY_SOURCE",
- "-D_FORTIFY_SOURCE=0",
+ "-D_FORTIFY_SOURCE=2",
"-fstack-protector",
// Workaround differences in inttypes.h between host and target.
@@ -46,6 +44,8 @@
"-mfpmath=sse",
"-m32",
"-march=prescott",
+ "-D_FILE_OFFSET_BITS=64",
+ "-D_LARGEFILE_SOURCE=1",
}
linuxX8664Cflags = []string{
@@ -55,11 +55,13 @@
linuxX86Ldflags = []string{
"-m32",
`-Wl,-rpath,\$$ORIGIN/../lib`,
+ `-Wl,-rpath,\$$ORIGIN/lib`,
}
linuxX8664Ldflags = []string{
"-m64",
`-Wl,-rpath,\$$ORIGIN/../lib64`,
+ `-Wl,-rpath,\$$ORIGIN/lib64`,
}
linuxClangCflags = append([]string{
diff --git a/common/arch.go b/common/arch.go
index b9e3a5c..22393cc 100644
--- a/common/arch.go
+++ b/common/arch.go
@@ -130,7 +130,8 @@
Denver interface{} `blueprint:"filter(android:\"arch_variant\")"`
// Arm64 cpu variants
- Denver64 interface{} `blueprint:"filter(android:\"arch_variant\")"`
+ Cortex_a53 interface{} `blueprint:"filter(android:\"arch_variant\")"`
+ Denver64 interface{} `blueprint:"filter(android:\"arch_variant\")"`
// Mips arch variants
Mips_rev6 interface{} `blueprint:"filter(android:\"arch_variant\")"`