Export stub library compiler flags to soong_injection. am: 341f73550d am: 82f468476b am: db371b48a5

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1944691

Change-Id: I5bf66b2e96bfb1c70063cb8460c67f5cb385f0b3
This commit is contained in:
Jingwen Chen 2022-01-21 05:36:48 +00:00 committed by Automerger Merge Worker
commit fec1d0f005
2 changed files with 25 additions and 13 deletions

View file

@ -22,6 +22,7 @@ import (
"strings"
"android/soong/android"
"github.com/google/blueprint"
)
@ -162,6 +163,10 @@ func exportStringListStaticVariable(name string, value []string) {
exportedStringListVars.Set(name, value)
}
func ExportStringList(name string, value []string) {
exportedStringListVars.Set(name, value)
}
type exportedStringListDictVariables map[string]map[string][]string
func (m exportedStringListDictVariables) Set(k string, v map[string][]string) {

View file

@ -25,6 +25,7 @@ import (
"github.com/google/blueprint/proptools"
"android/soong/android"
"android/soong/cc/config"
)
func init() {
@ -208,20 +209,26 @@ func (c *stubDecorator) compilerInit(ctx BaseModuleContext) {
*ndkKnownLibs = append(*ndkKnownLibs, name)
}
var stubLibraryCompilerFlags = []string{
// 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-incomplete-setjmp-declaration",
"-Wno-builtin-requires-header",
"-Wno-invalid-noreturn",
"-Wall",
"-Werror",
// 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",
}
func init() {
config.ExportStringList("StubLibraryCompilerFlags", stubLibraryCompilerFlags)
}
func addStubLibraryCompilerFlags(flags Flags) Flags {
flags.Global.CFlags = append(flags.Global.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-incomplete-setjmp-declaration",
"-Wno-builtin-requires-header",
"-Wno-invalid-noreturn",
"-Wall",
"-Werror",
// 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",
)
flags.Global.CFlags = append(flags.Global.CFlags, stubLibraryCompilerFlags...)
// All symbols in the stubs library should be visible.
if inList("-fvisibility=hidden", flags.Local.CFlags) {
flags.Local.CFlags = append(flags.Local.CFlags, "-fvisibility=default")