cc: Filter out unknown clang cflags from InstructionSetFlags
-funswitch-loops is in the arm instruction set flags, but unsupported by clang. Make removes clang unknown cflags from the instruction set flags. This was producing a warning, causing -Werror to fail on libm. Change-Id: Ibc69c9af04a738aa8adeb5549900e2b53ab754f0
This commit is contained in:
parent
6d27f3428e
commit
6d11dd87c0
|
@ -172,6 +172,10 @@ func init() {
|
|||
pctx.StaticVariable("armClangLdflags", strings.Join(clangFilterUnknownCflags(armLdflags), " "))
|
||||
pctx.StaticVariable("armClangCppflags", strings.Join(clangFilterUnknownCflags(armCppflags), " "))
|
||||
|
||||
// Clang ARM vs. Thumb instruction set cflags
|
||||
pctx.StaticVariable("armClangArmCflags", strings.Join(clangFilterUnknownCflags(armArmCflags), " "))
|
||||
pctx.StaticVariable("armClangThumbCflags", strings.Join(clangFilterUnknownCflags(armThumbCflags), " "))
|
||||
|
||||
// Clang cpu variant cflags
|
||||
pctx.StaticVariable("armClangArmv5TECflags",
|
||||
strings.Join(armClangArchVariantCflags["armv5te"], " "))
|
||||
|
@ -291,6 +295,17 @@ func (t *toolchainArm) ClangLdflags() string {
|
|||
return t.ldflags
|
||||
}
|
||||
|
||||
func (t *toolchainArm) ClangInstructionSetFlags(isa string) (string, error) {
|
||||
switch isa {
|
||||
case "arm":
|
||||
return "${armClangArmCflags}", nil
|
||||
case "thumb", "":
|
||||
return "${armClangThumbCflags}", nil
|
||||
default:
|
||||
return t.toolchainBase.ClangInstructionSetFlags(isa)
|
||||
}
|
||||
}
|
||||
|
||||
func armToolchainFactory(archVariant string, cpuVariant string) Toolchain {
|
||||
var fixCortexA8 string
|
||||
switch cpuVariant {
|
||||
|
|
21
cc/cc.go
21
cc/cc.go
|
@ -488,15 +488,6 @@ func (c *CCBase) collectFlags(ctx common.AndroidModuleContext, toolchain Toolcha
|
|||
}...)
|
||||
}
|
||||
|
||||
instructionSet := c.Properties.Instruction_set
|
||||
instructionSetFlags, err := toolchain.InstructionSetFlags(instructionSet)
|
||||
if err != nil {
|
||||
ctx.ModuleErrorf("%s", err)
|
||||
}
|
||||
|
||||
// TODO: debug
|
||||
flags.CFlags = append(flags.CFlags, c.Properties.Release.Cflags...)
|
||||
|
||||
if !ctx.ContainsProperty("clang") {
|
||||
if ctx.Host() {
|
||||
flags.Clang = true
|
||||
|
@ -507,6 +498,18 @@ func (c *CCBase) collectFlags(ctx common.AndroidModuleContext, toolchain Toolcha
|
|||
}
|
||||
}
|
||||
|
||||
instructionSet := c.Properties.Instruction_set
|
||||
instructionSetFlags, err := toolchain.InstructionSetFlags(instructionSet)
|
||||
if flags.Clang {
|
||||
instructionSetFlags, err = toolchain.ClangInstructionSetFlags(instructionSet)
|
||||
}
|
||||
if err != nil {
|
||||
ctx.ModuleErrorf("%s", err)
|
||||
}
|
||||
|
||||
// TODO: debug
|
||||
flags.CFlags = append(flags.CFlags, c.Properties.Release.Cflags...)
|
||||
|
||||
if flags.Clang {
|
||||
flags.CFlags = clangFilterUnknownCflags(flags.CFlags)
|
||||
flags.CFlags = append(flags.CFlags, c.Properties.Clang_cflags...)
|
||||
|
|
|
@ -49,6 +49,7 @@ type Toolchain interface {
|
|||
ClangCflags() string
|
||||
ClangCppflags() string
|
||||
ClangLdflags() string
|
||||
ClangInstructionSetFlags(string) (string, error)
|
||||
|
||||
Is64Bit() bool
|
||||
}
|
||||
|
@ -63,6 +64,13 @@ func (toolchainBase) InstructionSetFlags(s string) (string, error) {
|
|||
return "", nil
|
||||
}
|
||||
|
||||
func (toolchainBase) ClangInstructionSetFlags(s string) (string, error) {
|
||||
if s != "" {
|
||||
return "", fmt.Errorf("instruction_set: %s is not a supported instruction set", s)
|
||||
}
|
||||
return "", nil
|
||||
}
|
||||
|
||||
type toolchain64Bit struct {
|
||||
toolchainBase
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue