Merge "Add to cflags in compilerFlags()"

This commit is contained in:
Treehugger Robot
2017-07-19 21:36:33 +00:00
committed by Gerrit Code Review
2 changed files with 24 additions and 12 deletions

View File

@@ -61,6 +61,11 @@ type llndkStubDecorator struct {
versionScriptPath android.ModuleGenPath
}
func (stub *llndkStubDecorator) compilerFlags(ctx ModuleContext, flags Flags) Flags {
flags = stub.baseCompiler.compilerFlags(ctx, flags)
return addStubLibraryCompilerFlags(flags)
}
func (stub *llndkStubDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) Objects {
objs, versionScript := compileStubLibrary(ctx, flags, stub.Properties.Symbol_file, "current", "--vndk")
stub.versionScriptPath = versionScript

View File

@@ -242,6 +242,25 @@ func (c *stubDecorator) compilerInit(ctx BaseModuleContext) {
ndkMigratedLibs = append(ndkMigratedLibs, name)
}
func addStubLibraryCompilerFlags(flags Flags) Flags {
flags.CFlags = append(flags.CFlags,
// We're knowingly doing some otherwise unsightly things with builtin
// functions here. We're just generating stub libraries, so ignore it.
"-Wno-incompatible-library-redeclaration",
"-Wno-builtin-requires-header",
"-Wno-invalid-noreturn",
// These libraries aren't actually used. Don't worry about unwinding
// (avoids the need to link an unwinder into a fake library).
"-fno-unwind-tables",
)
return flags
}
func (stub *stubDecorator) compilerFlags(ctx ModuleContext, flags Flags) Flags {
flags = stub.baseCompiler.compilerFlags(ctx, flags)
return addStubLibraryCompilerFlags(flags)
}
func compileStubLibrary(ctx ModuleContext, flags Flags, symbolFile, apiLevel, vndk string) (Objects, android.ModuleGenPath) {
arch := ctx.Arch().ArchType.String()
@@ -263,18 +282,6 @@ func compileStubLibrary(ctx ModuleContext, flags Flags, symbolFile, apiLevel, vn
},
})
flags.CFlags = append(flags.CFlags,
// We're knowingly doing some otherwise unsightly things with builtin
// functions here. We're just generating stub libraries, so ignore it.
"-Wno-incompatible-library-redeclaration",
"-Wno-builtin-requires-header",
"-Wno-invalid-noreturn",
// These libraries aren't actually used. Don't worry about unwinding
// (avoids the need to link an unwinder into a fake library).
"-fno-unwind-tables",
)
subdir := ""
srcs := []android.Path{stubSrcPath}
return compileObjs(ctx, flagsToBuilderFlags(flags), subdir, srcs, nil), versionScriptPath