aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cc/compiler.go21
-rw-r--r--cc/config/global.go8
-rw-r--r--cc/makevars.go2
-rw-r--r--cc/sanitize.go11
-rw-r--r--genrule/genrule.go2
5 files changed, 33 insertions, 11 deletions
diff --git a/cc/compiler.go b/cc/compiler.go
index d53e799a..e962949b 100644
--- a/cc/compiler.go
+++ b/cc/compiler.go
@@ -86,6 +86,16 @@ type BaseCompilerProperties struct {
// pass -frtti instead of -fno-rtti
Rtti *bool
+ // C standard version to use. Can be a specific version (such as "gnu11"),
+ // "experimental" (which will use draft versions like C1x when available),
+ // or the empty string (which will use the default).
+ C_std string
+
+ // C++ standard version to use. Can be a specific version (such as
+ // "gnu++11"), "experimental" (which will use draft versions like C++1z when
+ // available), or the empty string (which will use the default).
+ Cpp_std string
+
// if set to false, use -std=c++* instead of -std=gnu++*
Gnu_extensions *bool
@@ -307,7 +317,18 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags) Flag
if !ctx.sdk() {
cStd := config.CStdVersion
+ if compiler.Properties.C_std == "experimental" {
+ cStd = config.ExperimentalCStdVersion
+ } else if compiler.Properties.C_std != "" {
+ cStd = compiler.Properties.C_std
+ }
+
cppStd := config.CppStdVersion
+ if compiler.Properties.Cpp_std == "experimental" {
+ cppStd = config.ExperimentalCppStdVersion
+ } else if compiler.Properties.Cpp_std != "" {
+ cppStd = compiler.Properties.Cpp_std
+ }
if !flags.Clang {
// GCC uses an invalid C++14 ABI (emits calls to
diff --git a/cc/config/global.go b/cc/config/global.go
index e248040d..e254a1c8 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -65,9 +65,11 @@ var (
"-w",
}
- CStdVersion = "gnu99"
- CppStdVersion = "gnu++14"
- GccCppStdVersion = "gnu++11"
+ CStdVersion = "gnu99"
+ CppStdVersion = "gnu++14"
+ GccCppStdVersion = "gnu++11"
+ ExperimentalCStdVersion = "gnu11"
+ ExperimentalCppStdVersion = "gnu++1z"
)
var pctx = android.NewPackageContext("android/soong/cc/config")
diff --git a/cc/makevars.go b/cc/makevars.go
index 2e64e3c2..30d83e8e 100644
--- a/cc/makevars.go
+++ b/cc/makevars.go
@@ -60,6 +60,8 @@ func makeVarsProvider(ctx android.MakeVarsContext) {
ctx.Strict("DEFAULT_C_STD_VERSION", config.CStdVersion)
ctx.Strict("DEFAULT_CPP_STD_VERSION", config.CppStdVersion)
ctx.Strict("DEFAULT_GCC_CPP_STD_VERSION", config.GccCppStdVersion)
+ ctx.Strict("EXPERIMENTAL_C_STD_VERSION", config.ExperimentalCStdVersion)
+ ctx.Strict("EXPERIMENTAL_CPP_STD_VERSION", config.ExperimentalCppStdVersion)
ctx.Strict("DEFAULT_GLOBAL_TIDY_CHECKS", "${config.TidyDefaultGlobalChecks}")
ctx.Strict("DEFAULT_LOCAL_TIDY_CHECKS", joinLocalTidyChecks(config.DefaultLocalTidyChecks))
diff --git a/cc/sanitize.go b/cc/sanitize.go
index 79c86aaa..b98797a7 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -167,7 +167,8 @@ func (sanitize *sanitize) begin(ctx BaseModuleContext) {
}
}
- if !ctx.AConfig().EnableCFI() {
+ // CFI needs gold linker, and mips toolchain does not have one.
+ if !ctx.AConfig().EnableCFI() || ctx.Arch().ArchType == android.Mips || ctx.Arch().ArchType == android.Mips64 {
s.Cfi = nil
s.Diag.Cfi = nil
}
@@ -280,11 +281,6 @@ func (sanitize *sanitize) flags(ctx ModuleContext, flags Flags) Flags {
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())
- if runtimeLibrary != "" {
- flags.libFlags = append([]string{"${config.ClangAsanLibDir}/" + runtimeLibrary}, flags.libFlags...)
- }
if ctx.Host() {
// -nodefaultlibs (provided with libc++) prevents the driver from linking
// libraries needed with -fsanitize=address. http://b/18650275 (WAI)
@@ -317,6 +313,9 @@ func (sanitize *sanitize) flags(ctx ModuleContext, flags Flags) Flags {
// __cfi_check needs to be built as Thumb (see the code in linker_cfi.cpp). LLVM is not set up
// to do this on a function basis, so force Thumb on the entire module.
flags.RequiredInstructionSet = "thumb"
+ // Workaround for b/33678192. CFI jumptables need Thumb2 codegen. Revert when
+ // Clang is updated past r290384.
+ flags.LdFlags = append(flags.LdFlags, "-march=armv7-a")
}
sanitizers = append(sanitizers, "cfi")
cfiFlags := []string{"-flto", "-fsanitize=cfi", "-fsanitize-cfi-cross-dso"}
diff --git a/genrule/genrule.go b/genrule/genrule.go
index 5c717423..ee4c5034 100644
--- a/genrule/genrule.go
+++ b/genrule/genrule.go
@@ -150,8 +150,6 @@ func (g *generator) GenerateAndroidBuildActions(ctx android.ModuleContext) {
} else {
ctx.ModuleErrorf("host tool %q missing output file", ctx.OtherModuleName(module))
}
- } else {
- ctx.ModuleErrorf("unknown dependency %q", ctx.OtherModuleName(module))
}
})
}