From e4d1bdaa57dfb14a2d938bdba3d8143899f11fb6 Mon Sep 17 00:00:00 2001 From: Liz Kammer Date: Wed, 22 Jun 2022 21:02:08 +0000 Subject: [PATCH] Move global asflags to config to share with Bazel Test: CI Change-Id: Ib76bd63f9d021f581b232522d1206d968d7b1599 --- cc/cc_test.go | 2 +- cc/compiler.go | 6 +----- cc/config/global.go | 8 ++++++++ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/cc/cc_test.go b/cc/cc_test.go index 38f63835d..6c08ac492 100644 --- a/cc/cc_test.go +++ b/cc/cc_test.go @@ -4076,7 +4076,7 @@ func TestIncludeDirectoryOrdering(t *testing.T) { { name: "assemble", src: "foo.s", - expected: combineSlices(baseExpectedFlags, []string{"-D__ASSEMBLY__", "-fdebug-default-version=4"}, expectedIncludes, lastIncludes), + expected: combineSlices(baseExpectedFlags, []string{"${config.CommonGlobalAsflags}"}, expectedIncludes, lastIncludes), }, } diff --git a/cc/compiler.go b/cc/compiler.go index cd1d92c0b..5c061b115 100644 --- a/cc/compiler.go +++ b/cc/compiler.go @@ -493,11 +493,7 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps } } - flags.Global.AsFlags = append(flags.Global.AsFlags, "-D__ASSEMBLY__") - - // TODO(b/235105792): override global -fdebug-default-version=5, it is causing $TMPDIR to - // end up in the dwarf data for crtend_so.S. - flags.Global.AsFlags = append(flags.Global.AsFlags, "-fdebug-default-version=4") + flags.Global.AsFlags = append(flags.Global.AsFlags, "${config.CommonGlobalAsflags}") flags.Global.CppFlags = append(flags.Global.CppFlags, tc.Cppflags()) diff --git a/cc/config/global.go b/cc/config/global.go index b09598ab6..c5fde5560 100644 --- a/cc/config/global.go +++ b/cc/config/global.go @@ -117,6 +117,13 @@ var ( commonGlobalConlyflags = []string{} + commonGlobalAsflags = []string{ + "-D__ASSEMBLY__", + // TODO(b/235105792): override global -fdebug-default-version=5, it is causing $TMPDIR to + // end up in the dwarf data for crtend_so.S. + "-fdebug-default-version=4", + } + deviceGlobalCflags = []string{ "-ffunction-sections", "-fdata-sections", @@ -313,6 +320,7 @@ func init() { } exportedVars.ExportStringListStaticVariable("CommonGlobalConlyflags", commonGlobalConlyflags) + exportedVars.ExportStringListStaticVariable("CommonGlobalAsflags", commonGlobalAsflags) exportedVars.ExportStringListStaticVariable("DeviceGlobalCppflags", deviceGlobalCppflags) exportedVars.ExportStringListStaticVariable("DeviceGlobalLdflags", deviceGlobalLdflags) exportedVars.ExportStringListStaticVariable("DeviceGlobalLldflags", deviceGlobalLldflags)