cc: make static or shared cflags apply to all source files

Make static or shared cflags properties apply to all source files,
not just the source files defined in the static or shared block.
Needed for libunwind, which passes -DUNW_ADDITIONAL_PREFIX to source
files for the static library, but not for the shared library.

Change-Id: I3cd88cc1099e505eeee077c697db00de22a8b03a
This commit is contained in:
Colin Cross 2015-04-28 17:39:43 -07:00
parent 0607cf7daa
commit d8e780df69
1 changed files with 6 additions and 2 deletions

View File

@ -1028,6 +1028,12 @@ func (c *CCLibrary) flags(ctx common.AndroidModuleContext, flags CCFlags) CCFlag
flags.CFlags = append(flags.CFlags, "-fPIC")
if c.static() {
flags.CFlags = append(flags.CFlags, c.LibraryProperties.Static.Cflags...)
} else {
flags.CFlags = append(flags.CFlags, c.LibraryProperties.Shared.Cflags...)
}
if !c.static() {
libName := ctx.ModuleName()
// GCC for Android assumes that -shared means -Bsymbolic, use -Wl,-shared instead
@ -1053,7 +1059,6 @@ func (c *CCLibrary) compileStaticLibrary(ctx common.AndroidModuleContext,
flags CCFlags, deps CCDeps, objFiles []string) {
staticFlags := flags
staticFlags.CFlags = append(staticFlags.CFlags, c.LibraryProperties.Static.Cflags...)
objFilesStatic := c.customCompileObjs(ctx, staticFlags, common.DeviceStaticLibrary,
c.LibraryProperties.Static.Srcs)
@ -1076,7 +1081,6 @@ func (c *CCLibrary) compileSharedLibrary(ctx common.AndroidModuleContext,
flags CCFlags, deps CCDeps, objFiles []string) {
sharedFlags := flags
sharedFlags.CFlags = append(sharedFlags.CFlags, c.LibraryProperties.Shared.Cflags...)
objFilesShared := c.customCompileObjs(ctx, sharedFlags, common.DeviceSharedLibrary,
c.LibraryProperties.Shared.Srcs)