From 98ab3117674fcab553a80817d35de156798eb151 Mon Sep 17 00:00:00 2001 From: Dan Willemsen Date: Tue, 27 Aug 2019 21:20:40 -0700 Subject: [PATCH] Save deps when asflags contains -xassembler-with-cpp Usually, ".S" files are processes with the c preprocessor, and ".s" files are not, so they don't have any dependency information, since it is generated by the preprocessor. But with the -xassembler-with-cpp flag, ".s" files are processed with the preprocessor, so we should ask for dependency information from them. Test: NINJA_ARGS="-t deps out/soong/.intermediates/external/sonivox/arm-wt-22k/libsonivox/android_arm_armv7-a-neon_core_static/obj/external/sonivox/arm-wt-22k/lib_src/ARM-E_filter_gnu.o" m Test: treehugger Change-Id: Iee7baeebc2b205b5a2f33e7c1705ea4a5b4fc95a --- cc/builder.go | 6 +++++- cc/cc.go | 6 +++++- cc/util.go | 3 ++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/cc/builder.go b/cc/builder.go index 00dc742e8..554706ca8 100644 --- a/cc/builder.go +++ b/cc/builder.go @@ -271,6 +271,8 @@ type builderFlags struct { sAbiDump bool emitXrefs bool + assemblerWithCpp bool + systemIncludeFlags string groupStaticLibs bool @@ -428,7 +430,9 @@ func TransformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles and switch srcFile.Ext() { case ".s": - rule = ccNoDeps + if !flags.assemblerWithCpp { + rule = ccNoDeps + } fallthrough case ".S": ccCmd = "clang" diff --git a/cc/cc.go b/cc/cc.go index 0245c6a18..4edbee6a6 100644 --- a/cc/cc.go +++ b/cc/cc.go @@ -174,7 +174,8 @@ type Flags struct { CFlagsDeps android.Paths // Files depended on by compiler flags LdFlagsDeps android.Paths // Files depended on by linker flags - GroupStaticLibs bool + AssemblerWithCpp bool + GroupStaticLibs bool proto android.ProtoFlags protoC bool // Whether to use C instead of C++ @@ -1053,6 +1054,9 @@ func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) { if c.sabi != nil { flags = c.sabi.flags(ctx, flags) } + + flags.AssemblerWithCpp = inList("-xassembler-with-cpp", flags.AsFlags) + // 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, " ")) diff --git a/cc/util.go b/cc/util.go index fb6338ac2..7b8ad1872 100644 --- a/cc/util.go +++ b/cc/util.go @@ -79,7 +79,8 @@ func flagsToBuilderFlags(in Flags) builderFlags { systemIncludeFlags: strings.Join(in.SystemIncludeFlags, " "), - groupStaticLibs: in.GroupStaticLibs, + assemblerWithCpp: in.AssemblerWithCpp, + groupStaticLibs: in.GroupStaticLibs, proto: in.proto, protoC: in.protoC,