Remove GCC checks
Clang is always used now, so we can remove all the GCC checks. Removing GCC-specific configuration will happen in the next CL. Test: m Change-Id: I4835ecf6062159315d0dfb07b098e60bff033a8a
This commit is contained in:
@@ -302,8 +302,7 @@ func (binary *binaryDecorator) link(ctx ModuleContext,
|
|||||||
if binary.stripper.needsStrip(ctx) {
|
if binary.stripper.needsStrip(ctx) {
|
||||||
// b/80093681, GNU strip/objcopy bug.
|
// b/80093681, GNU strip/objcopy bug.
|
||||||
// Use llvm-{strip,objcopy} when clang lld is used.
|
// Use llvm-{strip,objcopy} when clang lld is used.
|
||||||
builderFlags.stripUseLlvmStrip =
|
builderFlags.stripUseLlvmStrip = binary.baseLinker.useClangLld(ctx)
|
||||||
flags.Clang && binary.baseLinker.useClangLld(ctx)
|
|
||||||
strippedOutputFile := outputFile
|
strippedOutputFile := outputFile
|
||||||
outputFile = android.PathForModuleOut(ctx, "unstripped", fileName)
|
outputFile = android.PathForModuleOut(ctx, "unstripped", fileName)
|
||||||
binary.stripper.strip(ctx, outputFile, strippedOutputFile, builderFlags)
|
binary.stripper.strip(ctx, outputFile, strippedOutputFile, builderFlags)
|
||||||
|
@@ -242,7 +242,6 @@ type builderFlags struct {
|
|||||||
aidlFlags string
|
aidlFlags string
|
||||||
rsFlags string
|
rsFlags string
|
||||||
toolchain config.Toolchain
|
toolchain config.Toolchain
|
||||||
clang bool
|
|
||||||
tidy bool
|
tidy bool
|
||||||
coverage bool
|
coverage bool
|
||||||
sAbiDump bool
|
sAbiDump bool
|
||||||
@@ -290,7 +289,7 @@ func TransformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles and
|
|||||||
|
|
||||||
objFiles := make(android.Paths, len(srcFiles))
|
objFiles := make(android.Paths, len(srcFiles))
|
||||||
var tidyFiles android.Paths
|
var tidyFiles android.Paths
|
||||||
if flags.tidy && flags.clang {
|
if flags.tidy {
|
||||||
tidyFiles = make(android.Paths, 0, len(srcFiles))
|
tidyFiles = make(android.Paths, 0, len(srcFiles))
|
||||||
}
|
}
|
||||||
var coverageFiles android.Paths
|
var coverageFiles android.Paths
|
||||||
@@ -333,19 +332,14 @@ func TransformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles and
|
|||||||
}, " ")
|
}, " ")
|
||||||
|
|
||||||
var sAbiDumpFiles android.Paths
|
var sAbiDumpFiles android.Paths
|
||||||
if flags.sAbiDump && flags.clang {
|
if flags.sAbiDump {
|
||||||
sAbiDumpFiles = make(android.Paths, 0, len(srcFiles))
|
sAbiDumpFiles = make(android.Paths, 0, len(srcFiles))
|
||||||
}
|
}
|
||||||
|
|
||||||
if flags.clang {
|
|
||||||
cflags += " ${config.NoOverrideClangGlobalCflags}"
|
cflags += " ${config.NoOverrideClangGlobalCflags}"
|
||||||
toolingCflags += " ${config.NoOverrideClangGlobalCflags}"
|
toolingCflags += " ${config.NoOverrideClangGlobalCflags}"
|
||||||
cppflags += " ${config.NoOverrideClangGlobalCflags}"
|
cppflags += " ${config.NoOverrideClangGlobalCflags}"
|
||||||
toolingCppflags += " ${config.NoOverrideClangGlobalCflags}"
|
toolingCppflags += " ${config.NoOverrideClangGlobalCflags}"
|
||||||
} else {
|
|
||||||
cflags += " ${config.NoOverrideGlobalCflags}"
|
|
||||||
cppflags += " ${config.NoOverrideGlobalCflags}"
|
|
||||||
}
|
|
||||||
|
|
||||||
for i, srcFile := range srcFiles {
|
for i, srcFile := range srcFiles {
|
||||||
objFile := android.ObjPathWithExt(ctx, subdir, srcFile, "o")
|
objFile := android.ObjPathWithExt(ctx, subdir, srcFile, "o")
|
||||||
@@ -385,23 +379,23 @@ func TransformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles and
|
|||||||
var moduleCflags string
|
var moduleCflags string
|
||||||
var moduleToolingCflags string
|
var moduleToolingCflags string
|
||||||
var ccCmd string
|
var ccCmd string
|
||||||
tidy := flags.tidy && flags.clang
|
tidy := flags.tidy
|
||||||
coverage := flags.coverage
|
coverage := flags.coverage
|
||||||
dump := flags.sAbiDump && flags.clang
|
dump := flags.sAbiDump
|
||||||
|
|
||||||
switch srcFile.Ext() {
|
switch srcFile.Ext() {
|
||||||
case ".S", ".s":
|
case ".S", ".s":
|
||||||
ccCmd = "gcc"
|
ccCmd = "clang"
|
||||||
moduleCflags = asflags
|
moduleCflags = asflags
|
||||||
tidy = false
|
tidy = false
|
||||||
coverage = false
|
coverage = false
|
||||||
dump = false
|
dump = false
|
||||||
case ".c":
|
case ".c":
|
||||||
ccCmd = "gcc"
|
ccCmd = "clang"
|
||||||
moduleCflags = cflags
|
moduleCflags = cflags
|
||||||
moduleToolingCflags = toolingCflags
|
moduleToolingCflags = toolingCflags
|
||||||
case ".cpp", ".cc", ".mm":
|
case ".cpp", ".cc", ".mm":
|
||||||
ccCmd = "g++"
|
ccCmd = "clang++"
|
||||||
moduleCflags = cppflags
|
moduleCflags = cppflags
|
||||||
moduleToolingCflags = toolingCppflags
|
moduleToolingCflags = toolingCppflags
|
||||||
default:
|
default:
|
||||||
@@ -409,24 +403,9 @@ func TransformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles and
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if flags.clang {
|
|
||||||
switch ccCmd {
|
|
||||||
case "gcc":
|
|
||||||
ccCmd = "clang"
|
|
||||||
case "g++":
|
|
||||||
ccCmd = "clang++"
|
|
||||||
default:
|
|
||||||
panic("unrecoginzied ccCmd")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ccDesc := ccCmd
|
ccDesc := ccCmd
|
||||||
|
|
||||||
if flags.clang {
|
|
||||||
ccCmd = "${config.ClangBin}/" + ccCmd
|
ccCmd = "${config.ClangBin}/" + ccCmd
|
||||||
} else {
|
|
||||||
ccCmd = gccCmd(flags.toolchain, ccCmd)
|
|
||||||
}
|
|
||||||
|
|
||||||
var implicitOutputs android.WritablePaths
|
var implicitOutputs android.WritablePaths
|
||||||
if coverage {
|
if coverage {
|
||||||
@@ -611,12 +590,7 @@ func TransformObjToDynamicBinary(ctx android.ModuleContext,
|
|||||||
objFiles, sharedLibs, staticLibs, lateStaticLibs, wholeStaticLibs, deps android.Paths,
|
objFiles, sharedLibs, staticLibs, lateStaticLibs, wholeStaticLibs, deps android.Paths,
|
||||||
crtBegin, crtEnd android.OptionalPath, groupLate bool, flags builderFlags, outputFile android.WritablePath) {
|
crtBegin, crtEnd android.OptionalPath, groupLate bool, flags builderFlags, outputFile android.WritablePath) {
|
||||||
|
|
||||||
var ldCmd string
|
ldCmd := "${config.ClangBin}/clang++"
|
||||||
if flags.clang {
|
|
||||||
ldCmd = "${config.ClangBin}/clang++"
|
|
||||||
} else {
|
|
||||||
ldCmd = gccCmd(flags.toolchain, "g++")
|
|
||||||
}
|
|
||||||
|
|
||||||
var libFlagsList []string
|
var libFlagsList []string
|
||||||
|
|
||||||
@@ -777,12 +751,7 @@ func TransformSharedObjectToToc(ctx android.ModuleContext, inputFile android.Pat
|
|||||||
func TransformObjsToObj(ctx android.ModuleContext, objFiles android.Paths,
|
func TransformObjsToObj(ctx android.ModuleContext, objFiles android.Paths,
|
||||||
flags builderFlags, outputFile android.WritablePath) {
|
flags builderFlags, outputFile android.WritablePath) {
|
||||||
|
|
||||||
var ldCmd string
|
ldCmd := "${config.ClangBin}/clang++"
|
||||||
if flags.clang {
|
|
||||||
ldCmd = "${config.ClangBin}/clang++"
|
|
||||||
} else {
|
|
||||||
ldCmd = gccCmd(flags.toolchain, "g++")
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx.Build(pctx, android.BuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: partialLd,
|
Rule: partialLd,
|
||||||
|
22
cc/cc.go
22
cc/cc.go
@@ -136,7 +136,6 @@ type Flags struct {
|
|||||||
SystemIncludeFlags []string
|
SystemIncludeFlags []string
|
||||||
|
|
||||||
Toolchain config.Toolchain
|
Toolchain config.Toolchain
|
||||||
Clang bool
|
|
||||||
Tidy bool
|
Tidy bool
|
||||||
Coverage bool
|
Coverage bool
|
||||||
SAbiDump bool
|
SAbiDump bool
|
||||||
@@ -165,9 +164,6 @@ type BaseProperties struct {
|
|||||||
// Deprecated. true is the default, false is invalid.
|
// Deprecated. true is the default, false is invalid.
|
||||||
Clang *bool `android:"arch_variant"`
|
Clang *bool `android:"arch_variant"`
|
||||||
|
|
||||||
// Some internals still need GCC (toolchain_library)
|
|
||||||
Gcc bool `blueprint:"mutated"`
|
|
||||||
|
|
||||||
// Minimum sdk version supported when compiling against the ndk
|
// Minimum sdk version supported when compiling against the ndk
|
||||||
Sdk_version *string
|
Sdk_version *string
|
||||||
|
|
||||||
@@ -220,7 +216,6 @@ type VendorProperties struct {
|
|||||||
type ModuleContextIntf interface {
|
type ModuleContextIntf interface {
|
||||||
static() bool
|
static() bool
|
||||||
staticBinary() bool
|
staticBinary() bool
|
||||||
clang() bool
|
|
||||||
toolchain() config.Toolchain
|
toolchain() config.Toolchain
|
||||||
useSdk() bool
|
useSdk() bool
|
||||||
sdkVersion() string
|
sdkVersion() string
|
||||||
@@ -513,10 +508,6 @@ type moduleContextImpl struct {
|
|||||||
ctx BaseModuleContext
|
ctx BaseModuleContext
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ctx *moduleContextImpl) clang() bool {
|
|
||||||
return ctx.mod.clang(ctx.ctx)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ctx *moduleContextImpl) toolchain() config.Toolchain {
|
func (ctx *moduleContextImpl) toolchain() config.Toolchain {
|
||||||
return ctx.mod.toolchain(ctx.ctx)
|
return ctx.mod.toolchain(ctx.ctx)
|
||||||
}
|
}
|
||||||
@@ -733,9 +724,12 @@ func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if c.Properties.Clang != nil && *c.Properties.Clang == false {
|
||||||
|
ctx.PropertyErrorf("clang", "false (GCC) is no longer supported")
|
||||||
|
}
|
||||||
|
|
||||||
flags := Flags{
|
flags := Flags{
|
||||||
Toolchain: c.toolchain(ctx),
|
Toolchain: c.toolchain(ctx),
|
||||||
Clang: c.clang(ctx),
|
|
||||||
}
|
}
|
||||||
if c.compiler != nil {
|
if c.compiler != nil {
|
||||||
flags = c.compiler.compilerFlags(ctx, flags, deps)
|
flags = c.compiler.compilerFlags(ctx, flags, deps)
|
||||||
@@ -1099,14 +1093,6 @@ func BeginMutator(ctx android.BottomUpMutatorContext) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Module) clang(ctx BaseModuleContext) bool {
|
|
||||||
if c.Properties.Clang != nil && *c.Properties.Clang == false {
|
|
||||||
ctx.PropertyErrorf("clang", "false (GCC) is no longer supported")
|
|
||||||
}
|
|
||||||
|
|
||||||
return !c.Properties.Gcc
|
|
||||||
}
|
|
||||||
|
|
||||||
// Whether a module can link to another module, taking into
|
// Whether a module can link to another module, taking into
|
||||||
// account NDK linking.
|
// account NDK linking.
|
||||||
func checkLinkType(ctx android.ModuleContext, from *Module, to *Module, tag dependencyTag) {
|
func checkLinkType(ctx android.ModuleContext, from *Module, to *Module, tag dependencyTag) {
|
||||||
|
@@ -18,7 +18,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
"android/soong/cc/config"
|
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@@ -150,18 +149,10 @@ func generateCLionProject(compiledModule CompiledInterface, ctx android.Singleto
|
|||||||
f.WriteString(fmt.Sprintf("project(%s)\n", ccModule.ModuleBase.Name()))
|
f.WriteString(fmt.Sprintf("project(%s)\n", ccModule.ModuleBase.Name()))
|
||||||
f.WriteString(fmt.Sprintf("set(ANDROID_ROOT %s)\n\n", getAndroidSrcRootDirectory(ctx)))
|
f.WriteString(fmt.Sprintf("set(ANDROID_ROOT %s)\n\n", getAndroidSrcRootDirectory(ctx)))
|
||||||
|
|
||||||
if ccModule.flags.Clang {
|
|
||||||
pathToCC, _ := evalVariable(ctx, "${config.ClangBin}/")
|
pathToCC, _ := evalVariable(ctx, "${config.ClangBin}/")
|
||||||
f.WriteString(fmt.Sprintf("set(CMAKE_C_COMPILER \"%s%s\")\n", buildCMakePath(pathToCC), "clang"))
|
f.WriteString(fmt.Sprintf("set(CMAKE_C_COMPILER \"%s%s\")\n", buildCMakePath(pathToCC), "clang"))
|
||||||
f.WriteString(fmt.Sprintf("set(CMAKE_CXX_COMPILER \"%s%s\")\n", buildCMakePath(pathToCC), "clang++"))
|
f.WriteString(fmt.Sprintf("set(CMAKE_CXX_COMPILER \"%s%s\")\n", buildCMakePath(pathToCC), "clang++"))
|
||||||
} else {
|
|
||||||
toolchain := config.FindToolchain(ccModule.Os(), ccModule.Arch())
|
|
||||||
root, _ := evalVariable(ctx, toolchain.GccRoot())
|
|
||||||
triple, _ := evalVariable(ctx, toolchain.GccTriple())
|
|
||||||
pathToCC := filepath.Join(root, "bin", triple+"-")
|
|
||||||
f.WriteString(fmt.Sprintf("set(CMAKE_C_COMPILER \"%s%s\")\n", buildCMakePath(pathToCC), "gcc"))
|
|
||||||
f.WriteString(fmt.Sprintf("set(CMAKE_CXX_COMPILER \"%s%s\")\n", buildCMakePath(pathToCC), "g++"))
|
|
||||||
}
|
|
||||||
// Add all sources to the project.
|
// Add all sources to the project.
|
||||||
f.WriteString("list(APPEND\n")
|
f.WriteString("list(APPEND\n")
|
||||||
f.WriteString(" SOURCE_FILES\n")
|
f.WriteString(" SOURCE_FILES\n")
|
||||||
|
@@ -340,10 +340,7 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
|
|||||||
if flags.RequiredInstructionSet != "" {
|
if flags.RequiredInstructionSet != "" {
|
||||||
instructionSet = flags.RequiredInstructionSet
|
instructionSet = flags.RequiredInstructionSet
|
||||||
}
|
}
|
||||||
instructionSetFlags, err := tc.InstructionSetFlags(instructionSet)
|
instructionSetFlags, err := tc.ClangInstructionSetFlags(instructionSet)
|
||||||
if flags.Clang {
|
|
||||||
instructionSetFlags, err = tc.ClangInstructionSetFlags(instructionSet)
|
|
||||||
}
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.ModuleErrorf("%s", err)
|
ctx.ModuleErrorf("%s", err)
|
||||||
}
|
}
|
||||||
@@ -353,7 +350,6 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
|
|||||||
// TODO: debug
|
// TODO: debug
|
||||||
flags.CFlags = append(flags.CFlags, esc(compiler.Properties.Release.Cflags)...)
|
flags.CFlags = append(flags.CFlags, esc(compiler.Properties.Release.Cflags)...)
|
||||||
|
|
||||||
if flags.Clang {
|
|
||||||
CheckBadCompilerFlags(ctx, "clang_cflags", compiler.Properties.Clang_cflags)
|
CheckBadCompilerFlags(ctx, "clang_cflags", compiler.Properties.Clang_cflags)
|
||||||
CheckBadCompilerFlags(ctx, "clang_asflags", compiler.Properties.Clang_asflags)
|
CheckBadCompilerFlags(ctx, "clang_asflags", compiler.Properties.Clang_asflags)
|
||||||
|
|
||||||
@@ -370,7 +366,6 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
|
|||||||
flags.CFlags = append(flags.CFlags, target, gccPrefix)
|
flags.CFlags = append(flags.CFlags, target, gccPrefix)
|
||||||
flags.AsFlags = append(flags.AsFlags, target, gccPrefix)
|
flags.AsFlags = append(flags.AsFlags, target, gccPrefix)
|
||||||
flags.LdFlags = append(flags.LdFlags, target, gccPrefix)
|
flags.LdFlags = append(flags.LdFlags, target, gccPrefix)
|
||||||
}
|
|
||||||
|
|
||||||
hod := "Host"
|
hod := "Host"
|
||||||
if ctx.Os().Class == android.Device {
|
if ctx.Os().Class == android.Device {
|
||||||
@@ -381,26 +376,16 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
|
|||||||
flags.ConlyFlags = append([]string{"${config.CommonGlobalConlyflags}"}, flags.ConlyFlags...)
|
flags.ConlyFlags = append([]string{"${config.CommonGlobalConlyflags}"}, flags.ConlyFlags...)
|
||||||
flags.CppFlags = append([]string{fmt.Sprintf("${config.%sGlobalCppflags}", hod)}, flags.CppFlags...)
|
flags.CppFlags = append([]string{fmt.Sprintf("${config.%sGlobalCppflags}", hod)}, flags.CppFlags...)
|
||||||
|
|
||||||
if flags.Clang {
|
|
||||||
flags.AsFlags = append(flags.AsFlags, tc.ClangAsflags())
|
flags.AsFlags = append(flags.AsFlags, tc.ClangAsflags())
|
||||||
flags.CppFlags = append([]string{"${config.CommonClangGlobalCppflags}"}, flags.CppFlags...)
|
flags.CppFlags = append([]string{"${config.CommonClangGlobalCppflags}"}, flags.CppFlags...)
|
||||||
flags.GlobalFlags = append(flags.GlobalFlags,
|
flags.GlobalFlags = append(flags.GlobalFlags,
|
||||||
tc.ClangCflags(),
|
tc.ClangCflags(),
|
||||||
"${config.CommonClangGlobalCflags}",
|
"${config.CommonClangGlobalCflags}",
|
||||||
fmt.Sprintf("${config.%sClangGlobalCflags}", hod))
|
fmt.Sprintf("${config.%sClangGlobalCflags}", hod))
|
||||||
} else {
|
|
||||||
flags.CppFlags = append([]string{"${config.CommonGlobalCppflags}"}, flags.CppFlags...)
|
|
||||||
flags.GlobalFlags = append(flags.GlobalFlags,
|
|
||||||
tc.Cflags(),
|
|
||||||
"${config.CommonGlobalCflags}",
|
|
||||||
fmt.Sprintf("${config.%sGlobalCflags}", hod))
|
|
||||||
}
|
|
||||||
|
|
||||||
if flags.Clang {
|
|
||||||
if strings.HasPrefix(android.PathForModuleSrc(ctx).String(), "external/") {
|
if strings.HasPrefix(android.PathForModuleSrc(ctx).String(), "external/") {
|
||||||
flags.GlobalFlags = append([]string{"${config.ClangExternalCflags}"}, flags.GlobalFlags...)
|
flags.GlobalFlags = append([]string{"${config.ClangExternalCflags}"}, flags.GlobalFlags...)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ctx.Device() {
|
if ctx.Device() {
|
||||||
if Bool(compiler.Properties.Rtti) {
|
if Bool(compiler.Properties.Rtti) {
|
||||||
@@ -412,19 +397,11 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
|
|||||||
|
|
||||||
flags.AsFlags = append(flags.AsFlags, "-D__ASSEMBLY__")
|
flags.AsFlags = append(flags.AsFlags, "-D__ASSEMBLY__")
|
||||||
|
|
||||||
if flags.Clang {
|
|
||||||
flags.CppFlags = append(flags.CppFlags, tc.ClangCppflags())
|
flags.CppFlags = append(flags.CppFlags, tc.ClangCppflags())
|
||||||
} else {
|
|
||||||
flags.CppFlags = append(flags.CppFlags, tc.Cppflags())
|
|
||||||
}
|
|
||||||
|
|
||||||
flags.YasmFlags = append(flags.YasmFlags, tc.YasmFlags())
|
flags.YasmFlags = append(flags.YasmFlags, tc.YasmFlags())
|
||||||
|
|
||||||
if flags.Clang {
|
|
||||||
flags.GlobalFlags = append(flags.GlobalFlags, tc.ToolchainClangCflags())
|
flags.GlobalFlags = append(flags.GlobalFlags, tc.ToolchainClangCflags())
|
||||||
} else {
|
|
||||||
flags.GlobalFlags = append(flags.GlobalFlags, tc.ToolchainCflags())
|
|
||||||
}
|
|
||||||
|
|
||||||
cStd := config.CStdVersion
|
cStd := config.CStdVersion
|
||||||
if String(compiler.Properties.C_std) == "experimental" {
|
if String(compiler.Properties.C_std) == "experimental" {
|
||||||
|
@@ -348,17 +348,6 @@ func (t *toolchainArm) IncludeFlags() string {
|
|||||||
return "${config.ArmIncludeFlags}"
|
return "${config.ArmIncludeFlags}"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *toolchainArm) InstructionSetFlags(isa string) (string, error) {
|
|
||||||
switch isa {
|
|
||||||
case "arm":
|
|
||||||
return "${config.ArmArmCflags}", nil
|
|
||||||
case "thumb", "":
|
|
||||||
return "${config.ArmThumbCflags}", nil
|
|
||||||
default:
|
|
||||||
return t.toolchainBase.InstructionSetFlags(isa)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *toolchainArm) ClangTriple() string {
|
func (t *toolchainArm) ClangTriple() string {
|
||||||
// http://b/72619014 work around llvm LTO bug.
|
// http://b/72619014 work around llvm LTO bug.
|
||||||
return "armv7a-linux-androideabi"
|
return "armv7a-linux-androideabi"
|
||||||
|
@@ -146,19 +146,13 @@ func init() {
|
|||||||
commonGlobalCflags = append(commonGlobalCflags, "-fdebug-prefix-map=/proc/self/cwd=")
|
commonGlobalCflags = append(commonGlobalCflags, "-fdebug-prefix-map=/proc/self/cwd=")
|
||||||
}
|
}
|
||||||
|
|
||||||
pctx.StaticVariable("CommonGlobalCflags", strings.Join(commonGlobalCflags, " "))
|
|
||||||
pctx.StaticVariable("CommonGlobalConlyflags", strings.Join(commonGlobalConlyflags, " "))
|
pctx.StaticVariable("CommonGlobalConlyflags", strings.Join(commonGlobalConlyflags, " "))
|
||||||
pctx.StaticVariable("DeviceGlobalCflags", strings.Join(deviceGlobalCflags, " "))
|
|
||||||
pctx.StaticVariable("DeviceGlobalCppflags", strings.Join(deviceGlobalCppflags, " "))
|
pctx.StaticVariable("DeviceGlobalCppflags", strings.Join(deviceGlobalCppflags, " "))
|
||||||
pctx.StaticVariable("DeviceGlobalLdflags", strings.Join(deviceGlobalLdflags, " "))
|
pctx.StaticVariable("DeviceGlobalLdflags", strings.Join(deviceGlobalLdflags, " "))
|
||||||
pctx.StaticVariable("DeviceGlobalLldflags", strings.Join(deviceGlobalLldflags, " "))
|
pctx.StaticVariable("DeviceGlobalLldflags", strings.Join(deviceGlobalLldflags, " "))
|
||||||
pctx.StaticVariable("HostGlobalCflags", strings.Join(hostGlobalCflags, " "))
|
|
||||||
pctx.StaticVariable("HostGlobalCppflags", strings.Join(hostGlobalCppflags, " "))
|
pctx.StaticVariable("HostGlobalCppflags", strings.Join(hostGlobalCppflags, " "))
|
||||||
pctx.StaticVariable("HostGlobalLdflags", strings.Join(hostGlobalLdflags, " "))
|
pctx.StaticVariable("HostGlobalLdflags", strings.Join(hostGlobalLdflags, " "))
|
||||||
pctx.StaticVariable("HostGlobalLldflags", strings.Join(hostGlobalLldflags, " "))
|
pctx.StaticVariable("HostGlobalLldflags", strings.Join(hostGlobalLldflags, " "))
|
||||||
pctx.StaticVariable("NoOverrideGlobalCflags", strings.Join(noOverrideGlobalCflags, " "))
|
|
||||||
|
|
||||||
pctx.StaticVariable("CommonGlobalCppflags", strings.Join(commonGlobalCppflags, " "))
|
|
||||||
|
|
||||||
pctx.StaticVariable("CommonClangGlobalCflags",
|
pctx.StaticVariable("CommonClangGlobalCflags",
|
||||||
strings.Join(append(ClangFilterUnknownCflags(commonGlobalCflags), "${ClangExtraCflags}"), " "))
|
strings.Join(append(ClangFilterUnknownCflags(commonGlobalCflags), "${ClangExtraCflags}"), " "))
|
||||||
|
@@ -49,13 +49,7 @@ type Toolchain interface {
|
|||||||
GccVersion() string
|
GccVersion() string
|
||||||
ToolPath() string
|
ToolPath() string
|
||||||
|
|
||||||
ToolchainCflags() string
|
|
||||||
ToolchainLdflags() string
|
|
||||||
Cflags() string
|
|
||||||
Cppflags() string
|
|
||||||
Ldflags() string
|
|
||||||
IncludeFlags() string
|
IncludeFlags() string
|
||||||
InstructionSetFlags(string) (string, error)
|
|
||||||
|
|
||||||
ClangTriple() string
|
ClangTriple() string
|
||||||
ToolchainClangCflags() string
|
ToolchainClangCflags() string
|
||||||
@@ -101,13 +95,6 @@ func NDKTriple(toolchain Toolchain) string {
|
|||||||
return triple
|
return triple
|
||||||
}
|
}
|
||||||
|
|
||||||
func (toolchainBase) InstructionSetFlags(s string) (string, error) {
|
|
||||||
if s != "" {
|
|
||||||
return "", fmt.Errorf("instruction_set: %s is not a supported instruction set", s)
|
|
||||||
}
|
|
||||||
return "", nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (toolchainBase) ClangInstructionSetFlags(s string) (string, error) {
|
func (toolchainBase) ClangInstructionSetFlags(s string) (string, error) {
|
||||||
if s != "" {
|
if s != "" {
|
||||||
return "", fmt.Errorf("instruction_set: %s is not a supported instruction set", s)
|
return "", fmt.Errorf("instruction_set: %s is not a supported instruction set", s)
|
||||||
@@ -115,14 +102,6 @@ func (toolchainBase) ClangInstructionSetFlags(s string) (string, error) {
|
|||||||
return "", nil
|
return "", nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (toolchainBase) ToolchainCflags() string {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (toolchainBase) ToolchainLdflags() string {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (toolchainBase) ToolchainClangCflags() string {
|
func (toolchainBase) ToolchainClangCflags() string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
@@ -274,11 +274,6 @@ func (library *libraryDecorator) linkerFlags(ctx ModuleContext, flags Flags) Fla
|
|||||||
|
|
||||||
if library.shared() {
|
if library.shared() {
|
||||||
libName := library.getLibName(ctx)
|
libName := library.getLibName(ctx)
|
||||||
// GCC for Android assumes that -shared means -Bsymbolic, use -Wl,-shared instead
|
|
||||||
sharedFlag := "-Wl,-shared"
|
|
||||||
if flags.Clang || ctx.Host() {
|
|
||||||
sharedFlag = "-shared"
|
|
||||||
}
|
|
||||||
var f []string
|
var f []string
|
||||||
if ctx.toolchain().Bionic() {
|
if ctx.toolchain().Bionic() {
|
||||||
f = append(f,
|
f = append(f,
|
||||||
@@ -300,7 +295,7 @@ func (library *libraryDecorator) linkerFlags(ctx ModuleContext, flags Flags) Fla
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
f = append(f,
|
f = append(f,
|
||||||
sharedFlag,
|
"-shared",
|
||||||
"-Wl,-soname,"+libName+flags.Toolchain.ShlibSuffix())
|
"-Wl,-soname,"+libName+flags.Toolchain.ShlibSuffix())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -558,8 +553,7 @@ func (library *libraryDecorator) linkShared(ctx ModuleContext,
|
|||||||
if library.stripper.needsStrip(ctx) {
|
if library.stripper.needsStrip(ctx) {
|
||||||
// b/80093681, GNU strip/objcopy bug.
|
// b/80093681, GNU strip/objcopy bug.
|
||||||
// Use llvm-{strip,objcopy} when clang lld is used.
|
// Use llvm-{strip,objcopy} when clang lld is used.
|
||||||
builderFlags.stripUseLlvmStrip =
|
builderFlags.stripUseLlvmStrip = library.baseLinker.useClangLld(ctx)
|
||||||
flags.Clang && library.baseLinker.useClangLld(ctx)
|
|
||||||
strippedOutputFile := outputFile
|
strippedOutputFile := outputFile
|
||||||
outputFile = android.PathForModuleOut(ctx, "unstripped", fileName)
|
outputFile = android.PathForModuleOut(ctx, "unstripped", fileName)
|
||||||
library.stripper.strip(ctx, outputFile, strippedOutputFile, builderFlags)
|
library.stripper.strip(ctx, outputFile, strippedOutputFile, builderFlags)
|
||||||
|
12
cc/linker.go
12
cc/linker.go
@@ -293,7 +293,7 @@ func (linker *baseLinker) linkerFlags(ctx ModuleContext, flags Flags) Flags {
|
|||||||
hod = "Device"
|
hod = "Device"
|
||||||
}
|
}
|
||||||
|
|
||||||
if flags.Clang && linker.useClangLld(ctx) {
|
if linker.useClangLld(ctx) {
|
||||||
flags.LdFlags = append(flags.LdFlags, fmt.Sprintf("${config.%sGlobalLldflags}", hod))
|
flags.LdFlags = append(flags.LdFlags, fmt.Sprintf("${config.%sGlobalLldflags}", hod))
|
||||||
if !BoolDefault(linker.MoreProperties.Pack_relocations, true) {
|
if !BoolDefault(linker.MoreProperties.Pack_relocations, true) {
|
||||||
flags.LdFlags = append(flags.LdFlags, "-Wl,--pack-dyn-relocs=none")
|
flags.LdFlags = append(flags.LdFlags, "-Wl,--pack-dyn-relocs=none")
|
||||||
@@ -310,12 +310,10 @@ func (linker *baseLinker) linkerFlags(ctx ModuleContext, flags Flags) Flags {
|
|||||||
flags.LdFlags = append(flags.LdFlags, "-Wl,--no-undefined")
|
flags.LdFlags = append(flags.LdFlags, "-Wl,--no-undefined")
|
||||||
}
|
}
|
||||||
|
|
||||||
if flags.Clang && linker.useClangLld(ctx) {
|
if linker.useClangLld(ctx) {
|
||||||
flags.LdFlags = append(flags.LdFlags, toolchain.ClangLldflags())
|
flags.LdFlags = append(flags.LdFlags, toolchain.ClangLldflags())
|
||||||
} else if flags.Clang {
|
|
||||||
flags.LdFlags = append(flags.LdFlags, toolchain.ClangLdflags())
|
|
||||||
} else {
|
} else {
|
||||||
flags.LdFlags = append(flags.LdFlags, toolchain.Ldflags())
|
flags.LdFlags = append(flags.LdFlags, toolchain.ClangLdflags())
|
||||||
}
|
}
|
||||||
|
|
||||||
if !ctx.toolchain().Bionic() {
|
if !ctx.toolchain().Bionic() {
|
||||||
@@ -362,11 +360,7 @@ func (linker *baseLinker) linkerFlags(ctx ModuleContext, flags Flags) Flags {
|
|||||||
flags.LdFlags = append(flags.LdFlags, "-Wl,--hash-style=both")
|
flags.LdFlags = append(flags.LdFlags, "-Wl,--hash-style=both")
|
||||||
}
|
}
|
||||||
|
|
||||||
if flags.Clang {
|
|
||||||
flags.LdFlags = append(flags.LdFlags, toolchain.ToolchainClangLdflags())
|
flags.LdFlags = append(flags.LdFlags, toolchain.ToolchainClangLdflags())
|
||||||
} else {
|
|
||||||
flags.LdFlags = append(flags.LdFlags, toolchain.ToolchainLdflags())
|
|
||||||
}
|
|
||||||
|
|
||||||
if Bool(linker.Properties.Group_static_libs) {
|
if Bool(linker.Properties.Group_static_libs) {
|
||||||
flags.GroupStaticLibs = true
|
flags.GroupStaticLibs = true
|
||||||
|
@@ -64,11 +64,7 @@ func (object *objectLinker) linkerDeps(ctx DepsContext, deps Deps) Deps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (*objectLinker) linkerFlags(ctx ModuleContext, flags Flags) Flags {
|
func (*objectLinker) linkerFlags(ctx ModuleContext, flags Flags) Flags {
|
||||||
if flags.Clang {
|
|
||||||
flags.LdFlags = append(flags.LdFlags, ctx.toolchain().ToolchainClangLdflags())
|
flags.LdFlags = append(flags.LdFlags, ctx.toolchain().ToolchainClangLdflags())
|
||||||
} else {
|
|
||||||
flags.LdFlags = append(flags.LdFlags, ctx.toolchain().ToolchainLdflags())
|
|
||||||
}
|
|
||||||
|
|
||||||
return flags
|
return flags
|
||||||
}
|
}
|
||||||
|
@@ -164,7 +164,6 @@ func (sanitize *sanitize) begin(ctx BaseModuleContext) {
|
|||||||
var globalSanitizers []string
|
var globalSanitizers []string
|
||||||
var globalSanitizersDiag []string
|
var globalSanitizersDiag []string
|
||||||
|
|
||||||
if ctx.clang() {
|
|
||||||
if ctx.Host() {
|
if ctx.Host() {
|
||||||
if !ctx.Windows() {
|
if !ctx.Windows() {
|
||||||
globalSanitizers = ctx.Config().SanitizeHost()
|
globalSanitizers = ctx.Config().SanitizeHost()
|
||||||
@@ -176,7 +175,6 @@ func (sanitize *sanitize) begin(ctx BaseModuleContext) {
|
|||||||
globalSanitizersDiag = ctx.Config().SanitizeDeviceDiag()
|
globalSanitizersDiag = ctx.Config().SanitizeDeviceDiag()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if len(globalSanitizers) > 0 {
|
if len(globalSanitizers) > 0 {
|
||||||
var found bool
|
var found bool
|
||||||
@@ -369,10 +367,6 @@ func (sanitize *sanitize) flags(ctx ModuleContext, flags Flags) Flags {
|
|||||||
return flags
|
return flags
|
||||||
}
|
}
|
||||||
|
|
||||||
if !ctx.clang() {
|
|
||||||
ctx.ModuleErrorf("Use of sanitizers requires clang")
|
|
||||||
}
|
|
||||||
|
|
||||||
var sanitizers []string
|
var sanitizers []string
|
||||||
var diagSanitizers []string
|
var diagSanitizers []string
|
||||||
|
|
||||||
|
@@ -62,11 +62,6 @@ func (tidy *tidyFeature) flags(ctx ModuleContext, flags Flags) Flags {
|
|||||||
return flags
|
return flags
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clang-tidy requires clang
|
|
||||||
if !flags.Clang {
|
|
||||||
return flags
|
|
||||||
}
|
|
||||||
|
|
||||||
flags.Tidy = true
|
flags.Tidy = true
|
||||||
|
|
||||||
// Add global WITH_TIDY_FLAGS and local tidy_flags.
|
// Add global WITH_TIDY_FLAGS and local tidy_flags.
|
||||||
|
@@ -56,7 +56,6 @@ func ToolchainLibraryFactory() android.Module {
|
|||||||
}
|
}
|
||||||
module.compiler = toolchainLibrary
|
module.compiler = toolchainLibrary
|
||||||
module.linker = toolchainLibrary
|
module.linker = toolchainLibrary
|
||||||
module.Properties.Gcc = true
|
|
||||||
module.stl = nil
|
module.stl = nil
|
||||||
module.sanitize = nil
|
module.sanitize = nil
|
||||||
module.installer = nil
|
module.installer = nil
|
||||||
|
@@ -78,7 +78,6 @@ func flagsToBuilderFlags(in Flags) builderFlags {
|
|||||||
sAbiFlags: strings.Join(in.SAbiFlags, " "),
|
sAbiFlags: strings.Join(in.SAbiFlags, " "),
|
||||||
yasmFlags: strings.Join(in.YasmFlags, " "),
|
yasmFlags: strings.Join(in.YasmFlags, " "),
|
||||||
toolchain: in.Toolchain,
|
toolchain: in.Toolchain,
|
||||||
clang: in.Clang,
|
|
||||||
coverage: in.Coverage,
|
coverage: in.Coverage,
|
||||||
tidy: in.Tidy,
|
tidy: in.Tidy,
|
||||||
sAbiDump: in.SAbiDump,
|
sAbiDump: in.SAbiDump,
|
||||||
|
Reference in New Issue
Block a user