Split local and global cflags
Native compiler flags are currently applied in approximately: global cflags local cflags local include dirs global include dirs global conlyflags local conlyflags global cppflags local cppflags This means that a flag that is enabled in the global cppflags cannot be disabled in the local cflags, and an Android.bp author must know to disable it in the local cppflags. A better order would be: global cflags global conlyflags global cppflags local cflags local conlyflags local cppflags local include dirs global include dirs We are mixing both the global and local cflags into a single variable, and similar for conlyflags and cppflags, which prevents reordering them. This CL prepares to reorder them by splitting the global and local cflags into separate variables. Bug: 143713277 Test: m native Change-Id: Ic55a8c3516c331dc5f2af9d00e59ceca9d3e6c15
This commit is contained in:
@@ -394,13 +394,13 @@ func (library *libraryDecorator) linkerFlags(ctx ModuleContext, flags Flags) Fla
|
||||
// all code is position independent, and then those warnings get promoted to
|
||||
// errors.
|
||||
if !ctx.Windows() {
|
||||
flags.CFlags = append(flags.CFlags, "-fPIC")
|
||||
flags.Global.CFlags = append(flags.Global.CFlags, "-fPIC")
|
||||
}
|
||||
|
||||
if library.static() {
|
||||
flags.CFlags = append(flags.CFlags, library.StaticProperties.Static.Cflags...)
|
||||
flags.Local.CFlags = append(flags.Local.CFlags, library.StaticProperties.Static.Cflags...)
|
||||
} else if library.shared() {
|
||||
flags.CFlags = append(flags.CFlags, library.SharedProperties.Shared.Cflags...)
|
||||
flags.Local.CFlags = append(flags.Local.CFlags, library.SharedProperties.Shared.Cflags...)
|
||||
}
|
||||
|
||||
if library.shared() {
|
||||
@@ -431,7 +431,7 @@ func (library *libraryDecorator) linkerFlags(ctx ModuleContext, flags Flags) Fla
|
||||
}
|
||||
}
|
||||
|
||||
flags.LdFlags = append(f, flags.LdFlags...)
|
||||
flags.Global.LdFlags = append(flags.Global.LdFlags, f...)
|
||||
}
|
||||
|
||||
return flags
|
||||
@@ -441,8 +441,8 @@ func (library *libraryDecorator) compilerFlags(ctx ModuleContext, flags Flags, d
|
||||
exportIncludeDirs := library.flagExporter.exportedIncludes(ctx)
|
||||
if len(exportIncludeDirs) > 0 {
|
||||
f := includeDirsToFlags(exportIncludeDirs)
|
||||
flags.GlobalFlags = append(flags.GlobalFlags, f)
|
||||
flags.YasmFlags = append(flags.YasmFlags, f)
|
||||
flags.Local.CommonFlags = append(flags.Local.CommonFlags, f)
|
||||
flags.Local.YasmFlags = append(flags.Local.YasmFlags, f)
|
||||
}
|
||||
|
||||
flags = library.baseCompiler.compilerFlags(ctx, flags, deps)
|
||||
@@ -462,8 +462,8 @@ func (library *libraryDecorator) compilerFlags(ctx ModuleContext, flags Flags, d
|
||||
}
|
||||
return ret
|
||||
}
|
||||
flags.GlobalFlags = removeInclude(flags.GlobalFlags)
|
||||
flags.CFlags = removeInclude(flags.CFlags)
|
||||
flags.Local.CommonFlags = removeInclude(flags.Local.CommonFlags)
|
||||
flags.Local.CFlags = removeInclude(flags.Local.CFlags)
|
||||
|
||||
flags = addStubLibraryCompilerFlags(flags)
|
||||
}
|
||||
@@ -776,21 +776,21 @@ func (library *libraryDecorator) linkShared(ctx ModuleContext,
|
||||
}
|
||||
} else {
|
||||
if unexportedSymbols.Valid() {
|
||||
flags.LdFlags = append(flags.LdFlags, "-Wl,-unexported_symbols_list,"+unexportedSymbols.String())
|
||||
flags.Local.LdFlags = append(flags.Local.LdFlags, "-Wl,-unexported_symbols_list,"+unexportedSymbols.String())
|
||||
linkerDeps = append(linkerDeps, unexportedSymbols.Path())
|
||||
}
|
||||
if forceNotWeakSymbols.Valid() {
|
||||
flags.LdFlags = append(flags.LdFlags, "-Wl,-force_symbols_not_weak_list,"+forceNotWeakSymbols.String())
|
||||
flags.Local.LdFlags = append(flags.Local.LdFlags, "-Wl,-force_symbols_not_weak_list,"+forceNotWeakSymbols.String())
|
||||
linkerDeps = append(linkerDeps, forceNotWeakSymbols.Path())
|
||||
}
|
||||
if forceWeakSymbols.Valid() {
|
||||
flags.LdFlags = append(flags.LdFlags, "-Wl,-force_symbols_weak_list,"+forceWeakSymbols.String())
|
||||
flags.Local.LdFlags = append(flags.Local.LdFlags, "-Wl,-force_symbols_weak_list,"+forceWeakSymbols.String())
|
||||
linkerDeps = append(linkerDeps, forceWeakSymbols.Path())
|
||||
}
|
||||
}
|
||||
if library.buildStubs() {
|
||||
linkerScriptFlags := "-Wl,--version-script," + library.versionScriptPath.String()
|
||||
flags.LdFlags = append(flags.LdFlags, linkerScriptFlags)
|
||||
flags.Local.LdFlags = append(flags.Local.LdFlags, linkerScriptFlags)
|
||||
linkerDeps = append(linkerDeps, library.versionScriptPath)
|
||||
}
|
||||
|
||||
@@ -802,7 +802,7 @@ func (library *libraryDecorator) linkShared(ctx ModuleContext,
|
||||
if ctx.Windows() {
|
||||
importLibraryPath := android.PathForModuleOut(ctx, pathtools.ReplaceExtension(fileName, "lib"))
|
||||
|
||||
flags.LdFlags = append(flags.LdFlags, "-Wl,--out-implib="+importLibraryPath.String())
|
||||
flags.Local.LdFlags = append(flags.Local.LdFlags, "-Wl,--out-implib="+importLibraryPath.String())
|
||||
implicitOutputs = append(implicitOutputs, importLibraryPath)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user