Merge "rust: Remove libtest from stdlibs list"
diff --git a/android/soong_config_modules_test.go b/android/soong_config_modules_test.go
index 8f252d9..b2f8eaa 100644
--- a/android/soong_config_modules_test.go
+++ b/android/soong_config_modules_test.go
@@ -313,6 +313,51 @@
})
}
+func TestNonExistentPropertyInSoongConfigModule(t *testing.T) {
+ bp := `
+ soong_config_module_type {
+ name: "acme_test",
+ module_type: "test",
+ config_namespace: "acme",
+ bool_variables: ["feature1"],
+ properties: ["made_up_property"],
+ }
+
+ acme_test {
+ name: "foo",
+ cflags: ["-DGENERIC"],
+ soong_config_variables: {
+ feature1: {
+ made_up_property: true,
+ },
+ },
+ }
+ `
+
+ fixtureForVendorVars := func(vars map[string]map[string]string) FixturePreparer {
+ return FixtureModifyProductVariables(func(variables FixtureProductVariables) {
+ variables.VendorVars = vars
+ })
+ }
+
+ GroupFixturePreparers(
+ fixtureForVendorVars(map[string]map[string]string{"acme": {"feature1": "1"}}),
+ PrepareForTestWithDefaults,
+ FixtureRegisterWithContext(func(ctx RegistrationContext) {
+ ctx.RegisterModuleType("soong_config_module_type_import", soongConfigModuleTypeImportFactory)
+ ctx.RegisterModuleType("soong_config_module_type", soongConfigModuleTypeFactory)
+ ctx.RegisterModuleType("soong_config_string_variable", soongConfigStringVariableDummyFactory)
+ ctx.RegisterModuleType("soong_config_bool_variable", soongConfigBoolVariableDummyFactory)
+ ctx.RegisterModuleType("test_defaults", soongConfigTestDefaultsModuleFactory)
+ ctx.RegisterModuleType("test", soongConfigTestModuleFactory)
+ }),
+ FixtureWithRootAndroidBp(bp),
+ ).ExtendWithErrorHandler(FixtureExpectsAllErrorsToMatchAPattern([]string{
+ // TODO(b/171232169): improve the error message for non-existent properties
+ `unrecognized property "soong_config_variables`,
+ })).RunTest(t)
+}
+
func testConfigWithVendorVars(buildDir, bp string, fs map[string][]byte, vendorVars map[string]map[string]string) Config {
config := TestConfig(buildDir, nil, bp, fs)
diff --git a/cc/builder.go b/cc/builder.go
index bde8c96..b0842ec 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -500,10 +500,10 @@
sAbiDumpFiles = make(android.Paths, 0, len(srcFiles))
}
- cflags += " ${config.NoOverrideClangGlobalCflags}"
- toolingCflags += " ${config.NoOverrideClangGlobalCflags}"
- cppflags += " ${config.NoOverrideClangGlobalCflags}"
- toolingCppflags += " ${config.NoOverrideClangGlobalCflags}"
+ cflags += " ${config.NoOverrideGlobalCflags}"
+ toolingCflags += " ${config.NoOverrideGlobalCflags}"
+ cppflags += " ${config.NoOverrideGlobalCflags}"
+ toolingCppflags += " ${config.NoOverrideGlobalCflags}"
for i, srcFile := range srcFiles {
objFile := android.ObjPathWithExt(ctx, subdir, srcFile, "o")
diff --git a/cc/cc_test.go b/cc/cc_test.go
index 0a74e58..0a3acb9 100644
--- a/cc/cc_test.go
+++ b/cc/cc_test.go
@@ -4038,14 +4038,14 @@
}
want := []string{
- "${config.ArmClangThumbCflags}",
- "${config.ArmClangCflags}",
- "${config.CommonClangGlobalCflags}",
- "${config.DeviceClangGlobalCflags}",
- "${config.ClangExternalCflags}",
- "${config.ArmToolchainClangCflags}",
- "${config.ArmClangArmv7ANeonCflags}",
- "${config.ArmClangGenericCflags}",
+ "${config.ArmThumbCflags}",
+ "${config.ArmCflags}",
+ "${config.CommonGlobalCflags}",
+ "${config.DeviceGlobalCflags}",
+ "${config.ExternalCflags}",
+ "${config.ArmToolchainCflags}",
+ "${config.ArmArmv7ANeonCflags}",
+ "${config.ArmGenericCflags}",
"android_arm_export_include_dirs",
"lib32_export_include_dirs",
"arm_export_include_dirs",
@@ -4076,7 +4076,7 @@
"defaults/cc/common/ndk_libandroid_support",
"out/soong/ndk/sysroot/usr/include",
"out/soong/ndk/sysroot/usr/include/arm-linux-androideabi",
- "${config.NoOverrideClangGlobalCflags}",
+ "${config.NoOverrideGlobalCflags}",
}
android.AssertArrayString(t, "includes", want, includes)
diff --git a/cc/compiler.go b/cc/compiler.go
index 69ead30..b01ba43 100644
--- a/cc/compiler.go
+++ b/cc/compiler.go
@@ -392,7 +392,7 @@
if flags.RequiredInstructionSet != "" {
instructionSet = flags.RequiredInstructionSet
}
- instructionSetFlags, err := tc.ClangInstructionSetFlags(instructionSet)
+ instructionSetFlags, err := tc.InstructionSetFlags(instructionSet)
if err != nil {
ctx.ModuleErrorf("%s", err)
}
@@ -437,15 +437,15 @@
flags.Global.ConlyFlags = append([]string{"${config.CommonGlobalConlyflags}"}, flags.Global.ConlyFlags...)
flags.Global.CppFlags = append([]string{fmt.Sprintf("${config.%sGlobalCppflags}", hod)}, flags.Global.CppFlags...)
- flags.Global.AsFlags = append(flags.Global.AsFlags, tc.ClangAsflags())
- flags.Global.CppFlags = append([]string{"${config.CommonClangGlobalCppflags}"}, flags.Global.CppFlags...)
+ flags.Global.AsFlags = append(flags.Global.AsFlags, tc.Asflags())
+ flags.Global.CppFlags = append([]string{"${config.CommonGlobalCppflags}"}, flags.Global.CppFlags...)
flags.Global.CommonFlags = append(flags.Global.CommonFlags,
- tc.ClangCflags(),
- "${config.CommonClangGlobalCflags}",
- fmt.Sprintf("${config.%sClangGlobalCflags}", hod))
+ tc.Cflags(),
+ "${config.CommonGlobalCflags}",
+ fmt.Sprintf("${config.%sGlobalCflags}", hod))
if isThirdParty(modulePath) {
- flags.Global.CommonFlags = append(flags.Global.CommonFlags, "${config.ClangExternalCflags}")
+ flags.Global.CommonFlags = append(flags.Global.CommonFlags, "${config.ExternalCflags}")
}
if tc.Bionic() {
@@ -458,11 +458,11 @@
flags.Global.AsFlags = append(flags.Global.AsFlags, "-D__ASSEMBLY__")
- flags.Global.CppFlags = append(flags.Global.CppFlags, tc.ClangCppflags())
+ flags.Global.CppFlags = append(flags.Global.CppFlags, tc.Cppflags())
flags.Global.YasmFlags = append(flags.Global.YasmFlags, tc.YasmFlags())
- flags.Global.CommonFlags = append(flags.Global.CommonFlags, tc.ToolchainClangCflags())
+ flags.Global.CommonFlags = append(flags.Global.CommonFlags, tc.ToolchainCflags())
cStd := config.CStdVersion
if String(compiler.Properties.C_std) == "experimental" {
diff --git a/cc/config/arm64_device.go b/cc/config/arm64_device.go
index af6361b..812a245 100644
--- a/cc/config/arm64_device.go
+++ b/cc/config/arm64_device.go
@@ -48,12 +48,12 @@
"-Wl,-z,separate-code",
}
- arm64Lldflags = append(ClangFilterUnknownLldflags(arm64Ldflags),
+ arm64Lldflags = append(arm64Ldflags,
"-Wl,-z,max-page-size=4096")
arm64Cppflags = []string{}
- arm64ClangCpuVariantCflags = map[string][]string{
+ arm64CpuVariantCflags = map[string][]string{
"cortex-a53": []string{
"-mcpu=cortex-a53",
},
@@ -99,52 +99,50 @@
pctx.StaticVariable("Arm64Ldflags", strings.Join(arm64Ldflags, " "))
pctx.StaticVariable("Arm64Lldflags", strings.Join(arm64Lldflags, " "))
- pctx.StaticVariable("Arm64ClangCflags", strings.Join(ClangFilterUnknownCflags(arm64Cflags), " "))
- pctx.StaticVariable("Arm64ClangLdflags", strings.Join(ClangFilterUnknownCflags(arm64Ldflags), " "))
- pctx.StaticVariable("Arm64ClangLldflags", strings.Join(ClangFilterUnknownCflags(arm64Lldflags), " "))
- pctx.StaticVariable("Arm64ClangCppflags", strings.Join(ClangFilterUnknownCflags(arm64Cppflags), " "))
+ pctx.StaticVariable("Arm64Cflags", strings.Join(arm64Cflags, " "))
+ pctx.StaticVariable("Arm64Cppflags", strings.Join(arm64Cppflags, " "))
- pctx.StaticVariable("Arm64ClangArmv8ACflags", strings.Join(arm64ArchVariantCflags["armv8-a"], " "))
- pctx.StaticVariable("Arm64ClangArmv8ABranchProtCflags", strings.Join(arm64ArchVariantCflags["armv8-a-branchprot"], " "))
- pctx.StaticVariable("Arm64ClangArmv82ACflags", strings.Join(arm64ArchVariantCflags["armv8-2a"], " "))
- pctx.StaticVariable("Arm64ClangArmv82ADotprodCflags", strings.Join(arm64ArchVariantCflags["armv8-2a-dotprod"], " "))
+ pctx.StaticVariable("Arm64Armv8ACflags", strings.Join(arm64ArchVariantCflags["armv8-a"], " "))
+ pctx.StaticVariable("Arm64Armv8ABranchProtCflags", strings.Join(arm64ArchVariantCflags["armv8-a-branchprot"], " "))
+ pctx.StaticVariable("Arm64Armv82ACflags", strings.Join(arm64ArchVariantCflags["armv8-2a"], " "))
+ pctx.StaticVariable("Arm64Armv82ADotprodCflags", strings.Join(arm64ArchVariantCflags["armv8-2a-dotprod"], " "))
- pctx.StaticVariable("Arm64ClangCortexA53Cflags",
- strings.Join(arm64ClangCpuVariantCflags["cortex-a53"], " "))
+ pctx.StaticVariable("Arm64CortexA53Cflags",
+ strings.Join(arm64CpuVariantCflags["cortex-a53"], " "))
- pctx.StaticVariable("Arm64ClangCortexA55Cflags",
- strings.Join(arm64ClangCpuVariantCflags["cortex-a55"], " "))
+ pctx.StaticVariable("Arm64CortexA55Cflags",
+ strings.Join(arm64CpuVariantCflags["cortex-a55"], " "))
- pctx.StaticVariable("Arm64ClangKryoCflags",
- strings.Join(arm64ClangCpuVariantCflags["kryo"], " "))
+ pctx.StaticVariable("Arm64KryoCflags",
+ strings.Join(arm64CpuVariantCflags["kryo"], " "))
- pctx.StaticVariable("Arm64ClangExynosM1Cflags",
- strings.Join(arm64ClangCpuVariantCflags["exynos-m1"], " "))
+ pctx.StaticVariable("Arm64ExynosM1Cflags",
+ strings.Join(arm64CpuVariantCflags["exynos-m1"], " "))
- pctx.StaticVariable("Arm64ClangExynosM2Cflags",
- strings.Join(arm64ClangCpuVariantCflags["exynos-m2"], " "))
+ pctx.StaticVariable("Arm64ExynosM2Cflags",
+ strings.Join(arm64CpuVariantCflags["exynos-m2"], " "))
}
var (
- arm64ClangArchVariantCflagsVar = map[string]string{
- "armv8-a": "${config.Arm64ClangArmv8ACflags}",
- "armv8-a-branchprot": "${config.Arm64ClangArmv8ABranchProtCflags}",
- "armv8-2a": "${config.Arm64ClangArmv82ACflags}",
- "armv8-2a-dotprod": "${config.Arm64ClangArmv82ADotprodCflags}",
+ arm64ArchVariantCflagsVar = map[string]string{
+ "armv8-a": "${config.Arm64Armv8ACflags}",
+ "armv8-a-branchprot": "${config.Arm64Armv8ABranchProtCflags}",
+ "armv8-2a": "${config.Arm64Armv82ACflags}",
+ "armv8-2a-dotprod": "${config.Arm64Armv82ADotprodCflags}",
}
- arm64ClangCpuVariantCflagsVar = map[string]string{
+ arm64CpuVariantCflagsVar = map[string]string{
"": "",
- "cortex-a53": "${config.Arm64ClangCortexA53Cflags}",
- "cortex-a55": "${config.Arm64ClangCortexA55Cflags}",
- "cortex-a72": "${config.Arm64ClangCortexA53Cflags}",
- "cortex-a73": "${config.Arm64ClangCortexA53Cflags}",
- "cortex-a75": "${config.Arm64ClangCortexA55Cflags}",
- "cortex-a76": "${config.Arm64ClangCortexA55Cflags}",
- "kryo": "${config.Arm64ClangKryoCflags}",
- "kryo385": "${config.Arm64ClangCortexA53Cflags}",
- "exynos-m1": "${config.Arm64ClangExynosM1Cflags}",
- "exynos-m2": "${config.Arm64ClangExynosM2Cflags}",
+ "cortex-a53": "${config.Arm64CortexA53Cflags}",
+ "cortex-a55": "${config.Arm64CortexA55Cflags}",
+ "cortex-a72": "${config.Arm64CortexA53Cflags}",
+ "cortex-a73": "${config.Arm64CortexA53Cflags}",
+ "cortex-a75": "${config.Arm64CortexA55Cflags}",
+ "cortex-a76": "${config.Arm64CortexA55Cflags}",
+ "kryo": "${config.Arm64KryoCflags}",
+ "kryo385": "${config.Arm64CortexA53Cflags}",
+ "exynos-m1": "${config.Arm64ExynosM1Cflags}",
+ "exynos-m2": "${config.Arm64ExynosM2Cflags}",
}
)
@@ -152,9 +150,9 @@
toolchainBionic
toolchain64Bit
- ldflags string
- lldflags string
- toolchainClangCflags string
+ ldflags string
+ lldflags string
+ toolchainCflags string
}
func (t *toolchainArm64) Name() string {
@@ -181,24 +179,24 @@
return t.GccTriple()
}
-func (t *toolchainArm64) ClangCflags() string {
- return "${config.Arm64ClangCflags}"
+func (t *toolchainArm64) Cflags() string {
+ return "${config.Arm64Cflags}"
}
-func (t *toolchainArm64) ClangCppflags() string {
- return "${config.Arm64ClangCppflags}"
+func (t *toolchainArm64) Cppflags() string {
+ return "${config.Arm64Cppflags}"
}
-func (t *toolchainArm64) ClangLdflags() string {
+func (t *toolchainArm64) Ldflags() string {
return t.ldflags
}
-func (t *toolchainArm64) ClangLldflags() string {
+func (t *toolchainArm64) Lldflags() string {
return t.lldflags
}
-func (t *toolchainArm64) ToolchainClangCflags() string {
- return t.toolchainClangCflags
+func (t *toolchainArm64) ToolchainCflags() string {
+ return t.toolchainCflags
}
func (toolchainArm64) LibclangRuntimeLibraryArch() string {
@@ -216,9 +214,9 @@
panic(fmt.Sprintf("Unknown ARM architecture version: %q", arch.ArchVariant))
}
- toolchainClangCflags := []string{arm64ClangArchVariantCflagsVar[arch.ArchVariant]}
- toolchainClangCflags = append(toolchainClangCflags,
- variantOrDefault(arm64ClangCpuVariantCflagsVar, arch.CpuVariant))
+ toolchainCflags := []string{arm64ArchVariantCflagsVar[arch.ArchVariant]}
+ toolchainCflags = append(toolchainCflags,
+ variantOrDefault(arm64CpuVariantCflagsVar, arch.CpuVariant))
var extraLdflags string
switch arch.CpuVariant {
@@ -235,7 +233,7 @@
"${config.Arm64Lldflags}",
extraLdflags,
}, " "),
- toolchainClangCflags: strings.Join(toolchainClangCflags, " "),
+ toolchainCflags: strings.Join(toolchainCflags, " "),
}
}
diff --git a/cc/config/arm64_fuchsia_device.go b/cc/config/arm64_fuchsia_device.go
index a6b5e8c..5ab27a0 100644
--- a/cc/config/arm64_fuchsia_device.go
+++ b/cc/config/arm64_fuchsia_device.go
@@ -42,47 +42,31 @@
return arm64GccVersion
}
-func (t *toolchainFuchsiaArm64) Cflags() string {
- return ""
-}
-
-func (t *toolchainFuchsiaArm64) Cppflags() string {
- return ""
-}
-
-func (t *toolchainFuchsiaArm64) Ldflags() string {
- return "-Wl,--fix-cortex-a53-843419"
-}
-
func (t *toolchainFuchsiaArm64) IncludeFlags() string {
return ""
}
-func (t *toolchainFuchsiaArm64) ToolchainCflags() string {
- return "-mcpu=cortex-a53"
-}
-
func (t *toolchainFuchsiaArm64) ClangTriple() string {
return "arm64-fuchsia-android"
}
-func (t *toolchainFuchsiaArm64) ClangCppflags() string {
+func (t *toolchainFuchsiaArm64) Cppflags() string {
return "-Wno-error=deprecated-declarations"
}
-func (t *toolchainFuchsiaArm64) ClangLdflags() string {
+func (t *toolchainFuchsiaArm64) Ldflags() string {
return "--target=arm64-fuchsia --sysroot=" + fuchsiaArm64SysRoot + " -L" + fuchsiaArm64PrebuiltLibsRoot + "/aarch64-fuchsia/lib " + "-Lprebuilts/fuchsia_sdk/arch/arm64/dist/"
}
-func (t *toolchainFuchsiaArm64) ClangLldflags() string {
+func (t *toolchainFuchsiaArm64) Lldflags() string {
return "--target=arm64-fuchsia --sysroot=" + fuchsiaArm64SysRoot + " -L" + fuchsiaArm64PrebuiltLibsRoot + "/aarch64-fuchsia/lib " + "-Lprebuilts/fuchsia_sdk/arch/arm64/dist/"
}
-func (t *toolchainFuchsiaArm64) ClangCflags() string {
+func (t *toolchainFuchsiaArm64) Cflags() string {
return "--target=arm64-fuchsia --sysroot=" + fuchsiaArm64SysRoot + " -I" + fuchsiaArm64SysRoot + "/include"
}
-func (t *toolchainFuchsiaArm64) ToolchainClangCflags() string {
+func (t *toolchainFuchsiaArm64) ToolchainCflags() string {
return "-march=armv8-a"
}
diff --git a/cc/config/arm64_linux_host.go b/cc/config/arm64_linux_host.go
index 83bd799..853d818 100644
--- a/cc/config/arm64_linux_host.go
+++ b/cc/config/arm64_linux_host.go
@@ -15,14 +15,15 @@
package config
import (
- "android/soong/android"
"strings"
+
+ "android/soong/android"
)
var (
// This is a host toolchain but flags for device toolchain are required
// as the flags are actually for Bionic-based builds.
- linuxCrossCflags = ClangFilterUnknownCflags(append(deviceGlobalCflags,
+ linuxCrossCflags = append(deviceGlobalCflags,
// clang by default enables PIC when the clang triple is set to *-android.
// See toolchain/llvm-project/clang/lib/Driver/ToolChains/CommonArgs.cpp#920.
// However, for this host target, we don't set "-android" to avoid __ANDROID__ macro
@@ -33,9 +34,9 @@
// This is normally in ClangExtraTargetCflags, but that's for device and we need
// the same for host
"-nostdlibinc",
- ))
+ )
- linuxCrossLdflags = ClangFilterUnknownCflags([]string{
+ linuxCrossLdflags = []string{
"-Wl,-z,noexecstack",
"-Wl,-z,relro",
"-Wl,-z,now",
@@ -44,7 +45,7 @@
"-Wl,--fatal-warnings",
"-Wl,--hash-style=gnu",
"-Wl,--no-undefined-version",
- })
+ }
// Embed the linker into host bionic binaries. This is needed to support host bionic,
// as the linux kernel requires that the ELF interpreter referenced by PT_INTERP be
@@ -73,9 +74,9 @@
return "aarch64-linux"
}
-func (toolchainLinuxArm64) ClangCflags() string {
+func (toolchainLinuxArm64) Cflags() string {
// The inherited flags + extra flags
- return "${config.Arm64ClangCflags} ${config.LinuxBionicArm64Cflags}"
+ return "${config.Arm64Cflags} ${config.LinuxBionicArm64Cflags}"
}
func (toolchainLinuxArm64) CrtBeginSharedBinary() []string {
@@ -84,7 +85,7 @@
func linuxArm64ToolchainFactory(arch android.Arch) Toolchain {
archVariant := "armv8-a" // for host, default to armv8-a
- toolchainClangCflags := []string{arm64ClangArchVariantCflagsVar[archVariant]}
+ toolchainCflags := []string{arm64ArchVariantCflagsVar[archVariant]}
// We don't specify CPU architecture for host. Conservatively assume
// the host CPU needs the fix
@@ -103,7 +104,7 @@
"${config.LinuxBionicArm64Ldflags}",
extraLdflags,
}, " ")
- ret.toolchainArm64.toolchainClangCflags = strings.Join(toolchainClangCflags, " ")
+ ret.toolchainArm64.toolchainCflags = strings.Join(toolchainCflags, " ")
return &ret
}
diff --git a/cc/config/arm_device.go b/cc/config/arm_device.go
index 3c27730..b5afe40 100644
--- a/cc/config/arm_device.go
+++ b/cc/config/arm_device.go
@@ -23,7 +23,6 @@
var (
armToolchainCflags = []string{
- "-mthumb-interwork",
"-msoft-float",
}
@@ -38,7 +37,7 @@
"-Wl,-m,armelf",
}
- armLldflags = ClangFilterUnknownLldflags(armLdflags)
+ armLldflags = armLdflags
armArmCflags = []string{
"-fstrict-aliasing",
@@ -49,7 +48,7 @@
"-Os",
}
- armClangArchVariantCflags = map[string][]string{
+ armArchVariantCflags = map[string][]string{
"armv7-a": []string{
"-march=armv7-a",
"-mfloat-abi=softfp",
@@ -72,7 +71,7 @@
},
}
- armClangCpuVariantCflags = map[string][]string{
+ armCpuVariantCflags = map[string][]string{
"cortex-a7": []string{
"-mcpu=cortex-a7",
"-mfpu=neon-vfpv4",
@@ -181,67 +180,65 @@
exportStringListStaticVariable("ArmLldflags", armLldflags)
// Clang cflags
- exportStringListStaticVariable("ArmToolchainClangCflags", ClangFilterUnknownCflags(armToolchainCflags))
- exportStringListStaticVariable("ArmClangCflags", ClangFilterUnknownCflags(armCflags))
- exportStringListStaticVariable("ArmClangLdflags", ClangFilterUnknownCflags(armLdflags))
- exportStringListStaticVariable("ArmClangLldflags", ClangFilterUnknownCflags(armLldflags))
- exportStringListStaticVariable("ArmClangCppflags", ClangFilterUnknownCflags(armCppflags))
+ exportStringListStaticVariable("ArmToolchainCflags", armToolchainCflags)
+ exportStringListStaticVariable("ArmCflags", armCflags)
+ exportStringListStaticVariable("ArmCppflags", armCppflags)
// Clang ARM vs. Thumb instruction set cflags
- exportStringListStaticVariable("ArmClangArmCflags", ClangFilterUnknownCflags(armArmCflags))
- exportStringListStaticVariable("ArmClangThumbCflags", ClangFilterUnknownCflags(armThumbCflags))
+ exportStringListStaticVariable("ArmArmCflags", armArmCflags)
+ exportStringListStaticVariable("ArmThumbCflags", armThumbCflags)
// Clang arch variant cflags
- exportStringListStaticVariable("ArmClangArmv7ACflags", armClangArchVariantCflags["armv7-a"])
- exportStringListStaticVariable("ArmClangArmv7ANeonCflags", armClangArchVariantCflags["armv7-a-neon"])
- exportStringListStaticVariable("ArmClangArmv8ACflags", armClangArchVariantCflags["armv8-a"])
- exportStringListStaticVariable("ArmClangArmv82ACflags", armClangArchVariantCflags["armv8-2a"])
+ exportStringListStaticVariable("ArmArmv7ACflags", armArchVariantCflags["armv7-a"])
+ exportStringListStaticVariable("ArmArmv7ANeonCflags", armArchVariantCflags["armv7-a-neon"])
+ exportStringListStaticVariable("ArmArmv8ACflags", armArchVariantCflags["armv8-a"])
+ exportStringListStaticVariable("ArmArmv82ACflags", armArchVariantCflags["armv8-2a"])
// Clang cpu variant cflags
- exportStringListStaticVariable("ArmClangGenericCflags", armClangCpuVariantCflags[""])
- exportStringListStaticVariable("ArmClangCortexA7Cflags", armClangCpuVariantCflags["cortex-a7"])
- exportStringListStaticVariable("ArmClangCortexA8Cflags", armClangCpuVariantCflags["cortex-a8"])
- exportStringListStaticVariable("ArmClangCortexA15Cflags", armClangCpuVariantCflags["cortex-a15"])
- exportStringListStaticVariable("ArmClangCortexA53Cflags", armClangCpuVariantCflags["cortex-a53"])
- exportStringListStaticVariable("ArmClangCortexA55Cflags", armClangCpuVariantCflags["cortex-a55"])
- exportStringListStaticVariable("ArmClangKraitCflags", armClangCpuVariantCflags["krait"])
- exportStringListStaticVariable("ArmClangKryoCflags", armClangCpuVariantCflags["kryo"])
+ exportStringListStaticVariable("ArmGenericCflags", armCpuVariantCflags[""])
+ exportStringListStaticVariable("ArmCortexA7Cflags", armCpuVariantCflags["cortex-a7"])
+ exportStringListStaticVariable("ArmCortexA8Cflags", armCpuVariantCflags["cortex-a8"])
+ exportStringListStaticVariable("ArmCortexA15Cflags", armCpuVariantCflags["cortex-a15"])
+ exportStringListStaticVariable("ArmCortexA53Cflags", armCpuVariantCflags["cortex-a53"])
+ exportStringListStaticVariable("ArmCortexA55Cflags", armCpuVariantCflags["cortex-a55"])
+ exportStringListStaticVariable("ArmKraitCflags", armCpuVariantCflags["krait"])
+ exportStringListStaticVariable("ArmKryoCflags", armCpuVariantCflags["kryo"])
}
var (
- armClangArchVariantCflagsVar = map[string]string{
- "armv7-a": "${config.ArmClangArmv7ACflags}",
- "armv7-a-neon": "${config.ArmClangArmv7ANeonCflags}",
- "armv8-a": "${config.ArmClangArmv8ACflags}",
- "armv8-2a": "${config.ArmClangArmv82ACflags}",
+ armArchVariantCflagsVar = map[string]string{
+ "armv7-a": "${config.ArmArmv7ACflags}",
+ "armv7-a-neon": "${config.ArmArmv7ANeonCflags}",
+ "armv8-a": "${config.ArmArmv8ACflags}",
+ "armv8-2a": "${config.ArmArmv82ACflags}",
}
- armClangCpuVariantCflagsVar = map[string]string{
- "": "${config.ArmClangGenericCflags}",
- "cortex-a7": "${config.ArmClangCortexA7Cflags}",
- "cortex-a8": "${config.ArmClangCortexA8Cflags}",
- "cortex-a15": "${config.ArmClangCortexA15Cflags}",
- "cortex-a53": "${config.ArmClangCortexA53Cflags}",
- "cortex-a53.a57": "${config.ArmClangCortexA53Cflags}",
- "cortex-a55": "${config.ArmClangCortexA55Cflags}",
- "cortex-a72": "${config.ArmClangCortexA53Cflags}",
- "cortex-a73": "${config.ArmClangCortexA53Cflags}",
- "cortex-a75": "${config.ArmClangCortexA55Cflags}",
- "cortex-a76": "${config.ArmClangCortexA55Cflags}",
- "krait": "${config.ArmClangKraitCflags}",
- "kryo": "${config.ArmClangKryoCflags}",
- "kryo385": "${config.ArmClangCortexA53Cflags}",
- "exynos-m1": "${config.ArmClangCortexA53Cflags}",
- "exynos-m2": "${config.ArmClangCortexA53Cflags}",
+ armCpuVariantCflagsVar = map[string]string{
+ "": "${config.ArmGenericCflags}",
+ "cortex-a7": "${config.ArmCortexA7Cflags}",
+ "cortex-a8": "${config.ArmCortexA8Cflags}",
+ "cortex-a15": "${config.ArmCortexA15Cflags}",
+ "cortex-a53": "${config.ArmCortexA53Cflags}",
+ "cortex-a53.a57": "${config.ArmCortexA53Cflags}",
+ "cortex-a55": "${config.ArmCortexA55Cflags}",
+ "cortex-a72": "${config.ArmCortexA53Cflags}",
+ "cortex-a73": "${config.ArmCortexA53Cflags}",
+ "cortex-a75": "${config.ArmCortexA55Cflags}",
+ "cortex-a76": "${config.ArmCortexA55Cflags}",
+ "krait": "${config.ArmKraitCflags}",
+ "kryo": "${config.ArmKryoCflags}",
+ "kryo385": "${config.ArmCortexA53Cflags}",
+ "exynos-m1": "${config.ArmCortexA53Cflags}",
+ "exynos-m2": "${config.ArmCortexA53Cflags}",
}
)
type toolchainArm struct {
toolchainBionic
toolchain32Bit
- ldflags string
- lldflags string
- toolchainClangCflags string
+ ldflags string
+ lldflags string
+ toolchainCflags string
}
func (t *toolchainArm) Name() string {
@@ -274,34 +271,34 @@
return t.GccTriple()
}
-func (t *toolchainArm) ToolchainClangCflags() string {
- return t.toolchainClangCflags
+func (t *toolchainArm) ToolchainCflags() string {
+ return t.toolchainCflags
}
-func (t *toolchainArm) ClangCflags() string {
- return "${config.ArmClangCflags}"
+func (t *toolchainArm) Cflags() string {
+ return "${config.ArmCflags}"
}
-func (t *toolchainArm) ClangCppflags() string {
- return "${config.ArmClangCppflags}"
+func (t *toolchainArm) Cppflags() string {
+ return "${config.ArmCppflags}"
}
-func (t *toolchainArm) ClangLdflags() string {
+func (t *toolchainArm) Ldflags() string {
return t.ldflags
}
-func (t *toolchainArm) ClangLldflags() string {
+func (t *toolchainArm) Lldflags() string {
return t.lldflags // TODO: handle V8 cases
}
-func (t *toolchainArm) ClangInstructionSetFlags(isa string) (string, error) {
+func (t *toolchainArm) InstructionSetFlags(isa string) (string, error) {
switch isa {
case "arm":
- return "${config.ArmClangArmCflags}", nil
+ return "${config.ArmArmCflags}", nil
case "thumb", "":
- return "${config.ArmClangThumbCflags}", nil
+ return "${config.ArmThumbCflags}", nil
default:
- return t.toolchainBase.ClangInstructionSetFlags(isa)
+ return t.toolchainBase.InstructionSetFlags(isa)
}
}
@@ -311,13 +308,13 @@
func armToolchainFactory(arch android.Arch) Toolchain {
var fixCortexA8 string
- toolchainClangCflags := make([]string, 2, 3)
+ toolchainCflags := make([]string, 2, 3)
- toolchainClangCflags[0] = "${config.ArmToolchainClangCflags}"
- toolchainClangCflags[1] = armClangArchVariantCflagsVar[arch.ArchVariant]
+ toolchainCflags[0] = "${config.ArmToolchainCflags}"
+ toolchainCflags[1] = armArchVariantCflagsVar[arch.ArchVariant]
- toolchainClangCflags = append(toolchainClangCflags,
- variantOrDefault(armClangCpuVariantCflagsVar, arch.CpuVariant))
+ toolchainCflags = append(toolchainCflags,
+ variantOrDefault(armCpuVariantCflagsVar, arch.CpuVariant))
switch arch.ArchVariant {
case "armv7-a-neon":
@@ -341,8 +338,8 @@
"${config.ArmLdflags}",
fixCortexA8,
}, " "),
- lldflags: "${config.ArmLldflags}",
- toolchainClangCflags: strings.Join(toolchainClangCflags, " "),
+ lldflags: "${config.ArmLldflags}",
+ toolchainCflags: strings.Join(toolchainCflags, " "),
}
}
diff --git a/cc/config/bp2build.go b/cc/config/bp2build.go
index 19571f1..e7e94a8 100644
--- a/cc/config/bp2build.go
+++ b/cc/config/bp2build.go
@@ -118,7 +118,7 @@
// quite complex to track depth-first interpolations. It's also unlikely the
// interpolation stacks are deep (n > 1).
func expandVar(toExpand string, stringScope exportedStringVariables, stringListScope exportedStringListVariables) []string {
- // e.g. "${ClangExternalCflags}"
+ // e.g. "${ExternalCflags}"
r := regexp.MustCompile(`\${([a-zA-Z0-9_]+)}`)
// Internal recursive function.
diff --git a/cc/config/clang.go b/cc/config/clang.go
index c484fc9..9cfe28f 100644
--- a/cc/config/clang.go
+++ b/cc/config/clang.go
@@ -15,9 +15,10 @@
package config
import (
- "android/soong/android"
"sort"
"strings"
+
+ "android/soong/android"
)
// Cflags that should be filtered out when compiling with clang
@@ -80,12 +81,6 @@
"--enable-stdcall-fixup",
})
-// Ldflags that should be filtered out when linking with clang lld
-var ClangUnknownLldflags = sorted([]string{
- "-Wl,--fix-cortex-a8",
- "-Wl,--no-fix-cortex-a8",
-})
-
var ClangLibToolingUnknownCflags = sorted([]string{})
// List of tidy checks that should be disabled globally. When the compiler is
@@ -153,80 +148,6 @@
"-D__ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__",
})
- exportStringListStaticVariable("ClangExtraCppflags", []string{
- // -Wimplicit-fallthrough is not enabled by -Wall.
- "-Wimplicit-fallthrough",
-
- // Enable clang's thread-safety annotations in libcxx.
- "-D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS",
-
- // libc++'s math.h has an #include_next outside of system_headers.
- "-Wno-gnu-include-next",
- })
-
- exportStringListStaticVariable("ClangExtraTargetCflags", []string{"-nostdlibinc"})
-
- exportStringListStaticVariable("ClangExtraNoOverrideCflags", []string{
- "-Werror=address-of-temporary",
- // Bug: http://b/29823425 Disable -Wnull-dereference until the
- // new cases detected by this warning in Clang r271374 are
- // fixed.
- //"-Werror=null-dereference",
- "-Werror=return-type",
-
- // http://b/72331526 Disable -Wtautological-* until the instances detected by these
- // new warnings are fixed.
- "-Wno-tautological-constant-compare",
- "-Wno-tautological-type-limit-compare",
- // http://b/145210666
- "-Wno-reorder-init-list",
- // http://b/145211066
- "-Wno-implicit-int-float-conversion",
- // New warnings to be fixed after clang-r377782.
- "-Wno-int-in-bool-context", // http://b/148287349
- "-Wno-sizeof-array-div", // http://b/148815709
- "-Wno-tautological-overlap-compare", // http://b/148815696
- // New warnings to be fixed after clang-r383902.
- "-Wno-deprecated-copy", // http://b/153746672
- "-Wno-range-loop-construct", // http://b/153747076
- "-Wno-misleading-indentation", // http://b/153746954
- "-Wno-zero-as-null-pointer-constant", // http://b/68236239
- "-Wno-deprecated-anon-enum-enum-conversion", // http://b/153746485
- "-Wno-deprecated-enum-enum-conversion", // http://b/153746563
- "-Wno-string-compare", // http://b/153764102
- "-Wno-enum-enum-conversion", // http://b/154138986
- "-Wno-enum-float-conversion", // http://b/154255917
- "-Wno-pessimizing-move", // http://b/154270751
- // New warnings to be fixed after clang-r399163
- "-Wno-non-c-typedef-for-linkage", // http://b/161304145
- // New warnings to be fixed after clang-r407598
- "-Wno-string-concatenation", // http://b/175068488
- })
-
- // Extra cflags for external third-party projects to disable warnings that
- // are infeasible to fix in all the external projects and their upstream repos.
- exportStringListStaticVariable("ClangExtraExternalCflags", []string{
- "-Wno-enum-compare",
- "-Wno-enum-compare-switch",
-
- // http://b/72331524 Allow null pointer arithmetic until the instances detected by
- // this new warning are fixed.
- "-Wno-null-pointer-arithmetic",
-
- // Bug: http://b/29823425 Disable -Wnull-dereference until the
- // new instances detected by this warning are fixed.
- "-Wno-null-dereference",
-
- // http://b/145211477
- "-Wno-pointer-compare",
- // http://b/145211022
- "-Wno-xor-used-as-pow",
- // http://b/145211022
- "-Wno-final-dtor-non-final-class",
-
- // http://b/165945989
- "-Wno-psabi",
- })
}
func ClangFilterUnknownCflags(cflags []string) []string {
@@ -255,26 +176,10 @@
return result
}
-func ClangFilterUnknownLldflags(lldflags []string) []string {
- result, _ := android.FilterList(lldflags, ClangUnknownLldflags)
- return result
-}
-
func ClangLibToolingFilterUnknownCflags(libToolingFlags []string) []string {
return android.RemoveListFromList(libToolingFlags, ClangLibToolingUnknownCflags)
}
-func inListSorted(s string, list []string) bool {
- for _, l := range list {
- if s == l {
- return true
- } else if s < l {
- return false
- }
- }
- return false
-}
-
func sorted(list []string) []string {
sort.Strings(list)
return list
diff --git a/cc/config/global.go b/cc/config/global.go
index 4957767..bcee06a 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -36,7 +36,6 @@
// Make paths in deps files relative
"-no-canonical-prefixes",
- "-fno-canonical-system-headers",
"-DNDEBUG",
"-UDEBUG",
@@ -61,8 +60,6 @@
commonGlobalConlyflags = []string{}
deviceGlobalCflags = []string{
- "-fdiagnostics-color",
-
"-ffunction-sections",
"-fdata-sections",
"-fno-short-enums",
@@ -78,6 +75,7 @@
"-Werror=address",
"-Werror=sequence-point",
"-Werror=format-security",
+ "-nostdlibinc",
}
deviceGlobalCppflags = []string{
@@ -101,7 +99,7 @@
"-Wl,--icf=safe",
}
- deviceGlobalLldflags = append(ClangFilterUnknownLldflags(deviceGlobalLdflags),
+ deviceGlobalLldflags = append(deviceGlobalLdflags,
[]string{
"-fuse-ld=lld",
}...)
@@ -116,6 +114,15 @@
commonGlobalCppflags = []string{
"-Wsign-promo",
+
+ // -Wimplicit-fallthrough is not enabled by -Wall.
+ "-Wimplicit-fallthrough",
+
+ // Enable clang's thread-safety annotations in libcxx.
+ "-D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS",
+
+ // libc++'s math.h has an #include_next outside of system_headers.
+ "-Wno-gnu-include-next",
}
noOverrideGlobalCflags = []string{
@@ -133,6 +140,66 @@
// http://b/161386391 for -Wno-pointer-to-int-cast
"-Wno-pointer-to-int-cast",
"-Werror=fortify-source",
+
+ "-Werror=address-of-temporary",
+ // Bug: http://b/29823425 Disable -Wnull-dereference until the
+ // new cases detected by this warning in Clang r271374 are
+ // fixed.
+ //"-Werror=null-dereference",
+ "-Werror=return-type",
+
+ // http://b/72331526 Disable -Wtautological-* until the instances detected by these
+ // new warnings are fixed.
+ "-Wno-tautological-constant-compare",
+ "-Wno-tautological-type-limit-compare",
+ // http://b/145210666
+ "-Wno-reorder-init-list",
+ // http://b/145211066
+ "-Wno-implicit-int-float-conversion",
+ // New warnings to be fixed after clang-r377782.
+ "-Wno-int-in-bool-context", // http://b/148287349
+ "-Wno-sizeof-array-div", // http://b/148815709
+ "-Wno-tautological-overlap-compare", // http://b/148815696
+ // New warnings to be fixed after clang-r383902.
+ "-Wno-deprecated-copy", // http://b/153746672
+ "-Wno-range-loop-construct", // http://b/153747076
+ "-Wno-misleading-indentation", // http://b/153746954
+ "-Wno-zero-as-null-pointer-constant", // http://b/68236239
+ "-Wno-deprecated-anon-enum-enum-conversion", // http://b/153746485
+ "-Wno-deprecated-enum-enum-conversion", // http://b/153746563
+ "-Wno-string-compare", // http://b/153764102
+ "-Wno-enum-enum-conversion", // http://b/154138986
+ "-Wno-enum-float-conversion", // http://b/154255917
+ "-Wno-pessimizing-move", // http://b/154270751
+ // New warnings to be fixed after clang-r399163
+ "-Wno-non-c-typedef-for-linkage", // http://b/161304145
+ // New warnings to be fixed after clang-r407598
+ "-Wno-string-concatenation", // http://b/175068488
+ }
+
+ // Extra cflags for external third-party projects to disable warnings that
+ // are infeasible to fix in all the external projects and their upstream repos.
+ extraExternalCflags = []string{
+ "-Wno-enum-compare",
+ "-Wno-enum-compare-switch",
+
+ // http://b/72331524 Allow null pointer arithmetic until the instances detected by
+ // this new warning are fixed.
+ "-Wno-null-pointer-arithmetic",
+
+ // Bug: http://b/29823425 Disable -Wnull-dereference until the
+ // new instances detected by this warning are fixed.
+ "-Wno-null-dereference",
+
+ // http://b/145211477
+ "-Wno-pointer-compare",
+ // http://b/145211022
+ "-Wno-xor-used-as-pow",
+ // http://b/145211022
+ "-Wno-final-dtor-non-final-class",
+
+ // http://b/165945989
+ "-Wno-psabi",
}
IllegalFlags = []string{
@@ -174,20 +241,20 @@
exportStringListStaticVariable("HostGlobalLdflags", hostGlobalLdflags)
exportStringListStaticVariable("HostGlobalLldflags", hostGlobalLldflags)
- // Export the static default CommonClangGlobalCflags to Bazel.
+ // Export the static default CommonGlobalCflags to Bazel.
// TODO(187086342): handle cflags that are set in VariableFuncs.
- commonClangGlobalCFlags := append(
- ClangFilterUnknownCflags(commonGlobalCflags),
+ bazelCommonGlobalCflags := append(
+ commonGlobalCflags,
[]string{
"${ClangExtraCflags}",
// Default to zero initialization.
"-ftrivial-auto-var-init=zero",
"-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang",
}...)
- exportedStringListVars.Set("CommonClangGlobalCflags", commonClangGlobalCFlags)
+ exportedStringListVars.Set("CommonGlobalCflags", bazelCommonGlobalCflags)
- pctx.VariableFunc("CommonClangGlobalCflags", func(ctx android.PackageVarContext) string {
- flags := ClangFilterUnknownCflags(commonGlobalCflags)
+ pctx.VariableFunc("CommonGlobalCflags", func(ctx android.PackageVarContext) string {
+ flags := commonGlobalCflags
flags = append(flags, "${ClangExtraCflags}")
// http://b/131390872
@@ -206,23 +273,18 @@
return strings.Join(flags, " ")
})
- // Export the static default DeviceClangGlobalCflags to Bazel.
+ // Export the static default DeviceGlobalCflags to Bazel.
// TODO(187086342): handle cflags that are set in VariableFuncs.
- deviceClangGlobalCflags := append(ClangFilterUnknownCflags(deviceGlobalCflags), "${ClangExtraTargetCflags}")
- exportedStringListVars.Set("DeviceClangGlobalCflags", deviceClangGlobalCflags)
+ exportedStringListVars.Set("DeviceGlobalCflags", deviceGlobalCflags)
- pctx.VariableFunc("DeviceClangGlobalCflags", func(ctx android.PackageVarContext) string {
- if ctx.Config().Fuchsia() {
- return strings.Join(ClangFilterUnknownCflags(deviceGlobalCflags), " ")
- } else {
- return strings.Join(deviceClangGlobalCflags, " ")
- }
+ pctx.VariableFunc("DeviceGlobalCflags", func(ctx android.PackageVarContext) string {
+ return strings.Join(deviceGlobalCflags, " ")
})
- exportStringListStaticVariable("HostClangGlobalCflags", ClangFilterUnknownCflags(hostGlobalCflags))
- exportStringListStaticVariable("NoOverrideClangGlobalCflags", append(ClangFilterUnknownCflags(noOverrideGlobalCflags), "${ClangExtraNoOverrideCflags}"))
- exportStringListStaticVariable("CommonClangGlobalCppflags", append(ClangFilterUnknownCflags(commonGlobalCppflags), "${ClangExtraCppflags}"))
- exportStringListStaticVariable("ClangExternalCflags", []string{"${ClangExtraExternalCflags}"})
+ exportStringListStaticVariable("HostGlobalCflags", hostGlobalCflags)
+ exportStringListStaticVariable("NoOverrideGlobalCflags", noOverrideGlobalCflags)
+ exportStringListStaticVariable("CommonGlobalCppflags", commonGlobalCppflags)
+ exportStringListStaticVariable("ExternalCflags", extraExternalCflags)
// Everything in these lists is a crime against abstraction and dependency tracking.
// Do not add anything to this list.
diff --git a/cc/config/toolchain.go b/cc/config/toolchain.go
index ab09751..ff556f1 100644
--- a/cc/config/toolchain.go
+++ b/cc/config/toolchain.go
@@ -82,14 +82,14 @@
IncludeFlags() string
ClangTriple() string
- ToolchainClangCflags() string
- ToolchainClangLdflags() string
- ClangAsflags() string
- ClangCflags() string
- ClangCppflags() string
- ClangLdflags() string
- ClangLldflags() string
- ClangInstructionSetFlags(string) (string, error)
+ ToolchainCflags() string
+ ToolchainLdflags() string
+ Asflags() string
+ Cflags() string
+ Cppflags() string
+ Ldflags() string
+ Lldflags() string
+ InstructionSetFlags(string) (string, error)
ndkTriple() string
@@ -136,18 +136,18 @@
return triple
}
-func (toolchainBase) ClangInstructionSetFlags(s string) (string, error) {
+func (toolchainBase) InstructionSetFlags(s string) (string, error) {
if s != "" {
return "", fmt.Errorf("instruction_set: %s is not a supported instruction set", s)
}
return "", nil
}
-func (toolchainBase) ToolchainClangCflags() string {
+func (toolchainBase) ToolchainCflags() string {
return ""
}
-func (toolchainBase) ToolchainClangLdflags() string {
+func (toolchainBase) ToolchainLdflags() string {
return ""
}
@@ -159,7 +159,7 @@
return ""
}
-func (toolchainBase) ClangAsflags() string {
+func (toolchainBase) Asflags() string {
return ""
}
diff --git a/cc/config/x86_64_device.go b/cc/config/x86_64_device.go
index 54dc6d5..c4f47a7 100644
--- a/cc/config/x86_64_device.go
+++ b/cc/config/x86_64_device.go
@@ -32,8 +32,6 @@
"-Wl,--hash-style=gnu",
}
- x86_64Lldflags = ClangFilterUnknownLldflags(x86_64Ldflags)
-
x86_64ArchVariantCflags = map[string][]string{
"": []string{
"-march=x86-64",
@@ -102,13 +100,11 @@
pctx.StaticVariable("X86_64ToolchainLdflags", "-m64")
pctx.StaticVariable("X86_64Ldflags", strings.Join(x86_64Ldflags, " "))
- pctx.StaticVariable("X86_64Lldflags", strings.Join(x86_64Lldflags, " "))
+ pctx.StaticVariable("X86_64Lldflags", strings.Join(x86_64Ldflags, " "))
// Clang cflags
- pctx.StaticVariable("X86_64ClangCflags", strings.Join(ClangFilterUnknownCflags(x86_64Cflags), " "))
- pctx.StaticVariable("X86_64ClangLdflags", strings.Join(ClangFilterUnknownCflags(x86_64Ldflags), " "))
- pctx.StaticVariable("X86_64ClangLldflags", strings.Join(ClangFilterUnknownCflags(x86_64Lldflags), " "))
- pctx.StaticVariable("X86_64ClangCppflags", strings.Join(ClangFilterUnknownCflags(x86_64Cppflags), " "))
+ pctx.StaticVariable("X86_64Cflags", strings.Join(x86_64Cflags, " "))
+ pctx.StaticVariable("X86_64Cppflags", strings.Join(x86_64Cppflags, " "))
// Yasm flags
pctx.StaticVariable("X86_64YasmFlags", "-f elf64 -m amd64")
@@ -117,15 +113,15 @@
// Architecture variant cflags
for variant, cflags := range x86_64ArchVariantCflags {
- pctx.StaticVariable("X86_64"+variant+"VariantClangCflags",
- strings.Join(ClangFilterUnknownCflags(cflags), " "))
+ pctx.StaticVariable("X86_64"+variant+"VariantCflags",
+ strings.Join(cflags, " "))
}
}
type toolchainX86_64 struct {
toolchainBionic
toolchain64Bit
- toolchainClangCflags string
+ toolchainCflags string
}
func (t *toolchainX86_64) Name() string {
@@ -152,27 +148,27 @@
return t.GccTriple()
}
-func (t *toolchainX86_64) ToolchainClangLdflags() string {
+func (t *toolchainX86_64) ToolchainLdflags() string {
return "${config.X86_64ToolchainLdflags}"
}
-func (t *toolchainX86_64) ToolchainClangCflags() string {
- return t.toolchainClangCflags
+func (t *toolchainX86_64) ToolchainCflags() string {
+ return t.toolchainCflags
}
-func (t *toolchainX86_64) ClangCflags() string {
- return "${config.X86_64ClangCflags}"
+func (t *toolchainX86_64) Cflags() string {
+ return "${config.X86_64Cflags}"
}
-func (t *toolchainX86_64) ClangCppflags() string {
- return "${config.X86_64ClangCppflags}"
+func (t *toolchainX86_64) Cppflags() string {
+ return "${config.X86_64Cppflags}"
}
-func (t *toolchainX86_64) ClangLdflags() string {
+func (t *toolchainX86_64) Ldflags() string {
return "${config.X86_64Ldflags}"
}
-func (t *toolchainX86_64) ClangLldflags() string {
+func (t *toolchainX86_64) Lldflags() string {
return "${config.X86_64Lldflags}"
}
@@ -185,17 +181,17 @@
}
func x86_64ToolchainFactory(arch android.Arch) Toolchain {
- toolchainClangCflags := []string{
+ toolchainCflags := []string{
"${config.X86_64ToolchainCflags}",
- "${config.X86_64" + arch.ArchVariant + "VariantClangCflags}",
+ "${config.X86_64" + arch.ArchVariant + "VariantCflags}",
}
for _, feature := range arch.ArchFeatures {
- toolchainClangCflags = append(toolchainClangCflags, x86_64ArchFeatureCflags[feature]...)
+ toolchainCflags = append(toolchainCflags, x86_64ArchFeatureCflags[feature]...)
}
return &toolchainX86_64{
- toolchainClangCflags: strings.Join(toolchainClangCflags, " "),
+ toolchainCflags: strings.Join(toolchainCflags, " "),
}
}
diff --git a/cc/config/x86_64_fuchsia_device.go b/cc/config/x86_64_fuchsia_device.go
index d6837c8..86558a6 100644
--- a/cc/config/x86_64_fuchsia_device.go
+++ b/cc/config/x86_64_fuchsia_device.go
@@ -46,18 +46,6 @@
return x86_64GccVersion
}
-func (t *toolchainFuchsiaX8664) Cflags() string {
- return ""
-}
-
-func (t *toolchainFuchsiaX8664) Cppflags() string {
- return ""
-}
-
-func (t *toolchainFuchsiaX8664) Ldflags() string {
- return ""
-}
-
func (t *toolchainFuchsiaX8664) IncludeFlags() string {
return ""
}
@@ -66,20 +54,20 @@
return "x86_64-fuchsia-android"
}
-func (t *toolchainFuchsiaX8664) ClangCppflags() string {
+func (t *toolchainFuchsiaX8664) Cppflags() string {
return "-Wno-error=deprecated-declarations"
}
-func (t *toolchainFuchsiaX8664) ClangLdflags() string {
+func (t *toolchainFuchsiaX8664) Ldflags() string {
return "--target=x86_64-fuchsia --sysroot=" + fuchsiaSysRoot + " -L" + fuchsiaPrebuiltLibsRoot + "/x86_64-fuchsia/lib " + "-Lprebuilts/fuchsia_sdk/arch/x64/dist/"
}
-func (t *toolchainFuchsiaX8664) ClangLldflags() string {
+func (t *toolchainFuchsiaX8664) Lldflags() string {
return "--target=x86_64-fuchsia --sysroot=" + fuchsiaSysRoot + " -L" + fuchsiaPrebuiltLibsRoot + "/x86_64-fuchsia/lib " + "-Lprebuilts/fuchsia_sdk/arch/x64/dist/"
}
-func (t *toolchainFuchsiaX8664) ClangCflags() string {
+func (t *toolchainFuchsiaX8664) Cflags() string {
return "--target=x86_64-fuchsia --sysroot=" + fuchsiaSysRoot + " -I" + fuchsiaSysRoot + "/include"
}
@@ -87,7 +75,7 @@
return "-f elf64 -m amd64"
}
-func (t *toolchainFuchsiaX8664) ToolchainClangCflags() string {
+func (t *toolchainFuchsiaX8664) ToolchainCflags() string {
return "-mssse3"
}
diff --git a/cc/config/x86_darwin_host.go b/cc/config/x86_darwin_host.go
index 4e3e2a6..d8e70e1 100644
--- a/cc/config/x86_darwin_host.go
+++ b/cc/config/x86_darwin_host.go
@@ -26,8 +26,6 @@
var (
darwinCflags = []string{
- "-fdiagnostics-color",
-
"-fPIC",
"-funwind-tables",
@@ -41,6 +39,9 @@
"-DMACOSX_DEPLOYMENT_TARGET=${macMinVersion}",
"-m64",
+
+ "-integrated-as",
+ "-fstack-protector-strong",
}
darwinLdflags = []string{
@@ -50,15 +51,6 @@
"-m64",
}
- darwinClangCflags = append(ClangFilterUnknownCflags(darwinCflags), []string{
- "-integrated-as",
- "-fstack-protector-strong",
- }...)
-
- darwinClangLdflags = ClangFilterUnknownCflags(darwinLdflags)
-
- darwinClangLldflags = ClangFilterUnknownLldflags(darwinClangLdflags)
-
darwinSupportedSdkVersions = []string{
"10.10",
"10.11",
@@ -115,9 +107,9 @@
pctx.StaticVariable("DarwinGccTriple", "i686-apple-darwin11")
- pctx.StaticVariable("DarwinClangCflags", strings.Join(darwinClangCflags, " "))
- pctx.StaticVariable("DarwinClangLdflags", strings.Join(darwinClangLdflags, " "))
- pctx.StaticVariable("DarwinClangLldflags", strings.Join(darwinClangLldflags, " "))
+ pctx.StaticVariable("DarwinCflags", strings.Join(darwinCflags, " "))
+ pctx.StaticVariable("DarwinLdflags", strings.Join(darwinLdflags, " "))
+ pctx.StaticVariable("DarwinLldflags", strings.Join(darwinLdflags, " "))
pctx.StaticVariable("DarwinYasmFlags", "-f macho -m amd64")
}
@@ -213,20 +205,20 @@
return "x86_64-apple-darwin"
}
-func (t *toolchainDarwin) ClangCflags() string {
- return "${config.DarwinClangCflags}"
+func (t *toolchainDarwin) Cflags() string {
+ return "${config.DarwinCflags}"
}
-func (t *toolchainDarwin) ClangCppflags() string {
+func (t *toolchainDarwin) Cppflags() string {
return ""
}
-func (t *toolchainDarwin) ClangLdflags() string {
- return "${config.DarwinClangLdflags}"
+func (t *toolchainDarwin) Ldflags() string {
+ return "${config.DarwinLdflags}"
}
-func (t *toolchainDarwin) ClangLldflags() string {
- return "${config.DarwinClangLldflags}"
+func (t *toolchainDarwin) Lldflags() string {
+ return "${config.DarwinLldflags}"
}
func (t *toolchainDarwin) YasmFlags() string {
diff --git a/cc/config/x86_device.go b/cc/config/x86_device.go
index 1507d98..5e510a4 100644
--- a/cc/config/x86_device.go
+++ b/cc/config/x86_device.go
@@ -21,16 +21,14 @@
)
var (
- x86Cflags = []string{}
-
- x86ClangCflags = append(x86Cflags, []string{
+ x86Cflags = []string{
"-msse3",
// -mstackrealign is needed to realign stack in native code
// that could be called from JNI, so that movaps instruction
// will work on assumed stack aligned local variables.
"-mstackrealign",
- }...)
+ }
x86Cppflags = []string{}
@@ -38,8 +36,6 @@
"-Wl,--hash-style=gnu",
}
- x86Lldflags = ClangFilterUnknownLldflags(x86Ldflags)
-
x86ArchVariantCflags = map[string][]string{
"": []string{
"-march=prescott",
@@ -49,35 +45,27 @@
},
"atom": []string{
"-march=atom",
- "-mfpmath=sse",
},
"broadwell": []string{
"-march=broadwell",
- "-mfpmath=sse",
},
"haswell": []string{
"-march=core-avx2",
- "-mfpmath=sse",
},
"ivybridge": []string{
"-march=core-avx-i",
- "-mfpmath=sse",
},
"sandybridge": []string{
"-march=corei7",
- "-mfpmath=sse",
},
"silvermont": []string{
"-march=slm",
- "-mfpmath=sse",
},
"skylake": []string{
"-march=skylake",
- "-mfpmath=sse",
},
"stoneyridge": []string{
"-march=bdver4",
- "-mfpmath=sse",
},
}
@@ -113,13 +101,11 @@
pctx.StaticVariable("X86ToolchainLdflags", "-m32")
pctx.StaticVariable("X86Ldflags", strings.Join(x86Ldflags, " "))
- pctx.StaticVariable("X86Lldflags", strings.Join(x86Lldflags, " "))
+ pctx.StaticVariable("X86Lldflags", strings.Join(x86Ldflags, " "))
// Clang cflags
- pctx.StaticVariable("X86ClangCflags", strings.Join(ClangFilterUnknownCflags(x86ClangCflags), " "))
- pctx.StaticVariable("X86ClangLdflags", strings.Join(ClangFilterUnknownCflags(x86Ldflags), " "))
- pctx.StaticVariable("X86ClangLldflags", strings.Join(ClangFilterUnknownCflags(x86Lldflags), " "))
- pctx.StaticVariable("X86ClangCppflags", strings.Join(ClangFilterUnknownCflags(x86Cppflags), " "))
+ pctx.StaticVariable("X86Cflags", strings.Join(x86Cflags, " "))
+ pctx.StaticVariable("X86Cppflags", strings.Join(x86Cppflags, " "))
// Yasm flags
pctx.StaticVariable("X86YasmFlags", "-f elf32 -m x86")
@@ -128,15 +114,15 @@
// Architecture variant cflags
for variant, cflags := range x86ArchVariantCflags {
- pctx.StaticVariable("X86"+variant+"VariantClangCflags",
- strings.Join(ClangFilterUnknownCflags(cflags), " "))
+ pctx.StaticVariable("X86"+variant+"VariantCflags",
+ strings.Join(cflags, " "))
}
}
type toolchainX86 struct {
toolchainBionic
toolchain32Bit
- toolchainClangCflags string
+ toolchainCflags string
}
func (t *toolchainX86) Name() string {
@@ -163,27 +149,27 @@
return "i686-linux-android"
}
-func (t *toolchainX86) ToolchainClangLdflags() string {
+func (t *toolchainX86) ToolchainLdflags() string {
return "${config.X86ToolchainLdflags}"
}
-func (t *toolchainX86) ToolchainClangCflags() string {
- return t.toolchainClangCflags
+func (t *toolchainX86) ToolchainCflags() string {
+ return t.toolchainCflags
}
-func (t *toolchainX86) ClangCflags() string {
- return "${config.X86ClangCflags}"
+func (t *toolchainX86) Cflags() string {
+ return "${config.X86Cflags}"
}
-func (t *toolchainX86) ClangCppflags() string {
- return "${config.X86ClangCppflags}"
+func (t *toolchainX86) Cppflags() string {
+ return "${config.X86Cppflags}"
}
-func (t *toolchainX86) ClangLdflags() string {
+func (t *toolchainX86) Ldflags() string {
return "${config.X86Ldflags}"
}
-func (t *toolchainX86) ClangLldflags() string {
+func (t *toolchainX86) Lldflags() string {
return "${config.X86Lldflags}"
}
@@ -196,17 +182,17 @@
}
func x86ToolchainFactory(arch android.Arch) Toolchain {
- toolchainClangCflags := []string{
+ toolchainCflags := []string{
"${config.X86ToolchainCflags}",
- "${config.X86" + arch.ArchVariant + "VariantClangCflags}",
+ "${config.X86" + arch.ArchVariant + "VariantCflags}",
}
for _, feature := range arch.ArchFeatures {
- toolchainClangCflags = append(toolchainClangCflags, x86ArchFeatureCflags[feature]...)
+ toolchainCflags = append(toolchainCflags, x86ArchFeatureCflags[feature]...)
}
return &toolchainX86{
- toolchainClangCflags: strings.Join(toolchainClangCflags, " "),
+ toolchainCflags: strings.Join(toolchainCflags, " "),
}
}
diff --git a/cc/config/x86_linux_bionic_host.go b/cc/config/x86_linux_bionic_host.go
index e7e5f2d..4b7ba6a 100644
--- a/cc/config/x86_linux_bionic_host.go
+++ b/cc/config/x86_linux_bionic_host.go
@@ -21,9 +21,7 @@
)
var (
- linuxBionicCflags = ClangFilterUnknownCflags([]string{
- "-fdiagnostics-color",
-
+ linuxBionicCflags = []string{
"-Wa,--noexecstack",
"-fPIC",
@@ -34,21 +32,17 @@
// From x86_64_device
"-ffunction-sections",
- "-finline-functions",
- "-finline-limit=300",
"-fno-short-enums",
- "-funswitch-loops",
"-funwind-tables",
- "-fno-canonical-system-headers",
// Tell clang where the gcc toolchain is
"--gcc-toolchain=${LinuxBionicGccRoot}",
// This is normally in ClangExtraTargetCflags, but this is considered host
"-nostdlibinc",
- })
+ }
- linuxBionicLdflags = ClangFilterUnknownCflags([]string{
+ linuxBionicLdflags = []string{
"-Wl,-z,noexecstack",
"-Wl,-z,relro",
"-Wl,-z,now",
@@ -60,9 +54,7 @@
// Use the device gcc toolchain
"--gcc-toolchain=${LinuxBionicGccRoot}",
- })
-
- linuxBionicLldflags = ClangFilterUnknownLldflags(linuxBionicLdflags)
+ }
// Embed the linker into host bionic binaries. This is needed to support host bionic,
// as the linux kernel requires that the ELF interpreter referenced by PT_INTERP be
@@ -78,7 +70,7 @@
func init() {
pctx.StaticVariable("LinuxBionicCflags", strings.Join(linuxBionicCflags, " "))
pctx.StaticVariable("LinuxBionicLdflags", strings.Join(linuxBionicLdflags, " "))
- pctx.StaticVariable("LinuxBionicLldflags", strings.Join(linuxBionicLldflags, " "))
+ pctx.StaticVariable("LinuxBionicLldflags", strings.Join(linuxBionicLdflags, " "))
// Use the device gcc toolchain for now
pctx.StaticVariable("LinuxBionicGccRoot", "${X86_64GccRoot}")
@@ -114,29 +106,29 @@
return "x86_64-linux-android"
}
-func (t *toolchainLinuxBionic) ClangCflags() string {
+func (t *toolchainLinuxBionic) Cflags() string {
return "${config.LinuxBionicCflags}"
}
-func (t *toolchainLinuxBionic) ClangCppflags() string {
+func (t *toolchainLinuxBionic) Cppflags() string {
return ""
}
-func (t *toolchainLinuxBionic) ClangLdflags() string {
+func (t *toolchainLinuxBionic) Ldflags() string {
return "${config.LinuxBionicLdflags}"
}
-func (t *toolchainLinuxBionic) ClangLldflags() string {
+func (t *toolchainLinuxBionic) Lldflags() string {
return "${config.LinuxBionicLldflags}"
}
-func (t *toolchainLinuxBionic) ToolchainClangCflags() string {
+func (t *toolchainLinuxBionic) ToolchainCflags() string {
return "-m64 -march=x86-64" +
// TODO: We're not really android, but we don't have a triple yet b/31393676
" -U__ANDROID__"
}
-func (t *toolchainLinuxBionic) ToolchainClangLdflags() string {
+func (t *toolchainLinuxBionic) ToolchainLdflags() string {
return "-m64"
}
diff --git a/cc/config/x86_linux_host.go b/cc/config/x86_linux_host.go
index c406c88..85d95d8 100644
--- a/cc/config/x86_linux_host.go
+++ b/cc/config/x86_linux_host.go
@@ -22,8 +22,6 @@
var (
linuxCflags = []string{
- "-fdiagnostics-color",
-
"-Wa,--noexecstack",
"-fPIC",
@@ -36,6 +34,10 @@
//See bug 12708004.
"-D__STDC_FORMAT_MACROS",
"-D__STDC_CONSTANT_MACROS",
+
+ "--gcc-toolchain=${LinuxGccRoot}",
+ "--sysroot ${LinuxGccRoot}/sysroot",
+ "-fstack-protector-strong",
}
linuxLdflags = []string{
@@ -43,12 +45,14 @@
"-Wl,-z,relro",
"-Wl,-z,now",
"-Wl,--no-undefined-version",
+
+ "--gcc-toolchain=${LinuxGccRoot}",
+ "--sysroot ${LinuxGccRoot}/sysroot",
}
// Extended cflags
linuxX86Cflags = []string{
"-msse3",
- "-mfpmath=sse",
"-m32",
"-march=prescott",
"-D_FILE_OFFSET_BITS=64",
@@ -61,40 +65,17 @@
linuxX86Ldflags = []string{
"-m32",
+ "-B${LinuxGccRoot}/lib/gcc/${LinuxGccTriple}/${LinuxGccVersion}/32",
+ "-L${LinuxGccRoot}/lib/gcc/${LinuxGccTriple}/${LinuxGccVersion}/32",
+ "-L${LinuxGccRoot}/${LinuxGccTriple}/lib32",
}
linuxX8664Ldflags = []string{
"-m64",
- }
-
- linuxClangCflags = append(ClangFilterUnknownCflags(linuxCflags), []string{
- "--gcc-toolchain=${LinuxGccRoot}",
- "--sysroot ${LinuxGccRoot}/sysroot",
- "-fstack-protector-strong",
- }...)
-
- linuxClangLdflags = append(ClangFilterUnknownCflags(linuxLdflags), []string{
- "--gcc-toolchain=${LinuxGccRoot}",
- "--sysroot ${LinuxGccRoot}/sysroot",
- }...)
-
- linuxClangLldflags = ClangFilterUnknownLldflags(linuxClangLdflags)
-
- linuxX86ClangLdflags = append(ClangFilterUnknownCflags(linuxX86Ldflags), []string{
- "-B${LinuxGccRoot}/lib/gcc/${LinuxGccTriple}/${LinuxGccVersion}/32",
- "-L${LinuxGccRoot}/lib/gcc/${LinuxGccTriple}/${LinuxGccVersion}/32",
- "-L${LinuxGccRoot}/${LinuxGccTriple}/lib32",
- }...)
-
- linuxX86ClangLldflags = ClangFilterUnknownLldflags(linuxX86ClangLdflags)
-
- linuxX8664ClangLdflags = append(ClangFilterUnknownCflags(linuxX8664Ldflags), []string{
"-B${LinuxGccRoot}/lib/gcc/${LinuxGccTriple}/${LinuxGccVersion}",
"-L${LinuxGccRoot}/lib/gcc/${LinuxGccTriple}/${LinuxGccVersion}",
"-L${LinuxGccRoot}/${LinuxGccTriple}/lib64",
- }...)
-
- linuxX8664ClangLldflags = ClangFilterUnknownLldflags(linuxX8664ClangLdflags)
+ }
linuxAvailableLibraries = addPrefix([]string{
"c",
@@ -130,18 +111,16 @@
pctx.StaticVariable("LinuxGccTriple", "x86_64-linux")
- pctx.StaticVariable("LinuxClangCflags", strings.Join(linuxClangCflags, " "))
- pctx.StaticVariable("LinuxClangLdflags", strings.Join(linuxClangLdflags, " "))
- pctx.StaticVariable("LinuxClangLldflags", strings.Join(linuxClangLldflags, " "))
+ pctx.StaticVariable("LinuxCflags", strings.Join(linuxCflags, " "))
+ pctx.StaticVariable("LinuxLdflags", strings.Join(linuxLdflags, " "))
+ pctx.StaticVariable("LinuxLldflags", strings.Join(linuxLdflags, " "))
- pctx.StaticVariable("LinuxX86ClangCflags",
- strings.Join(ClangFilterUnknownCflags(linuxX86Cflags), " "))
- pctx.StaticVariable("LinuxX8664ClangCflags",
- strings.Join(ClangFilterUnknownCflags(linuxX8664Cflags), " "))
- pctx.StaticVariable("LinuxX86ClangLdflags", strings.Join(linuxX86ClangLdflags, " "))
- pctx.StaticVariable("LinuxX86ClangLldflags", strings.Join(linuxX86ClangLldflags, " "))
- pctx.StaticVariable("LinuxX8664ClangLdflags", strings.Join(linuxX8664ClangLdflags, " "))
- pctx.StaticVariable("LinuxX8664ClangLldflags", strings.Join(linuxX8664ClangLldflags, " "))
+ pctx.StaticVariable("LinuxX86Cflags", strings.Join(linuxX86Cflags, " "))
+ pctx.StaticVariable("LinuxX8664Cflags", strings.Join(linuxX8664Cflags, " "))
+ pctx.StaticVariable("LinuxX86Ldflags", strings.Join(linuxX86Ldflags, " "))
+ pctx.StaticVariable("LinuxX86Lldflags", strings.Join(linuxX86Ldflags, " "))
+ pctx.StaticVariable("LinuxX8664Ldflags", strings.Join(linuxX8664Ldflags, " "))
+ pctx.StaticVariable("LinuxX8664Lldflags", strings.Join(linuxX8664Ldflags, " "))
// Yasm flags
pctx.StaticVariable("LinuxX86YasmFlags", "-f elf32 -m x86")
pctx.StaticVariable("LinuxX8664YasmFlags", "-f elf64 -m amd64")
@@ -189,11 +168,11 @@
return "i686-linux-gnu"
}
-func (t *toolchainLinuxX86) ClangCflags() string {
- return "${config.LinuxClangCflags} ${config.LinuxX86ClangCflags}"
+func (t *toolchainLinuxX86) Cflags() string {
+ return "${config.LinuxCflags} ${config.LinuxX86Cflags}"
}
-func (t *toolchainLinuxX86) ClangCppflags() string {
+func (t *toolchainLinuxX86) Cppflags() string {
return ""
}
@@ -201,28 +180,28 @@
return "x86_64-linux-gnu"
}
-func (t *toolchainLinuxX8664) ClangCflags() string {
- return "${config.LinuxClangCflags} ${config.LinuxX8664ClangCflags}"
+func (t *toolchainLinuxX8664) Cflags() string {
+ return "${config.LinuxCflags} ${config.LinuxX8664Cflags}"
}
-func (t *toolchainLinuxX8664) ClangCppflags() string {
+func (t *toolchainLinuxX8664) Cppflags() string {
return ""
}
-func (t *toolchainLinuxX86) ClangLdflags() string {
- return "${config.LinuxClangLdflags} ${config.LinuxX86ClangLdflags}"
+func (t *toolchainLinuxX86) Ldflags() string {
+ return "${config.LinuxLdflags} ${config.LinuxX86Ldflags}"
}
-func (t *toolchainLinuxX86) ClangLldflags() string {
- return "${config.LinuxClangLldflags} ${config.LinuxX86ClangLldflags}"
+func (t *toolchainLinuxX86) Lldflags() string {
+ return "${config.LinuxLldflags} ${config.LinuxX86Lldflags}"
}
-func (t *toolchainLinuxX8664) ClangLdflags() string {
- return "${config.LinuxClangLdflags} ${config.LinuxX8664ClangLdflags}"
+func (t *toolchainLinuxX8664) Ldflags() string {
+ return "${config.LinuxLdflags} ${config.LinuxX8664Ldflags}"
}
-func (t *toolchainLinuxX8664) ClangLldflags() string {
- return "${config.LinuxClangLldflags} ${config.LinuxX8664ClangLldflags}"
+func (t *toolchainLinuxX8664) Lldflags() string {
+ return "${config.LinuxLldflags} ${config.LinuxX8664Lldflags}"
}
func (t *toolchainLinuxX86) YasmFlags() string {
diff --git a/cc/config/x86_windows_host.go b/cc/config/x86_windows_host.go
index b77df79..d9a7537 100644
--- a/cc/config/x86_windows_host.go
+++ b/cc/config/x86_windows_host.go
@@ -44,32 +44,28 @@
"--sysroot ${WindowsGccRoot}/${WindowsGccTriple}",
}
- windowsClangCflags = append(ClangFilterUnknownCflags(windowsCflags), []string{}...)
windowsIncludeFlags = []string{
"-isystem ${WindowsGccRoot}/${WindowsGccTriple}/include",
}
- windowsClangCppflags = []string{}
+ windowsCppflags = []string{}
- windowsX86ClangCppflags = []string{
+ windowsX86Cppflags = []string{
// Use SjLj exceptions for 32-bit. libgcc_eh implements SjLj
// exception model for 32-bit.
"-fsjlj-exceptions",
}
- windowsX8664ClangCppflags = []string{}
+ windowsX8664Cppflags = []string{}
windowsLdflags = []string{
- "--enable-stdcall-fixup",
"-Wl,--dynamicbase",
"-Wl,--nxcompat",
}
- windowsLldflags = []string{
+ windowsLldflags = append(windowsLdflags, []string{
"-Wl,--Xlink=-Brepro", // Enable deterministic build
- }
- windowsClangLdflags = append(ClangFilterUnknownCflags(windowsLdflags), []string{}...)
- windowsClangLldflags = append(ClangFilterUnknownLldflags(windowsClangLdflags), windowsLldflags...)
+ }...)
windowsX86Cflags = []string{
"-m32",
@@ -84,28 +80,24 @@
"-Wl,--large-address-aware",
"-L${WindowsGccRoot}/${WindowsGccTriple}/lib32",
"-static-libgcc",
- }
- windowsX86ClangLdflags = append(ClangFilterUnknownCflags(windowsX86Ldflags), []string{
+
"-B${WindowsGccRoot}/${WindowsGccTriple}/bin",
"-B${WindowsGccRoot}/lib/gcc/${WindowsGccTriple}/4.8.3/32",
"-L${WindowsGccRoot}/lib/gcc/${WindowsGccTriple}/4.8.3/32",
"-B${WindowsGccRoot}/${WindowsGccTriple}/lib32",
- }...)
- windowsX86ClangLldflags = ClangFilterUnknownLldflags(windowsX86ClangLdflags)
+ }
windowsX8664Ldflags = []string{
"-m64",
"-L${WindowsGccRoot}/${WindowsGccTriple}/lib64",
"-Wl,--high-entropy-va",
"-static-libgcc",
- }
- windowsX8664ClangLdflags = append(ClangFilterUnknownCflags(windowsX8664Ldflags), []string{
+
"-B${WindowsGccRoot}/${WindowsGccTriple}/bin",
"-B${WindowsGccRoot}/lib/gcc/${WindowsGccTriple}/4.8.3",
"-L${WindowsGccRoot}/lib/gcc/${WindowsGccTriple}/4.8.3",
"-B${WindowsGccRoot}/${WindowsGccTriple}/lib64",
- }...)
- windowsX8664ClangLldflags = ClangFilterUnknownLldflags(windowsX8664ClangLdflags)
+ }
windowsAvailableLibraries = addPrefix([]string{
"gdi32",
@@ -138,21 +130,19 @@
pctx.StaticVariable("WindowsGccTriple", "x86_64-w64-mingw32")
- pctx.StaticVariable("WindowsClangCflags", strings.Join(windowsClangCflags, " "))
- pctx.StaticVariable("WindowsClangLdflags", strings.Join(windowsClangLdflags, " "))
- pctx.StaticVariable("WindowsClangLldflags", strings.Join(windowsClangLldflags, " "))
- pctx.StaticVariable("WindowsClangCppflags", strings.Join(windowsClangCppflags, " "))
+ pctx.StaticVariable("WindowsCflags", strings.Join(windowsCflags, " "))
+ pctx.StaticVariable("WindowsLdflags", strings.Join(windowsLdflags, " "))
+ pctx.StaticVariable("WindowsLldflags", strings.Join(windowsLldflags, " "))
+ pctx.StaticVariable("WindowsCppflags", strings.Join(windowsCppflags, " "))
- pctx.StaticVariable("WindowsX86ClangCflags",
- strings.Join(ClangFilterUnknownCflags(windowsX86Cflags), " "))
- pctx.StaticVariable("WindowsX8664ClangCflags",
- strings.Join(ClangFilterUnknownCflags(windowsX8664Cflags), " "))
- pctx.StaticVariable("WindowsX86ClangLdflags", strings.Join(windowsX86ClangLdflags, " "))
- pctx.StaticVariable("WindowsX86ClangLldflags", strings.Join(windowsX86ClangLldflags, " "))
- pctx.StaticVariable("WindowsX8664ClangLdflags", strings.Join(windowsX8664ClangLdflags, " "))
- pctx.StaticVariable("WindowsX8664ClangLldflags", strings.Join(windowsX8664ClangLldflags, " "))
- pctx.StaticVariable("WindowsX86ClangCppflags", strings.Join(windowsX86ClangCppflags, " "))
- pctx.StaticVariable("WindowsX8664ClangCppflags", strings.Join(windowsX8664ClangCppflags, " "))
+ pctx.StaticVariable("WindowsX86Cflags", strings.Join(windowsX86Cflags, " "))
+ pctx.StaticVariable("WindowsX8664Cflags", strings.Join(windowsX8664Cflags, " "))
+ pctx.StaticVariable("WindowsX86Ldflags", strings.Join(windowsX86Ldflags, " "))
+ pctx.StaticVariable("WindowsX86Lldflags", strings.Join(windowsX86Ldflags, " "))
+ pctx.StaticVariable("WindowsX8664Ldflags", strings.Join(windowsX8664Ldflags, " "))
+ pctx.StaticVariable("WindowsX8664Lldflags", strings.Join(windowsX8664Ldflags, " "))
+ pctx.StaticVariable("WindowsX86Cppflags", strings.Join(windowsX86Cppflags, " "))
+ pctx.StaticVariable("WindowsX8664Cppflags", strings.Join(windowsX8664Cppflags, " "))
pctx.StaticVariable("WindowsIncludeFlags", strings.Join(windowsIncludeFlags, " "))
// Yasm flags
@@ -214,36 +204,36 @@
return "x86_64-pc-windows-gnu"
}
-func (t *toolchainWindowsX86) ClangCflags() string {
- return "${config.WindowsClangCflags} ${config.WindowsX86ClangCflags}"
+func (t *toolchainWindowsX86) Cflags() string {
+ return "${config.WindowsCflags} ${config.WindowsX86Cflags}"
}
-func (t *toolchainWindowsX8664) ClangCflags() string {
- return "${config.WindowsClangCflags} ${config.WindowsX8664ClangCflags}"
+func (t *toolchainWindowsX8664) Cflags() string {
+ return "${config.WindowsCflags} ${config.WindowsX8664Cflags}"
}
-func (t *toolchainWindowsX86) ClangCppflags() string {
- return "${config.WindowsClangCppflags} ${config.WindowsX86ClangCppflags}"
+func (t *toolchainWindowsX86) Cppflags() string {
+ return "${config.WindowsCppflags} ${config.WindowsX86Cppflags}"
}
-func (t *toolchainWindowsX8664) ClangCppflags() string {
- return "${config.WindowsClangCppflags} ${config.WindowsX8664ClangCppflags}"
+func (t *toolchainWindowsX8664) Cppflags() string {
+ return "${config.WindowsCppflags} ${config.WindowsX8664Cppflags}"
}
-func (t *toolchainWindowsX86) ClangLdflags() string {
- return "${config.WindowsClangLdflags} ${config.WindowsX86ClangLdflags}"
+func (t *toolchainWindowsX86) Ldflags() string {
+ return "${config.WindowsLdflags} ${config.WindowsX86Ldflags}"
}
-func (t *toolchainWindowsX86) ClangLldflags() string {
- return "${config.WindowsClangLldflags} ${config.WindowsX86ClangLldflags}"
+func (t *toolchainWindowsX86) Lldflags() string {
+ return "${config.WindowsLldflags} ${config.WindowsX86Lldflags}"
}
-func (t *toolchainWindowsX8664) ClangLdflags() string {
- return "${config.WindowsClangLdflags} ${config.WindowsX8664ClangLdflags}"
+func (t *toolchainWindowsX8664) Ldflags() string {
+ return "${config.WindowsLdflags} ${config.WindowsX8664Ldflags}"
}
-func (t *toolchainWindowsX8664) ClangLldflags() string {
- return "${config.WindowsClangLldflags} ${config.WindowsX8664ClangLldflags}"
+func (t *toolchainWindowsX8664) Lldflags() string {
+ return "${config.WindowsLldflags} ${config.WindowsX8664Lldflags}"
}
func (t *toolchainWindowsX86) YasmFlags() string {
diff --git a/cc/linker.go b/cc/linker.go
index 13df232..a712391 100644
--- a/cc/linker.go
+++ b/cc/linker.go
@@ -479,9 +479,9 @@
}
if linker.useClangLld(ctx) {
- flags.Global.LdFlags = append(flags.Global.LdFlags, toolchain.ClangLldflags())
+ flags.Global.LdFlags = append(flags.Global.LdFlags, toolchain.Lldflags())
} else {
- flags.Global.LdFlags = append(flags.Global.LdFlags, toolchain.ClangLdflags())
+ flags.Global.LdFlags = append(flags.Global.LdFlags, toolchain.Ldflags())
}
if !ctx.toolchain().Bionic() && !ctx.Fuchsia() {
@@ -535,7 +535,7 @@
flags.Global.LdFlags = append(flags.Global.LdFlags, "-Wl,--hash-style=both")
}
- flags.Global.LdFlags = append(flags.Global.LdFlags, toolchain.ToolchainClangLdflags())
+ flags.Global.LdFlags = append(flags.Global.LdFlags, toolchain.ToolchainLdflags())
if Bool(linker.Properties.Group_static_libs) {
flags.GroupStaticLibs = true
diff --git a/cc/makevars.go b/cc/makevars.go
index 2b326ef..393170a 100644
--- a/cc/makevars.go
+++ b/cc/makevars.go
@@ -92,8 +92,8 @@
ctx.Strict("RS_LLVM_AS", "${config.RSLLVMPrebuiltsPath}/llvm-as")
ctx.Strict("RS_LLVM_LINK", "${config.RSLLVMPrebuiltsPath}/llvm-link")
- ctx.Strict("CLANG_EXTERNAL_CFLAGS", "${config.ClangExternalCflags}")
- ctx.Strict("GLOBAL_CLANG_CFLAGS_NO_OVERRIDE", "${config.NoOverrideClangGlobalCflags}")
+ ctx.Strict("CLANG_EXTERNAL_CFLAGS", "${config.ExternalCflags}")
+ ctx.Strict("GLOBAL_CLANG_CFLAGS_NO_OVERRIDE", "${config.NoOverrideGlobalCflags}")
ctx.Strict("GLOBAL_CLANG_CPPFLAGS_NO_OVERRIDE", "")
ctx.Strict("BOARD_VNDK_VERSION", ctx.DeviceConfig().VndkVersion())
@@ -212,13 +212,13 @@
ctx.StrictRaw(makePrefix+"C_SYSTEM_INCLUDES", strings.Join(systemIncludes, " "))
if target.Arch.ArchType == android.Arm {
- flags, err := toolchain.ClangInstructionSetFlags("arm")
+ flags, err := toolchain.InstructionSetFlags("arm")
if err != nil {
panic(err)
}
ctx.Strict(makePrefix+"arm_CFLAGS", flags)
- flags, err = toolchain.ClangInstructionSetFlags("thumb")
+ flags, err = toolchain.InstructionSetFlags("thumb")
if err != nil {
panic(err)
}
@@ -230,29 +230,29 @@
ctx.Strict(clangPrefix+"TRIPLE", toolchain.ClangTriple())
ctx.Strict(clangPrefix+"GLOBAL_CFLAGS", strings.Join([]string{
- toolchain.ClangCflags(),
- "${config.CommonClangGlobalCflags}",
- fmt.Sprintf("${config.%sClangGlobalCflags}", hod),
- toolchain.ToolchainClangCflags(),
+ toolchain.Cflags(),
+ "${config.CommonGlobalCflags}",
+ fmt.Sprintf("${config.%sGlobalCflags}", hod),
+ toolchain.ToolchainCflags(),
clangExtras,
productExtraCflags,
}, " "))
ctx.Strict(clangPrefix+"GLOBAL_CPPFLAGS", strings.Join([]string{
- "${config.CommonClangGlobalCppflags}",
+ "${config.CommonGlobalCppflags}",
fmt.Sprintf("${config.%sGlobalCppflags}", hod),
- toolchain.ClangCppflags(),
+ toolchain.Cppflags(),
}, " "))
ctx.Strict(clangPrefix+"GLOBAL_LDFLAGS", strings.Join([]string{
fmt.Sprintf("${config.%sGlobalLdflags}", hod),
- toolchain.ClangLdflags(),
- toolchain.ToolchainClangLdflags(),
+ toolchain.Ldflags(),
+ toolchain.ToolchainLdflags(),
productExtraLdflags,
clangExtras,
}, " "))
ctx.Strict(clangPrefix+"GLOBAL_LLDFLAGS", strings.Join([]string{
fmt.Sprintf("${config.%sGlobalLldflags}", hod),
- toolchain.ClangLldflags(),
- toolchain.ToolchainClangLdflags(),
+ toolchain.Lldflags(),
+ toolchain.ToolchainLdflags(),
productExtraLdflags,
clangExtras,
}, " "))
diff --git a/cc/object.go b/cc/object.go
index 5ded0e9..0f983c8 100644
--- a/cc/object.go
+++ b/cc/object.go
@@ -231,7 +231,7 @@
}
func (object *objectLinker) linkerFlags(ctx ModuleContext, flags Flags) Flags {
- flags.Global.LdFlags = append(flags.Global.LdFlags, ctx.toolchain().ToolchainClangLdflags())
+ flags.Global.LdFlags = append(flags.Global.LdFlags, ctx.toolchain().ToolchainLdflags())
if lds := android.OptionalPathForModuleSrc(ctx, object.Properties.Linker_script); lds.Valid() {
flags.Local.LdFlags = append(flags.Local.LdFlags, "-Wl,-T,"+lds.String())
diff --git a/java/app.go b/java/app.go
index fc6e183..4456b22 100755
--- a/java/app.go
+++ b/java/app.go
@@ -1245,37 +1245,43 @@
}
}
-// Returns a map of module names of shared library dependencies to the paths
-// to their dex jars on host and on device.
+// Returns a map of module names of shared library dependencies to the paths to their dex jars on
+// host and on device.
func (u *usesLibrary) classLoaderContextForUsesLibDeps(ctx android.ModuleContext) dexpreopt.ClassLoaderContextMap {
clcMap := make(dexpreopt.ClassLoaderContextMap)
- // Skip when UnbundledBuild() is true, but UnbundledBuildImage() is false.
- // Added UnbundledBuildImage() condition to generate dexpreopt.config even though unbundled image is built.
- if !ctx.Config().UnbundledBuild() || ctx.Config().UnbundledBuildImage() {
- ctx.VisitDirectDeps(func(m android.Module) {
- if tag, ok := ctx.OtherModuleDependencyTag(m).(usesLibraryDependencyTag); ok {
- dep := ctx.OtherModuleName(m)
- if lib, ok := m.(UsesLibraryDependency); ok {
- libName := android.RemoveOptionalPrebuiltPrefix(dep)
- if ulib, ok := m.(ProvidesUsesLib); ok && ulib.ProvidesUsesLib() != nil {
- libName = android.RemoveOptionalPrebuiltPrefix(*ulib.ProvidesUsesLib())
- // Replace module name with library name in `uses_libs`/`optional_uses_libs`
- // in order to pass verify_uses_libraries check (which compares these
- // properties against library names written in the manifest).
- replaceInList(u.usesLibraryProperties.Uses_libs, dep, libName)
- replaceInList(u.usesLibraryProperties.Optional_uses_libs, dep, libName)
- }
- clcMap.AddContext(ctx, tag.sdkVersion, libName,
- lib.DexJarBuildPath(), lib.DexJarInstallPath(), lib.ClassLoaderContexts())
- } else if ctx.Config().AllowMissingDependencies() {
- ctx.AddMissingDependencies([]string{dep})
- } else {
- ctx.ModuleErrorf("module %q in uses_libs or optional_uses_libs must be a java library", dep)
- }
- }
- })
+
+ // Skip when UnbundledBuild() is true, but UnbundledBuildImage() is false. With
+ // UnbundledBuildImage() it is necessary to generate dexpreopt.config for post-dexpreopting.
+ if ctx.Config().UnbundledBuild() && !ctx.Config().UnbundledBuildImage() {
+ return clcMap
}
+ ctx.VisitDirectDeps(func(m android.Module) {
+ tag, isUsesLibTag := ctx.OtherModuleDependencyTag(m).(usesLibraryDependencyTag)
+ if !isUsesLibTag {
+ return
+ }
+
+ dep := android.RemoveOptionalPrebuiltPrefix(ctx.OtherModuleName(m))
+
+ if lib, ok := m.(UsesLibraryDependency); ok {
+ libName := dep
+ if ulib, ok := m.(ProvidesUsesLib); ok && ulib.ProvidesUsesLib() != nil {
+ libName = *ulib.ProvidesUsesLib()
+ // Replace module name with library name in `uses_libs`/`optional_uses_libs` in
+ // order to pass verify_uses_libraries check (which compares these properties
+ // against library names written in the manifest).
+ replaceInList(u.usesLibraryProperties.Uses_libs, dep, libName)
+ replaceInList(u.usesLibraryProperties.Optional_uses_libs, dep, libName)
+ }
+ clcMap.AddContext(ctx, tag.sdkVersion, libName,
+ lib.DexJarBuildPath(), lib.DexJarInstallPath(), lib.ClassLoaderContexts())
+ } else if ctx.Config().AllowMissingDependencies() {
+ ctx.AddMissingDependencies([]string{dep})
+ } else {
+ ctx.ModuleErrorf("module %q in uses_libs or optional_uses_libs must be a java library", dep)
+ }
+ })
return clcMap
}
diff --git a/java/dexpreopt_bootjars.go b/java/dexpreopt_bootjars.go
index 0ba56ca..dff9543 100644
--- a/java/dexpreopt_bootjars.go
+++ b/java/dexpreopt_bootjars.go
@@ -154,9 +154,18 @@
// PRODUCT_BOOT_JARS_EXTRA variables. The AOSP makefiles specify some common Framework libraries,
// but more product-specific libraries can be added in the product makefiles.
//
-// Each component of the PRODUCT_BOOT_JARS and PRODUCT_BOOT_JARS_EXTRA variables is either a simple
-// name (if the library is a part of the Platform), or a colon-separated pair <apex, name> (if the
-// library is a part of a non-updatable APEX).
+// Each component of the PRODUCT_BOOT_JARS and PRODUCT_BOOT_JARS_EXTRA variables is a
+// colon-separated pair <apex>:<library>, where <apex> is the variant name of a non-updatable APEX,
+// "platform" if the library is a part of the platform in the system partition, or "system_ext" if
+// it's in the system_ext partition.
+//
+// In these variables APEXes are identified by their "variant names", i.e. the names they get
+// mounted as in /apex on device. In Soong modules that is the name set in the "apex_name"
+// properties, which default to the "name" values. For example, many APEXes have both
+// com.android.xxx and com.google.android.xxx modules in Soong, but take the same place
+// /apex/com.android.xxx at runtime. In these cases the variant name is always com.android.xxx,
+// regardless which APEX goes into the product. See also android.ApexInfo.ApexVariationName and
+// apex.apexBundleProperties.Apex_name.
//
// A related variable PRODUCT_UPDATABLE_BOOT_JARS contains bootclasspath libraries that are in
// APEXes. They are not included in the boot image. The only exception here is core-icu4j.jar that
diff --git a/rust/bindgen.go b/rust/bindgen.go
index f9e6cd0..3470e51 100644
--- a/rust/bindgen.go
+++ b/rust/bindgen.go
@@ -137,15 +137,15 @@
implicits = append(implicits, deps.depGeneratedHeaders...)
// Default clang flags
- cflags = append(cflags, "${cc_config.CommonClangGlobalCflags}")
+ cflags = append(cflags, "${cc_config.CommonGlobalCflags}")
if ctx.Device() {
- cflags = append(cflags, "${cc_config.DeviceClangGlobalCflags}")
+ cflags = append(cflags, "${cc_config.DeviceGlobalCflags}")
}
// Toolchain clang flags
cflags = append(cflags, "-target "+ccToolchain.ClangTriple())
- cflags = append(cflags, strings.ReplaceAll(ccToolchain.ClangCflags(), "${config.", "${cc_config."))
- cflags = append(cflags, strings.ReplaceAll(ccToolchain.ToolchainClangCflags(), "${config.", "${cc_config."))
+ cflags = append(cflags, strings.ReplaceAll(ccToolchain.Cflags(), "${config.", "${cc_config."))
+ cflags = append(cflags, strings.ReplaceAll(ccToolchain.ToolchainCflags(), "${config.", "${cc_config."))
// Dependency clang flags and include paths
cflags = append(cflags, deps.depClangFlags...)
diff --git a/rust/config/x86_darwin_host.go b/rust/config/x86_darwin_host.go
index ddd93e8..8ff0dd4 100644
--- a/rust/config/x86_darwin_host.go
+++ b/rust/config/x86_darwin_host.go
@@ -78,7 +78,7 @@
func (t *toolchainDarwinX8664) ToolchainLinkFlags() string {
// Prepend the lld flags from cc_config so we stay in sync with cc
- return "${cc_config.DarwinClangLldflags} ${config.DarwinToolchainLinkFlags} ${config.DarwinToolchainX8664LinkFlags}"
+ return "${cc_config.DarwinLldflags} ${config.DarwinToolchainLinkFlags} ${config.DarwinToolchainX8664LinkFlags}"
}
func (t *toolchainDarwinX8664) ToolchainRustFlags() string {
diff --git a/rust/config/x86_device.go b/rust/config/x86_device.go
index aae1125..5ae30e7 100644
--- a/rust/config/x86_device.go
+++ b/rust/config/x86_device.go
@@ -65,7 +65,7 @@
func (t *toolchainX86) ToolchainLinkFlags() string {
// Prepend the lld flags from cc_config so we stay in sync with cc
- return "${config.DeviceGlobalLinkFlags} ${cc_config.X86ClangLldflags} ${config.X86ToolchainLinkFlags}"
+ return "${config.DeviceGlobalLinkFlags} ${cc_config.X86Lldflags} ${config.X86ToolchainLinkFlags}"
}
func (t *toolchainX86) ToolchainRustFlags() string {
diff --git a/rust/config/x86_linux_host.go b/rust/config/x86_linux_host.go
index b63e14d..a9fdaed 100644
--- a/rust/config/x86_linux_host.go
+++ b/rust/config/x86_linux_host.go
@@ -79,7 +79,7 @@
func (t *toolchainLinuxX8664) ToolchainLinkFlags() string {
// Prepend the lld flags from cc_config so we stay in sync with cc
- return "${cc_config.LinuxClangLldflags} ${cc_config.LinuxX8664ClangLldflags} " +
+ return "${cc_config.LinuxLldflags} ${cc_config.LinuxX8664Lldflags} " +
"${config.LinuxToolchainLinkFlags} ${config.LinuxToolchainX8664LinkFlags}"
}
@@ -117,7 +117,7 @@
func (t *toolchainLinuxX86) ToolchainLinkFlags() string {
// Prepend the lld flags from cc_config so we stay in sync with cc
- return "${cc_config.LinuxClangLldflags} ${cc_config.LinuxX86ClangLldflags} " +
+ return "${cc_config.LinuxLldflags} ${cc_config.LinuxX86Lldflags} " +
"${config.LinuxToolchainLinkFlags} ${config.LinuxToolchainX86LinkFlags}"
}