Remove flto dependent flags when -flto is removed.
* C++ source files could be compiled with "-fwhole-program-vtables" in cppflags. We need to filter out those flto dependent flags in flags.CppFlags and use flags.toolingCppFlags instead of flags.cppFlags. Test: build with WITH_TIDY=1 Change-Id: Ic2b0f99b95a5f0422f879226e6f6060cab71456a
This commit is contained in:
parent
cde4e89c27
commit
9e88ba9f22
|
@ -236,29 +236,30 @@ func init() {
|
|||
}
|
||||
|
||||
type builderFlags struct {
|
||||
globalFlags string
|
||||
arFlags string
|
||||
asFlags string
|
||||
cFlags string
|
||||
toolingCFlags string // A separate set of Cflags for clang LibTooling tools
|
||||
conlyFlags string
|
||||
cppFlags string
|
||||
ldFlags string
|
||||
libFlags string
|
||||
yaccFlags string
|
||||
protoFlags string
|
||||
protoOutParams string
|
||||
tidyFlags string
|
||||
sAbiFlags string
|
||||
yasmFlags string
|
||||
aidlFlags string
|
||||
rsFlags string
|
||||
toolchain config.Toolchain
|
||||
clang bool
|
||||
tidy bool
|
||||
coverage bool
|
||||
sAbiDump bool
|
||||
protoRoot bool
|
||||
globalFlags string
|
||||
arFlags string
|
||||
asFlags string
|
||||
cFlags string
|
||||
toolingCFlags string // A separate set of cFlags for clang LibTooling tools
|
||||
toolingCppFlags string // A separate set of cppFlags for clang LibTooling tools
|
||||
conlyFlags string
|
||||
cppFlags string
|
||||
ldFlags string
|
||||
libFlags string
|
||||
yaccFlags string
|
||||
protoFlags string
|
||||
protoOutParams string
|
||||
tidyFlags string
|
||||
sAbiFlags string
|
||||
yasmFlags string
|
||||
aidlFlags string
|
||||
rsFlags string
|
||||
toolchain config.Toolchain
|
||||
clang bool
|
||||
tidy bool
|
||||
coverage bool
|
||||
sAbiDump bool
|
||||
protoRoot bool
|
||||
|
||||
systemIncludeFlags string
|
||||
|
||||
|
@ -330,7 +331,7 @@ func TransformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles and
|
|||
toolingCppflags := strings.Join([]string{
|
||||
commonFlags,
|
||||
flags.toolingCFlags,
|
||||
flags.cppFlags,
|
||||
flags.toolingCppFlags,
|
||||
}, " ")
|
||||
|
||||
cppflags := strings.Join([]string{
|
||||
|
|
|
@ -93,8 +93,10 @@ var ClangUnknownLldflags = sorted([]string{
|
|||
})
|
||||
|
||||
var ClangLibToolingUnknownCflags = []string{
|
||||
// Remove -flto and other flto dependent flags.
|
||||
"-flto*",
|
||||
"-fsanitize*",
|
||||
"-fwhole-program-vtables",
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
|
|
@ -71,6 +71,7 @@ func (sabimod *sabi) flags(ctx ModuleContext, flags Flags) Flags {
|
|||
// Assuming that the cflags which clang LibTooling tools cannot
|
||||
// understand have not been converted to ninja variables yet.
|
||||
flags.ToolingCFlags = filterOutWithPrefix(flags.CFlags, config.ClangLibToolingUnknownCflags)
|
||||
flags.ToolingCppFlags = filterOutWithPrefix(flags.CppFlags, config.ClangLibToolingUnknownCflags)
|
||||
|
||||
// RSClang does not support recent mcpu option likes exynos-m2.
|
||||
// So we need overriding mcpu option when we want to use it.
|
||||
|
|
47
cc/util.go
47
cc/util.go
|
@ -59,29 +59,30 @@ func moduleToLibName(module string) (string, error) {
|
|||
|
||||
func flagsToBuilderFlags(in Flags) builderFlags {
|
||||
return builderFlags{
|
||||
globalFlags: strings.Join(in.GlobalFlags, " "),
|
||||
arFlags: strings.Join(in.ArFlags, " "),
|
||||
asFlags: strings.Join(in.AsFlags, " "),
|
||||
cFlags: strings.Join(in.CFlags, " "),
|
||||
toolingCFlags: strings.Join(in.ToolingCFlags, " "),
|
||||
conlyFlags: strings.Join(in.ConlyFlags, " "),
|
||||
cppFlags: strings.Join(in.CppFlags, " "),
|
||||
yaccFlags: strings.Join(in.YaccFlags, " "),
|
||||
protoFlags: strings.Join(in.protoFlags, " "),
|
||||
protoOutParams: strings.Join(in.protoOutParams, ","),
|
||||
aidlFlags: strings.Join(in.aidlFlags, " "),
|
||||
rsFlags: strings.Join(in.rsFlags, " "),
|
||||
ldFlags: strings.Join(in.LdFlags, " "),
|
||||
libFlags: strings.Join(in.libFlags, " "),
|
||||
tidyFlags: strings.Join(in.TidyFlags, " "),
|
||||
sAbiFlags: strings.Join(in.SAbiFlags, " "),
|
||||
yasmFlags: strings.Join(in.YasmFlags, " "),
|
||||
toolchain: in.Toolchain,
|
||||
clang: in.Clang,
|
||||
coverage: in.Coverage,
|
||||
tidy: in.Tidy,
|
||||
sAbiDump: in.SAbiDump,
|
||||
protoRoot: in.ProtoRoot,
|
||||
globalFlags: strings.Join(in.GlobalFlags, " "),
|
||||
arFlags: strings.Join(in.ArFlags, " "),
|
||||
asFlags: strings.Join(in.AsFlags, " "),
|
||||
cFlags: strings.Join(in.CFlags, " "),
|
||||
toolingCFlags: strings.Join(in.ToolingCFlags, " "),
|
||||
toolingCppFlags: strings.Join(in.ToolingCppFlags, " "),
|
||||
conlyFlags: strings.Join(in.ConlyFlags, " "),
|
||||
cppFlags: strings.Join(in.CppFlags, " "),
|
||||
yaccFlags: strings.Join(in.YaccFlags, " "),
|
||||
protoFlags: strings.Join(in.protoFlags, " "),
|
||||
protoOutParams: strings.Join(in.protoOutParams, ","),
|
||||
aidlFlags: strings.Join(in.aidlFlags, " "),
|
||||
rsFlags: strings.Join(in.rsFlags, " "),
|
||||
ldFlags: strings.Join(in.LdFlags, " "),
|
||||
libFlags: strings.Join(in.libFlags, " "),
|
||||
tidyFlags: strings.Join(in.TidyFlags, " "),
|
||||
sAbiFlags: strings.Join(in.SAbiFlags, " "),
|
||||
yasmFlags: strings.Join(in.YasmFlags, " "),
|
||||
toolchain: in.Toolchain,
|
||||
clang: in.Clang,
|
||||
coverage: in.Coverage,
|
||||
tidy: in.Tidy,
|
||||
sAbiDump: in.SAbiDump,
|
||||
protoRoot: in.ProtoRoot,
|
||||
|
||||
systemIncludeFlags: strings.Join(in.SystemIncludeFlags, " "),
|
||||
|
||||
|
|
Loading…
Reference in New Issue