Loading cc/builder.go +7 −0 Original line number Diff line number Diff line Loading @@ -519,6 +519,13 @@ func transformSourceToObj(ctx ModuleContext, subdir string, srcFiles, noTidySrcs cppflags += " ${config.NoOverrideGlobalCflags}" toolingCppflags += " ${config.NoOverrideGlobalCflags}" if flags.toolchain.Is64Bit() { cflags += " ${config.NoOverride64GlobalCflags}" toolingCflags += " ${config.NoOverride64GlobalCflags}" cppflags += " ${config.NoOverride64GlobalCflags}" toolingCppflags += " ${config.NoOverride64GlobalCflags}" } modulePath := android.PathForModuleSrc(ctx).String() if android.IsThirdPartyPath(modulePath) { cflags += " ${config.NoOverrideExternalGlobalCflags}" Loading cc/cc_test.go +33 −0 Original line number Diff line number Diff line Loading @@ -4483,6 +4483,39 @@ func TestIncludeDirectoryOrdering(t *testing.T) { } func TestAddnoOverride64GlobalCflags(t *testing.T) { t.Parallel() ctx := testCc(t, ` cc_library_shared { name: "libclient", srcs: ["foo.c"], shared_libs: ["libfoo#1"], } cc_library_shared { name: "libfoo", srcs: ["foo.c"], shared_libs: ["libbar"], export_shared_lib_headers: ["libbar"], stubs: { symbol_file: "foo.map.txt", versions: ["1", "2", "3"], }, } cc_library_shared { name: "libbar", export_include_dirs: ["include/libbar"], srcs: ["foo.c"], }`) cFlags := ctx.ModuleForTests("libclient", "android_arm64_armv8-a_shared").Rule("cc").Args["cFlags"] if !strings.Contains(cFlags, "${config.NoOverride64GlobalCflags}") { t.Errorf("expected %q in cflags, got %q", "${config.NoOverride64GlobalCflags}", cFlags) } } func TestCcBuildBrokenClangProperty(t *testing.T) { t.Parallel() tests := []struct { Loading cc/config/global.go +17 −1 Original line number Diff line number Diff line Loading @@ -247,6 +247,8 @@ var ( "-Wno-error=enum-constexpr-conversion", // http://b/243964282 } noOverride64GlobalCflags = []string{} noOverrideExternalGlobalCflags = []string{ // http://b/148815709 "-Wno-sizeof-array-div", Loading Loading @@ -384,12 +386,26 @@ func init() { return strings.Join(deviceGlobalCflags, " ") }) // Export the static default NoOverrideGlobalCflags to Bazel. // Export the static default NoOverrideGlobalCflags and NoOverride64GlobalCflags to Bazel. exportedVars.ExportStringList("NoOverrideGlobalCflags", noOverrideGlobalCflags) exportedVars.ExportStringList("NoOverride64GlobalCflags", noOverride64GlobalCflags) pctx.VariableFunc("NoOverrideGlobalCflags", func(ctx android.PackageVarContext) string { flags := noOverrideGlobalCflags if ctx.Config().IsEnvTrue("LLVM_NEXT") { flags = append(noOverrideGlobalCflags, llvmNextExtraCommonGlobalCflags...) if ctx.Config().Android64() { flags = append(noOverride64GlobalCflags) } } return strings.Join(flags, " ") }) // Export the static default NoOverride64GlobalCflags to Bazel. exportedVars.ExportStringList("NoOverride64GlobalCflags", noOverride64GlobalCflags) pctx.VariableFunc("NoOverride64GlobalCflags", func(ctx android.PackageVarContext) string { flags := noOverride64GlobalCflags if ctx.Config().IsEnvTrue("LLVM_NEXT") && ctx.Config().Android64() { flags = append(noOverride64GlobalCflags, llvmNextExtraCommonGlobalCflags...) } return strings.Join(flags, " ") }) Loading cc/makevars.go +1 −0 Original line number Diff line number Diff line Loading @@ -93,6 +93,7 @@ func makeVarsProvider(ctx android.MakeVarsContext) { ctx.Strict("CLANG_EXTERNAL_CFLAGS", "${config.ExternalCflags}") ctx.Strict("GLOBAL_CLANG_CFLAGS_NO_OVERRIDE", "${config.NoOverrideGlobalCflags}") ctx.Strict("GLOBAL_CLANG_CFLAGS_64_NO_OVERRIDE", "${config.NoOverride64GlobalCflags}") ctx.Strict("GLOBAL_CLANG_CPPFLAGS_NO_OVERRIDE", "") ctx.Strict("GLOBAL_CLANG_EXTERNAL_CFLAGS_NO_OVERRIDE", "${config.NoOverrideExternalGlobalCflags}") Loading Loading
cc/builder.go +7 −0 Original line number Diff line number Diff line Loading @@ -519,6 +519,13 @@ func transformSourceToObj(ctx ModuleContext, subdir string, srcFiles, noTidySrcs cppflags += " ${config.NoOverrideGlobalCflags}" toolingCppflags += " ${config.NoOverrideGlobalCflags}" if flags.toolchain.Is64Bit() { cflags += " ${config.NoOverride64GlobalCflags}" toolingCflags += " ${config.NoOverride64GlobalCflags}" cppflags += " ${config.NoOverride64GlobalCflags}" toolingCppflags += " ${config.NoOverride64GlobalCflags}" } modulePath := android.PathForModuleSrc(ctx).String() if android.IsThirdPartyPath(modulePath) { cflags += " ${config.NoOverrideExternalGlobalCflags}" Loading
cc/cc_test.go +33 −0 Original line number Diff line number Diff line Loading @@ -4483,6 +4483,39 @@ func TestIncludeDirectoryOrdering(t *testing.T) { } func TestAddnoOverride64GlobalCflags(t *testing.T) { t.Parallel() ctx := testCc(t, ` cc_library_shared { name: "libclient", srcs: ["foo.c"], shared_libs: ["libfoo#1"], } cc_library_shared { name: "libfoo", srcs: ["foo.c"], shared_libs: ["libbar"], export_shared_lib_headers: ["libbar"], stubs: { symbol_file: "foo.map.txt", versions: ["1", "2", "3"], }, } cc_library_shared { name: "libbar", export_include_dirs: ["include/libbar"], srcs: ["foo.c"], }`) cFlags := ctx.ModuleForTests("libclient", "android_arm64_armv8-a_shared").Rule("cc").Args["cFlags"] if !strings.Contains(cFlags, "${config.NoOverride64GlobalCflags}") { t.Errorf("expected %q in cflags, got %q", "${config.NoOverride64GlobalCflags}", cFlags) } } func TestCcBuildBrokenClangProperty(t *testing.T) { t.Parallel() tests := []struct { Loading
cc/config/global.go +17 −1 Original line number Diff line number Diff line Loading @@ -247,6 +247,8 @@ var ( "-Wno-error=enum-constexpr-conversion", // http://b/243964282 } noOverride64GlobalCflags = []string{} noOverrideExternalGlobalCflags = []string{ // http://b/148815709 "-Wno-sizeof-array-div", Loading Loading @@ -384,12 +386,26 @@ func init() { return strings.Join(deviceGlobalCflags, " ") }) // Export the static default NoOverrideGlobalCflags to Bazel. // Export the static default NoOverrideGlobalCflags and NoOverride64GlobalCflags to Bazel. exportedVars.ExportStringList("NoOverrideGlobalCflags", noOverrideGlobalCflags) exportedVars.ExportStringList("NoOverride64GlobalCflags", noOverride64GlobalCflags) pctx.VariableFunc("NoOverrideGlobalCflags", func(ctx android.PackageVarContext) string { flags := noOverrideGlobalCflags if ctx.Config().IsEnvTrue("LLVM_NEXT") { flags = append(noOverrideGlobalCflags, llvmNextExtraCommonGlobalCflags...) if ctx.Config().Android64() { flags = append(noOverride64GlobalCflags) } } return strings.Join(flags, " ") }) // Export the static default NoOverride64GlobalCflags to Bazel. exportedVars.ExportStringList("NoOverride64GlobalCflags", noOverride64GlobalCflags) pctx.VariableFunc("NoOverride64GlobalCflags", func(ctx android.PackageVarContext) string { flags := noOverride64GlobalCflags if ctx.Config().IsEnvTrue("LLVM_NEXT") && ctx.Config().Android64() { flags = append(noOverride64GlobalCflags, llvmNextExtraCommonGlobalCflags...) } return strings.Join(flags, " ") }) Loading
cc/makevars.go +1 −0 Original line number Diff line number Diff line Loading @@ -93,6 +93,7 @@ func makeVarsProvider(ctx android.MakeVarsContext) { ctx.Strict("CLANG_EXTERNAL_CFLAGS", "${config.ExternalCflags}") ctx.Strict("GLOBAL_CLANG_CFLAGS_NO_OVERRIDE", "${config.NoOverrideGlobalCflags}") ctx.Strict("GLOBAL_CLANG_CFLAGS_64_NO_OVERRIDE", "${config.NoOverride64GlobalCflags}") ctx.Strict("GLOBAL_CLANG_CPPFLAGS_NO_OVERRIDE", "") ctx.Strict("GLOBAL_CLANG_EXTERNAL_CFLAGS_NO_OVERRIDE", "${config.NoOverrideExternalGlobalCflags}") Loading