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:
parent
230e4c77a5
commit
8536d6b3b7
|
@ -302,8 +302,7 @@ func (binary *binaryDecorator) link(ctx ModuleContext,
|
|||
if binary.stripper.needsStrip(ctx) {
|
||||
// b/80093681, GNU strip/objcopy bug.
|
||||
// Use llvm-{strip,objcopy} when clang lld is used.
|
||||
builderFlags.stripUseLlvmStrip =
|
||||
flags.Clang && binary.baseLinker.useClangLld(ctx)
|
||||
builderFlags.stripUseLlvmStrip = binary.baseLinker.useClangLld(ctx)
|
||||
strippedOutputFile := outputFile
|
||||
outputFile = android.PathForModuleOut(ctx, "unstripped", fileName)
|
||||
binary.stripper.strip(ctx, outputFile, strippedOutputFile, builderFlags)
|
||||
|
|
|
@ -242,7 +242,6 @@ type builderFlags struct {
|
|||
aidlFlags string
|
||||
rsFlags string
|
||||
toolchain config.Toolchain
|
||||
clang bool
|
||||
tidy bool
|
||||
coverage bool
|
||||
sAbiDump bool
|
||||
|
@ -290,7 +289,7 @@ func TransformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles and
|
|||
|
||||
objFiles := make(android.Paths, len(srcFiles))
|
||||
var tidyFiles android.Paths
|
||||
if flags.tidy && flags.clang {
|
||||
if flags.tidy {
|
||||
tidyFiles = make(android.Paths, 0, len(srcFiles))
|
||||
}
|
||||
var coverageFiles android.Paths
|
||||
|
@ -333,19 +332,14 @@ func TransformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles and
|
|||
}, " ")
|
||||
|
||||
var sAbiDumpFiles android.Paths
|
||||
if flags.sAbiDump && flags.clang {
|
||||
if flags.sAbiDump {
|
||||
sAbiDumpFiles = make(android.Paths, 0, len(srcFiles))
|
||||
}
|
||||
|
||||
if flags.clang {
|
||||
cflags += " ${config.NoOverrideClangGlobalCflags}"
|
||||
toolingCflags += " ${config.NoOverrideClangGlobalCflags}"
|
||||
cppflags += " ${config.NoOverrideClangGlobalCflags}"
|
||||
toolingCppflags += " ${config.NoOverrideClangGlobalCflags}"
|
||||
} else {
|
||||
cflags += " ${config.NoOverrideGlobalCflags}"
|
||||
cppflags += " ${config.NoOverrideGlobalCflags}"
|
||||
}
|
||||
cflags += " ${config.NoOverrideClangGlobalCflags}"
|
||||
toolingCflags += " ${config.NoOverrideClangGlobalCflags}"
|
||||
cppflags += " ${config.NoOverrideClangGlobalCflags}"
|
||||
toolingCppflags += " ${config.NoOverrideClangGlobalCflags}"
|
||||
|
||||
for i, srcFile := range srcFiles {
|
||||
objFile := android.ObjPathWithExt(ctx, subdir, srcFile, "o")
|
||||
|
@ -385,23 +379,23 @@ func TransformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles and
|
|||
var moduleCflags string
|
||||
var moduleToolingCflags string
|
||||
var ccCmd string
|
||||
tidy := flags.tidy && flags.clang
|
||||
tidy := flags.tidy
|
||||
coverage := flags.coverage
|
||||
dump := flags.sAbiDump && flags.clang
|
||||
dump := flags.sAbiDump
|
||||
|
||||
switch srcFile.Ext() {
|
||||
case ".S", ".s":
|
||||
ccCmd = "gcc"
|
||||
ccCmd = "clang"
|
||||
moduleCflags = asflags
|
||||
tidy = false
|
||||
coverage = false
|
||||
dump = false
|
||||
case ".c":
|
||||
ccCmd = "gcc"
|
||||
ccCmd = "clang"
|
||||
moduleCflags = cflags
|
||||
moduleToolingCflags = toolingCflags
|
||||
case ".cpp", ".cc", ".mm":
|
||||
ccCmd = "g++"
|
||||
ccCmd = "clang++"
|
||||
moduleCflags = cppflags
|
||||
moduleToolingCflags = toolingCppflags
|
||||
default:
|
||||
|
@ -409,24 +403,9 @@ func TransformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles and
|
|||
continue
|
||||
}
|
||||
|
||||
if flags.clang {
|
||||
switch ccCmd {
|
||||
case "gcc":
|
||||
ccCmd = "clang"
|
||||
case "g++":
|
||||
ccCmd = "clang++"
|
||||
default:
|
||||
panic("unrecoginzied ccCmd")
|
||||
}
|
||||
}
|
||||
|
||||
ccDesc := ccCmd
|
||||
|
||||
if flags.clang {
|
||||
ccCmd = "${config.ClangBin}/" + ccCmd
|
||||
} else {
|
||||
ccCmd = gccCmd(flags.toolchain, ccCmd)
|
||||
}
|
||||
ccCmd = "${config.ClangBin}/" + ccCmd
|
||||
|
||||
var implicitOutputs android.WritablePaths
|
||||
if coverage {
|
||||
|
@ -611,12 +590,7 @@ func TransformObjToDynamicBinary(ctx android.ModuleContext,
|
|||
objFiles, sharedLibs, staticLibs, lateStaticLibs, wholeStaticLibs, deps android.Paths,
|
||||
crtBegin, crtEnd android.OptionalPath, groupLate bool, flags builderFlags, outputFile android.WritablePath) {
|
||||
|
||||
var ldCmd string
|
||||
if flags.clang {
|
||||
ldCmd = "${config.ClangBin}/clang++"
|
||||
} else {
|
||||
ldCmd = gccCmd(flags.toolchain, "g++")
|
||||
}
|
||||
ldCmd := "${config.ClangBin}/clang++"
|
||||
|
||||
var libFlagsList []string
|
||||
|
||||
|
@ -777,12 +751,7 @@ func TransformSharedObjectToToc(ctx android.ModuleContext, inputFile android.Pat
|
|||
func TransformObjsToObj(ctx android.ModuleContext, objFiles android.Paths,
|
||||
flags builderFlags, outputFile android.WritablePath) {
|
||||
|
||||
var ldCmd string
|
||||
if flags.clang {
|
||||
ldCmd = "${config.ClangBin}/clang++"
|
||||
} else {
|
||||
ldCmd = gccCmd(flags.toolchain, "g++")
|
||||
}
|
||||
ldCmd := "${config.ClangBin}/clang++"
|
||||
|
||||
ctx.Build(pctx, android.BuildParams{
|
||||
Rule: partialLd,
|
||||
|
|
22
cc/cc.go
22
cc/cc.go
|
@ -136,7 +136,6 @@ type Flags struct {
|
|||
SystemIncludeFlags []string
|
||||
|
||||
Toolchain config.Toolchain
|
||||
Clang bool
|
||||
Tidy bool
|
||||
Coverage bool
|
||||
SAbiDump bool
|
||||
|
@ -165,9 +164,6 @@ type BaseProperties struct {
|
|||
// Deprecated. true is the default, false is invalid.
|
||||
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
|
||||
Sdk_version *string
|
||||
|
||||
|
@ -220,7 +216,6 @@ type VendorProperties struct {
|
|||
type ModuleContextIntf interface {
|
||||
static() bool
|
||||
staticBinary() bool
|
||||
clang() bool
|
||||
toolchain() config.Toolchain
|
||||
useSdk() bool
|
||||
sdkVersion() string
|
||||
|
@ -513,10 +508,6 @@ type moduleContextImpl struct {
|
|||
ctx BaseModuleContext
|
||||
}
|
||||
|
||||
func (ctx *moduleContextImpl) clang() bool {
|
||||
return ctx.mod.clang(ctx.ctx)
|
||||
}
|
||||
|
||||
func (ctx *moduleContextImpl) toolchain() config.Toolchain {
|
||||
return ctx.mod.toolchain(ctx.ctx)
|
||||
}
|
||||
|
@ -733,9 +724,12 @@ func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
|
|||
return
|
||||
}
|
||||
|
||||
if c.Properties.Clang != nil && *c.Properties.Clang == false {
|
||||
ctx.PropertyErrorf("clang", "false (GCC) is no longer supported")
|
||||
}
|
||||
|
||||
flags := Flags{
|
||||
Toolchain: c.toolchain(ctx),
|
||||
Clang: c.clang(ctx),
|
||||
}
|
||||
if c.compiler != nil {
|
||||
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
|
||||
// account NDK linking.
|
||||
func checkLinkType(ctx android.ModuleContext, from *Module, to *Module, tag dependencyTag) {
|
||||
|
|
|
@ -18,7 +18,6 @@ import (
|
|||
"fmt"
|
||||
|
||||
"android/soong/android"
|
||||
"android/soong/cc/config"
|
||||
"os"
|
||||
"path"
|
||||
"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("set(ANDROID_ROOT %s)\n\n", getAndroidSrcRootDirectory(ctx)))
|
||||
|
||||
if ccModule.flags.Clang {
|
||||
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_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++"))
|
||||
}
|
||||
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_CXX_COMPILER \"%s%s\")\n", buildCMakePath(pathToCC), "clang++"))
|
||||
|
||||
// Add all sources to the project.
|
||||
f.WriteString("list(APPEND\n")
|
||||
f.WriteString(" SOURCE_FILES\n")
|
||||
|
|
|
@ -340,10 +340,7 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
|
|||
if flags.RequiredInstructionSet != "" {
|
||||
instructionSet = flags.RequiredInstructionSet
|
||||
}
|
||||
instructionSetFlags, err := tc.InstructionSetFlags(instructionSet)
|
||||
if flags.Clang {
|
||||
instructionSetFlags, err = tc.ClangInstructionSetFlags(instructionSet)
|
||||
}
|
||||
instructionSetFlags, err := tc.ClangInstructionSetFlags(instructionSet)
|
||||
if err != nil {
|
||||
ctx.ModuleErrorf("%s", err)
|
||||
}
|
||||
|
@ -353,24 +350,22 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
|
|||
// TODO: debug
|
||||
flags.CFlags = append(flags.CFlags, esc(compiler.Properties.Release.Cflags)...)
|
||||
|
||||
if flags.Clang {
|
||||
CheckBadCompilerFlags(ctx, "clang_cflags", compiler.Properties.Clang_cflags)
|
||||
CheckBadCompilerFlags(ctx, "clang_asflags", compiler.Properties.Clang_asflags)
|
||||
CheckBadCompilerFlags(ctx, "clang_cflags", compiler.Properties.Clang_cflags)
|
||||
CheckBadCompilerFlags(ctx, "clang_asflags", compiler.Properties.Clang_asflags)
|
||||
|
||||
flags.CFlags = config.ClangFilterUnknownCflags(flags.CFlags)
|
||||
flags.CFlags = append(flags.CFlags, esc(compiler.Properties.Clang_cflags)...)
|
||||
flags.AsFlags = append(flags.AsFlags, esc(compiler.Properties.Clang_asflags)...)
|
||||
flags.CppFlags = config.ClangFilterUnknownCflags(flags.CppFlags)
|
||||
flags.ConlyFlags = config.ClangFilterUnknownCflags(flags.ConlyFlags)
|
||||
flags.LdFlags = config.ClangFilterUnknownCflags(flags.LdFlags)
|
||||
flags.CFlags = config.ClangFilterUnknownCflags(flags.CFlags)
|
||||
flags.CFlags = append(flags.CFlags, esc(compiler.Properties.Clang_cflags)...)
|
||||
flags.AsFlags = append(flags.AsFlags, esc(compiler.Properties.Clang_asflags)...)
|
||||
flags.CppFlags = config.ClangFilterUnknownCflags(flags.CppFlags)
|
||||
flags.ConlyFlags = config.ClangFilterUnknownCflags(flags.ConlyFlags)
|
||||
flags.LdFlags = config.ClangFilterUnknownCflags(flags.LdFlags)
|
||||
|
||||
target := "-target " + tc.ClangTriple()
|
||||
gccPrefix := "-B" + config.ToolPath(tc)
|
||||
target := "-target " + tc.ClangTriple()
|
||||
gccPrefix := "-B" + config.ToolPath(tc)
|
||||
|
||||
flags.CFlags = append(flags.CFlags, target, gccPrefix)
|
||||
flags.AsFlags = append(flags.AsFlags, target, gccPrefix)
|
||||
flags.LdFlags = append(flags.LdFlags, target, gccPrefix)
|
||||
}
|
||||
flags.CFlags = append(flags.CFlags, target, gccPrefix)
|
||||
flags.AsFlags = append(flags.AsFlags, target, gccPrefix)
|
||||
flags.LdFlags = append(flags.LdFlags, target, gccPrefix)
|
||||
|
||||
hod := "Host"
|
||||
if ctx.Os().Class == android.Device {
|
||||
|
@ -381,25 +376,15 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
|
|||
flags.ConlyFlags = append([]string{"${config.CommonGlobalConlyflags}"}, flags.ConlyFlags...)
|
||||
flags.CppFlags = append([]string{fmt.Sprintf("${config.%sGlobalCppflags}", hod)}, flags.CppFlags...)
|
||||
|
||||
if flags.Clang {
|
||||
flags.AsFlags = append(flags.AsFlags, tc.ClangAsflags())
|
||||
flags.CppFlags = append([]string{"${config.CommonClangGlobalCppflags}"}, flags.CppFlags...)
|
||||
flags.GlobalFlags = append(flags.GlobalFlags,
|
||||
tc.ClangCflags(),
|
||||
"${config.CommonClangGlobalCflags}",
|
||||
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))
|
||||
}
|
||||
flags.AsFlags = append(flags.AsFlags, tc.ClangAsflags())
|
||||
flags.CppFlags = append([]string{"${config.CommonClangGlobalCppflags}"}, flags.CppFlags...)
|
||||
flags.GlobalFlags = append(flags.GlobalFlags,
|
||||
tc.ClangCflags(),
|
||||
"${config.CommonClangGlobalCflags}",
|
||||
fmt.Sprintf("${config.%sClangGlobalCflags}", hod))
|
||||
|
||||
if flags.Clang {
|
||||
if strings.HasPrefix(android.PathForModuleSrc(ctx).String(), "external/") {
|
||||
flags.GlobalFlags = append([]string{"${config.ClangExternalCflags}"}, flags.GlobalFlags...)
|
||||
}
|
||||
if strings.HasPrefix(android.PathForModuleSrc(ctx).String(), "external/") {
|
||||
flags.GlobalFlags = append([]string{"${config.ClangExternalCflags}"}, flags.GlobalFlags...)
|
||||
}
|
||||
|
||||
if ctx.Device() {
|
||||
|
@ -412,19 +397,11 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
|
|||
|
||||
flags.AsFlags = append(flags.AsFlags, "-D__ASSEMBLY__")
|
||||
|
||||
if flags.Clang {
|
||||
flags.CppFlags = append(flags.CppFlags, tc.ClangCppflags())
|
||||
} else {
|
||||
flags.CppFlags = append(flags.CppFlags, tc.Cppflags())
|
||||
}
|
||||
flags.CppFlags = append(flags.CppFlags, tc.ClangCppflags())
|
||||
|
||||
flags.YasmFlags = append(flags.YasmFlags, tc.YasmFlags())
|
||||
|
||||
if flags.Clang {
|
||||
flags.GlobalFlags = append(flags.GlobalFlags, tc.ToolchainClangCflags())
|
||||
} else {
|
||||
flags.GlobalFlags = append(flags.GlobalFlags, tc.ToolchainCflags())
|
||||
}
|
||||
flags.GlobalFlags = append(flags.GlobalFlags, tc.ToolchainClangCflags())
|
||||
|
||||
cStd := config.CStdVersion
|
||||
if String(compiler.Properties.C_std) == "experimental" {
|
||||
|
|
|
@ -348,17 +348,6 @@ func (t *toolchainArm) IncludeFlags() string {
|
|||
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 {
|
||||
// http://b/72619014 work around llvm LTO bug.
|
||||
return "armv7a-linux-androideabi"
|
||||
|
|
|
@ -146,19 +146,13 @@ func init() {
|
|||
commonGlobalCflags = append(commonGlobalCflags, "-fdebug-prefix-map=/proc/self/cwd=")
|
||||
}
|
||||
|
||||
pctx.StaticVariable("CommonGlobalCflags", strings.Join(commonGlobalCflags, " "))
|
||||
pctx.StaticVariable("CommonGlobalConlyflags", strings.Join(commonGlobalConlyflags, " "))
|
||||
pctx.StaticVariable("DeviceGlobalCflags", strings.Join(deviceGlobalCflags, " "))
|
||||
pctx.StaticVariable("DeviceGlobalCppflags", strings.Join(deviceGlobalCppflags, " "))
|
||||
pctx.StaticVariable("DeviceGlobalLdflags", strings.Join(deviceGlobalLdflags, " "))
|
||||
pctx.StaticVariable("DeviceGlobalLldflags", strings.Join(deviceGlobalLldflags, " "))
|
||||
pctx.StaticVariable("HostGlobalCflags", strings.Join(hostGlobalCflags, " "))
|
||||
pctx.StaticVariable("HostGlobalCppflags", strings.Join(hostGlobalCppflags, " "))
|
||||
pctx.StaticVariable("HostGlobalLdflags", strings.Join(hostGlobalLdflags, " "))
|
||||
pctx.StaticVariable("HostGlobalLldflags", strings.Join(hostGlobalLldflags, " "))
|
||||
pctx.StaticVariable("NoOverrideGlobalCflags", strings.Join(noOverrideGlobalCflags, " "))
|
||||
|
||||
pctx.StaticVariable("CommonGlobalCppflags", strings.Join(commonGlobalCppflags, " "))
|
||||
|
||||
pctx.StaticVariable("CommonClangGlobalCflags",
|
||||
strings.Join(append(ClangFilterUnknownCflags(commonGlobalCflags), "${ClangExtraCflags}"), " "))
|
||||
|
|
|
@ -49,13 +49,7 @@ type Toolchain interface {
|
|||
GccVersion() string
|
||||
ToolPath() string
|
||||
|
||||
ToolchainCflags() string
|
||||
ToolchainLdflags() string
|
||||
Cflags() string
|
||||
Cppflags() string
|
||||
Ldflags() string
|
||||
IncludeFlags() string
|
||||
InstructionSetFlags(string) (string, error)
|
||||
|
||||
ClangTriple() string
|
||||
ToolchainClangCflags() string
|
||||
|
@ -101,13 +95,6 @@ func NDKTriple(toolchain Toolchain) string {
|
|||
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) {
|
||||
if 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
|
||||
}
|
||||
|
||||
func (toolchainBase) ToolchainCflags() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (toolchainBase) ToolchainLdflags() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (toolchainBase) ToolchainClangCflags() string {
|
||||
return ""
|
||||
}
|
||||
|
|
|
@ -274,11 +274,6 @@ func (library *libraryDecorator) linkerFlags(ctx ModuleContext, flags Flags) Fla
|
|||
|
||||
if library.shared() {
|
||||
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
|
||||
if ctx.toolchain().Bionic() {
|
||||
f = append(f,
|
||||
|
@ -300,7 +295,7 @@ func (library *libraryDecorator) linkerFlags(ctx ModuleContext, flags Flags) Fla
|
|||
}
|
||||
} else {
|
||||
f = append(f,
|
||||
sharedFlag,
|
||||
"-shared",
|
||||
"-Wl,-soname,"+libName+flags.Toolchain.ShlibSuffix())
|
||||
}
|
||||
|
||||
|
@ -558,8 +553,7 @@ func (library *libraryDecorator) linkShared(ctx ModuleContext,
|
|||
if library.stripper.needsStrip(ctx) {
|
||||
// b/80093681, GNU strip/objcopy bug.
|
||||
// Use llvm-{strip,objcopy} when clang lld is used.
|
||||
builderFlags.stripUseLlvmStrip =
|
||||
flags.Clang && library.baseLinker.useClangLld(ctx)
|
||||
builderFlags.stripUseLlvmStrip = library.baseLinker.useClangLld(ctx)
|
||||
strippedOutputFile := outputFile
|
||||
outputFile = android.PathForModuleOut(ctx, "unstripped", fileName)
|
||||
library.stripper.strip(ctx, outputFile, strippedOutputFile, builderFlags)
|
||||
|
|
14
cc/linker.go
14
cc/linker.go
|
@ -293,7 +293,7 @@ func (linker *baseLinker) linkerFlags(ctx ModuleContext, flags Flags) Flags {
|
|||
hod = "Device"
|
||||
}
|
||||
|
||||
if flags.Clang && linker.useClangLld(ctx) {
|
||||
if linker.useClangLld(ctx) {
|
||||
flags.LdFlags = append(flags.LdFlags, fmt.Sprintf("${config.%sGlobalLldflags}", hod))
|
||||
if !BoolDefault(linker.MoreProperties.Pack_relocations, true) {
|
||||
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")
|
||||
}
|
||||
|
||||
if flags.Clang && linker.useClangLld(ctx) {
|
||||
if linker.useClangLld(ctx) {
|
||||
flags.LdFlags = append(flags.LdFlags, toolchain.ClangLldflags())
|
||||
} else if flags.Clang {
|
||||
flags.LdFlags = append(flags.LdFlags, toolchain.ClangLdflags())
|
||||
} else {
|
||||
flags.LdFlags = append(flags.LdFlags, toolchain.Ldflags())
|
||||
flags.LdFlags = append(flags.LdFlags, toolchain.ClangLdflags())
|
||||
}
|
||||
|
||||
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")
|
||||
}
|
||||
|
||||
if flags.Clang {
|
||||
flags.LdFlags = append(flags.LdFlags, toolchain.ToolchainClangLdflags())
|
||||
} else {
|
||||
flags.LdFlags = append(flags.LdFlags, toolchain.ToolchainLdflags())
|
||||
}
|
||||
flags.LdFlags = append(flags.LdFlags, toolchain.ToolchainClangLdflags())
|
||||
|
||||
if Bool(linker.Properties.Group_static_libs) {
|
||||
flags.GroupStaticLibs = true
|
||||
|
|
|
@ -64,11 +64,7 @@ func (object *objectLinker) linkerDeps(ctx DepsContext, deps Deps) Deps {
|
|||
}
|
||||
|
||||
func (*objectLinker) linkerFlags(ctx ModuleContext, flags Flags) Flags {
|
||||
if flags.Clang {
|
||||
flags.LdFlags = append(flags.LdFlags, ctx.toolchain().ToolchainClangLdflags())
|
||||
} else {
|
||||
flags.LdFlags = append(flags.LdFlags, ctx.toolchain().ToolchainLdflags())
|
||||
}
|
||||
flags.LdFlags = append(flags.LdFlags, ctx.toolchain().ToolchainClangLdflags())
|
||||
|
||||
return flags
|
||||
}
|
||||
|
|
|
@ -164,17 +164,15 @@ func (sanitize *sanitize) begin(ctx BaseModuleContext) {
|
|||
var globalSanitizers []string
|
||||
var globalSanitizersDiag []string
|
||||
|
||||
if ctx.clang() {
|
||||
if ctx.Host() {
|
||||
if !ctx.Windows() {
|
||||
globalSanitizers = ctx.Config().SanitizeHost()
|
||||
}
|
||||
} else {
|
||||
arches := ctx.Config().SanitizeDeviceArch()
|
||||
if len(arches) == 0 || inList(ctx.Arch().ArchType.Name, arches) {
|
||||
globalSanitizers = ctx.Config().SanitizeDevice()
|
||||
globalSanitizersDiag = ctx.Config().SanitizeDeviceDiag()
|
||||
}
|
||||
if ctx.Host() {
|
||||
if !ctx.Windows() {
|
||||
globalSanitizers = ctx.Config().SanitizeHost()
|
||||
}
|
||||
} else {
|
||||
arches := ctx.Config().SanitizeDeviceArch()
|
||||
if len(arches) == 0 || inList(ctx.Arch().ArchType.Name, arches) {
|
||||
globalSanitizers = ctx.Config().SanitizeDevice()
|
||||
globalSanitizersDiag = ctx.Config().SanitizeDeviceDiag()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -369,10 +367,6 @@ func (sanitize *sanitize) flags(ctx ModuleContext, flags Flags) Flags {
|
|||
return flags
|
||||
}
|
||||
|
||||
if !ctx.clang() {
|
||||
ctx.ModuleErrorf("Use of sanitizers requires clang")
|
||||
}
|
||||
|
||||
var sanitizers []string
|
||||
var diagSanitizers []string
|
||||
|
||||
|
|
|
@ -62,11 +62,6 @@ func (tidy *tidyFeature) flags(ctx ModuleContext, flags Flags) Flags {
|
|||
return flags
|
||||
}
|
||||
|
||||
// Clang-tidy requires clang
|
||||
if !flags.Clang {
|
||||
return flags
|
||||
}
|
||||
|
||||
flags.Tidy = true
|
||||
|
||||
// Add global WITH_TIDY_FLAGS and local tidy_flags.
|
||||
|
|
|
@ -56,7 +56,6 @@ func ToolchainLibraryFactory() android.Module {
|
|||
}
|
||||
module.compiler = toolchainLibrary
|
||||
module.linker = toolchainLibrary
|
||||
module.Properties.Gcc = true
|
||||
module.stl = nil
|
||||
module.sanitize = nil
|
||||
module.installer = nil
|
||||
|
|
|
@ -78,7 +78,6 @@ func flagsToBuilderFlags(in Flags) builderFlags {
|
|||
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,
|
||||
|
|
Loading…
Reference in New Issue