aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2016-01-14 07:03:10 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2016-01-14 07:03:10 +0000
commit768e5b49e159c0f388cebb56bf7286f669f61c1c (patch)
tree388a8e60111300d38fd6899568b2a3b9cfaeb643
parent59b381a405dbc1e92a7a70482ccb978b7efdf979 (diff)
parent322acafe9ebae1b41ad3242f97f60c96af3f21ae (diff)
downloadbuild_soong-768e5b49e159c0f388cebb56bf7286f669f61c1c.tar.gz
build_soong-768e5b49e159c0f388cebb56bf7286f669f61c1c.tar.bz2
build_soong-768e5b49e159c0f388cebb56bf7286f669f61c1c.zip
Merge changes I92ddea0b,Ice8474ae,If63cc6ce,I1d6f1388,Ic3da07c8, ...
* changes: Add Mega_device configuration option Toolchain modules use GCC Apply ToolchainLdflags to clang builds Add Clang Asflags for mips Remove libgcov for now to fix X86 devices Change clang extra flags behavior
-rw-r--r--cc/cc.go24
-rw-r--r--cc/clang.go10
-rw-r--r--cc/mips_device.go4
-rw-r--r--cc/toolchain.go5
-rw-r--r--common/arch.go59
-rw-r--r--common/config.go12
-rw-r--r--common/module.go22
7 files changed, 111 insertions, 25 deletions
diff --git a/cc/cc.go b/cc/cc.go
index ce3a464c..6cff27f8 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -115,13 +115,13 @@ func init() {
pctx.StaticVariable("commonGlobalCppflags", strings.Join(commonGlobalCppflags, " "))
pctx.StaticVariable("commonClangGlobalCflags",
- strings.Join(clangFilterUnknownCflags(commonGlobalCflags), " "))
+ strings.Join(append(clangFilterUnknownCflags(commonGlobalCflags), "${clangExtraCflags}"), " "))
pctx.StaticVariable("deviceClangGlobalCflags",
- strings.Join(clangFilterUnknownCflags(deviceGlobalCflags), " "))
+ strings.Join(append(clangFilterUnknownCflags(deviceGlobalCflags), "${clangExtraTargetCflags}"), " "))
pctx.StaticVariable("hostClangGlobalCflags",
strings.Join(clangFilterUnknownCflags(hostGlobalCflags), " "))
pctx.StaticVariable("commonClangGlobalCppflags",
- strings.Join(clangFilterUnknownCflags(commonGlobalCppflags), " "))
+ strings.Join(append(clangFilterUnknownCflags(commonGlobalCppflags), "${clangExtraCppflags}"), " "))
// Everything in this list is a crime against abstraction and dependency tracking.
// Do not add anything to this list.
@@ -550,12 +550,6 @@ func (c *CCBase) collectFlags(ctx common.AndroidModuleContext, toolchain Toolcha
flags.ConlyFlags = clangFilterUnknownCflags(flags.ConlyFlags)
flags.LdFlags = clangFilterUnknownCflags(flags.LdFlags)
- flags.CFlags = append(flags.CFlags, "${clangExtraCflags}")
- flags.ConlyFlags = append(flags.ConlyFlags, "${clangExtraConlyflags}")
- if ctx.Device() {
- flags.CFlags = append(flags.CFlags, "${clangExtraTargetCflags}")
- }
-
target := "-target " + toolchain.ClangTriple()
gccPrefix := "-B" + filepath.Join(toolchain.GccRoot(), toolchain.GccTriple(), "bin")
@@ -572,11 +566,14 @@ func (c *CCBase) collectFlags(ctx common.AndroidModuleContext, toolchain Toolcha
flags.GlobalFlags = append(flags.GlobalFlags, instructionSetFlags)
if flags.Clang {
+ flags.AsFlags = append(flags.AsFlags, toolchain.ClangAsflags())
flags.CppFlags = append(flags.CppFlags, "${commonClangGlobalCppflags}")
flags.GlobalFlags = append(flags.GlobalFlags,
toolchain.ClangCflags(),
"${commonClangGlobalCflags}",
fmt.Sprintf("${%sClangGlobalCflags}", ctx.HostOrDevice()))
+
+ flags.ConlyFlags = append(flags.ConlyFlags, "${clangExtraConlyflags}")
} else {
flags.CppFlags = append(flags.CppFlags, "${commonGlobalCppflags}")
flags.GlobalFlags = append(flags.GlobalFlags,
@@ -616,8 +613,8 @@ func (c *CCBase) collectFlags(ctx common.AndroidModuleContext, toolchain Toolcha
flags.GlobalFlags = append(flags.GlobalFlags, toolchain.ToolchainClangCflags())
} else {
flags.GlobalFlags = append(flags.GlobalFlags, toolchain.ToolchainCflags())
- flags.LdFlags = append(flags.LdFlags, toolchain.ToolchainLdflags())
}
+ flags.LdFlags = append(flags.LdFlags, toolchain.ToolchainLdflags())
flags = c.ccModuleType().flags(ctx, flags)
@@ -1008,7 +1005,7 @@ func (c *CCLinked) depNames(ctx common.AndroidBaseContext, depNames CCDeps) CCDe
if ctx.Device() {
// libgcc and libatomic have to be last on the command line
- depNames.LateStaticLibs = append(depNames.LateStaticLibs, "libgcov", "libatomic")
+ depNames.LateStaticLibs = append(depNames.LateStaticLibs, "libatomic")
if !Bool(c.Properties.No_libgcc) {
depNames.LateStaticLibs = append(depNames.LateStaticLibs, "libgcc")
}
@@ -1885,6 +1882,7 @@ func ToolchainLibraryFactory() (blueprint.Module, []interface{}) {
module := &toolchainLibrary{}
module.LibraryProperties.BuildStatic = true
+ module.Properties.Clang = proptools.BoolPtr(false)
return newCCBase(&module.CCBase, module, common.DeviceSupported, common.MultilibBoth,
&module.LibraryProperties)
@@ -1896,6 +1894,10 @@ func (c *toolchainLibrary) compileModule(ctx common.AndroidModuleContext,
libName := ctx.ModuleName() + staticLibraryExtension
outputFile := common.PathForModuleOut(ctx, libName)
+ if flags.Clang {
+ ctx.ModuleErrorf("toolchain_library must use GCC, not Clang")
+ }
+
CopyGccLib(ctx, libName, ccFlagsToBuilderFlags(flags), outputFile)
c.out = outputFile
diff --git a/cc/clang.go b/cc/clang.go
index 6a01010d..5e0302a5 100644
--- a/cc/clang.go
+++ b/cc/clang.go
@@ -84,10 +84,6 @@ func init() {
// See http://petereisentraut.blogspot.com/2011/05/ccache-and-clang.html.
"-Wno-unused-command-line-argument",
- // Disable -Winconsistent-missing-override until we can clean up the existing
- // codebase for it.
- "-Wno-inconsistent-missing-override",
-
// Force clang to always output color diagnostics. Ninja will strip the ANSI
// color codes if it is not running in a terminal.
"-fcolor-diagnostics",
@@ -97,6 +93,12 @@ func init() {
"-std=gnu99",
}, " "))
+ pctx.StaticVariable("clangExtraCppflags", strings.Join([]string{
+ // Disable -Winconsistent-missing-override until we can clean up the existing
+ // codebase for it.
+ "-Wno-inconsistent-missing-override",
+ }, " "))
+
pctx.StaticVariable("clangExtraTargetCflags", strings.Join([]string{
"-nostdlibinc",
}, " "))
diff --git a/cc/mips_device.go b/cc/mips_device.go
index d88c9060..cd92eab1 100644
--- a/cc/mips_device.go
+++ b/cc/mips_device.go
@@ -211,6 +211,10 @@ func (t *toolchainMips) ToolchainClangCflags() string {
return t.toolchainClangCflags
}
+func (t *toolchainMips) ClangAsflags() string {
+ return "-fPIC"
+}
+
func (t *toolchainMips) ClangCflags() string {
return t.clangCflags
}
diff --git a/cc/toolchain.go b/cc/toolchain.go
index ac511143..9f6ad2ea 100644
--- a/cc/toolchain.go
+++ b/cc/toolchain.go
@@ -60,6 +60,7 @@ type Toolchain interface {
ClangSupported() bool
ClangTriple() string
ToolchainClangCflags() string
+ ClangAsflags() string
ClangCflags() string
ClangCppflags() string
ClangLdflags() string
@@ -112,6 +113,10 @@ func (toolchainBase) ExecutableSuffix() string {
return ""
}
+func (toolchainBase) ClangAsflags() string {
+ return ""
+}
+
type toolchain64Bit struct {
toolchainBase
}
diff --git a/common/arch.go b/common/arch.go
index 1d7d0de7..70ac85c2 100644
--- a/common/arch.go
+++ b/common/arch.go
@@ -901,6 +901,65 @@ func decodeArchProductVariables(variables productVariables) (map[HostType][]Arch
return hostTypeArches, deviceArches, nil
}
+func decodeMegaDevice() ([]Arch, error) {
+ archSettings := []struct {
+ arch string
+ archVariant string
+ cpuVariant string
+ abi []string
+ }{
+ {"arm", "armv7-a-neon", "cortex-a7", []string{"armeabi-v7a"}},
+ {"arm", "armv7-a-neon", "cortex-a8", []string{"armeabi-v7a"}},
+ // gtest_all_test.cc fails to build:
+ // error in backend: Unsupported library call operation!
+ //{"arm", "armv7-a-neon", "cortex-a9", []string{"armeabi-v7a"}},
+ {"arm", "armv7-a-neon", "cortex-a15", []string{"armeabi-v7a"}},
+ {"arm", "armv7-a-neon", "cortex-a53", []string{"armeabi-v7a"}},
+ {"arm", "armv7-a-neon", "cortex-a53.a57", []string{"armeabi-v7a"}},
+ {"arm", "armv7-a-neon", "denver", []string{"armeabi-v7a"}},
+ {"arm", "armv7-a-neon", "krait", []string{"armeabi-v7a"}},
+ {"arm64", "", "cortex-a53", []string{"arm64-v8a"}},
+ {"arm64", "", "denver64", []string{"arm64-v8a"}},
+ // mips is missing __popcountsi2 from libc
+ //{"mips", "mips32-fp", "", []string{"mips"}},
+ //{"mips", "mips32r2-fp", "", []string{"mips"}},
+ //{"mips", "mips32r2-fp-xburst", "", []string{"mips"}},
+ //{"mips", "mips32r6", "", []string{"mips32r6"}},
+ // mips32r2dsp[r2]-fp also fails in the assembler for dmisc.c in libc:
+ // Error: invalid operands `mtlo $ac0,$8'
+ // Error: invalid operands `mthi $ac0,$3'
+ //{"mips", "mips32r2dsp-fp", "", []string{"mips"}},
+ //{"mips", "mips32r2dspr2-fp", "", []string{"mips"}},
+ // mips64r2 is mismatching 64r2 and 64r6 libraries during linking to libgcc
+ //{"mips64", "mips64r2", "", []string{"mips64"}},
+ {"mips64", "mips64r6", "", []string{"mips64"}},
+ {"x86", "", "", []string{"x86"}},
+ {"x86", "atom", "", []string{"x86"}},
+ {"x86", "haswell", "", []string{"x86"}},
+ {"x86", "ivybridge", "", []string{"x86"}},
+ {"x86", "sandybridge", "", []string{"x86"}},
+ {"x86", "silvermont", "", []string{"x86"}},
+ {"x86_64", "", "", []string{"x86_64"}},
+ {"x86_64", "haswell", "", []string{"x86_64"}},
+ {"x86_64", "ivybridge", "", []string{"x86_64"}},
+ {"x86_64", "sandybridge", "", []string{"x86_64"}},
+ {"x86_64", "silvermont", "", []string{"x86_64"}},
+ }
+
+ var ret []Arch
+
+ for _, config := range archSettings {
+ arch, err := decodeArch(config.arch, &config.archVariant,
+ &config.cpuVariant, &config.abi)
+ if err != nil {
+ return nil, err
+ }
+ ret = append(ret, arch)
+ }
+
+ return ret, nil
+}
+
// Convert a set of strings from product variables into a single Arch struct
func decodeArch(arch string, archVariant, cpuVariant *string, abi *[]string) (Arch, error) {
stringPtr := func(p *string) string {
diff --git a/common/config.go b/common/config.go
index 74e06603..a4a20393 100644
--- a/common/config.go
+++ b/common/config.go
@@ -35,6 +35,7 @@ const productVariablesFileName = "soong.variables"
// A FileConfigurableOptions contains options which can be configured by the
// config file. These will be included in the config struct.
type FileConfigurableOptions struct {
+ Mega_device *bool `json:",omitempty"`
}
func (f *FileConfigurableOptions) SetDefaultConfig() {
@@ -179,6 +180,13 @@ func NewConfig(srcDir, buildDir string) (Config, error) {
return Config{}, err
}
+ if Bool(config.Mega_device) {
+ deviceArches, err = decodeMegaDevice()
+ if err != nil {
+ return Config{}, err
+ }
+ }
+
config.HostArches = hostArches
config.DeviceArches = deviceArches
@@ -295,3 +303,7 @@ func (c *config) DefaultAppCertificate(ctx PathContext) SourcePath {
func (c *config) AllowMissingDependencies() bool {
return Bool(c.ProductVariables.Unbundled_build)
}
+
+func (c *config) SkipInstall() bool {
+ return c.EmbeddedInMake() || Bool(c.Mega_device)
+}
diff --git a/common/module.go b/common/module.go
index 0f6ecb5a..988104ff 100644
--- a/common/module.go
+++ b/common/module.go
@@ -519,17 +519,19 @@ func (a *androidModuleContext) InstallFileName(installPath OutputPath, name stri
fullInstallPath := installPath.Join(a, name)
- deps = append(deps, a.installDeps...)
-
- a.ModuleBuild(pctx, ModuleBuildParams{
- Rule: Cp,
- Output: fullInstallPath,
- Input: srcPath,
- OrderOnly: Paths(deps),
- Default: !a.AConfig().EmbeddedInMake(),
- })
+ if !a.AConfig().SkipInstall() {
+ deps = append(deps, a.installDeps...)
+
+ a.ModuleBuild(pctx, ModuleBuildParams{
+ Rule: Cp,
+ Output: fullInstallPath,
+ Input: srcPath,
+ OrderOnly: Paths(deps),
+ Default: true,
+ })
- a.installFiles = append(a.installFiles, fullInstallPath)
+ a.installFiles = append(a.installFiles, fullInstallPath)
+ }
a.checkbuildFiles = append(a.checkbuildFiles, srcPath)
return fullInstallPath
}