diff options
author | Dan Willemsen <dwillemsen@google.com> | 2015-10-20 15:21:33 -0700 |
---|---|---|
committer | Dan Willemsen <dwillemsen@google.com> | 2015-10-20 16:44:55 -0700 |
commit | e65404514cfae556afb0dfab91f1d114fbb3383b (patch) | |
tree | d4016dca73a4c479a2837d88735f6d7b03be9ccd /cc | |
parent | dd0e2c338f3b65458e130178a0f6ba270ce40fb4 (diff) | |
download | build_soong-e65404514cfae556afb0dfab91f1d114fbb3383b.tar.gz build_soong-e65404514cfae556afb0dfab91f1d114fbb3383b.tar.bz2 build_soong-e65404514cfae556afb0dfab91f1d114fbb3383b.zip |
Updates from make
Contains equivalent changes for:
561b4c1 Set mcpu targets based on cpu variant.
6a66a88 Stop encoding absolute paths in symbols
63e3b02 Enable color output from gcc and clang
eb3e3fa Use exported includes for libc++.
3a0a891 Link libgtest_main before libgtest
Change-Id: I45a06c02e9af1d40f0c52f1e6a20d6cd382a27fb
Diffstat (limited to 'cc')
-rw-r--r-- | cc/arm_device.go | 28 | ||||
-rw-r--r-- | cc/builder.go | 14 | ||||
-rw-r--r-- | cc/cc.go | 5 | ||||
-rw-r--r-- | cc/clang.go | 17 |
4 files changed, 44 insertions, 20 deletions
diff --git a/cc/arm_device.go b/cc/arm_device.go index 15f09135..ce8a1cb8 100644 --- a/cc/arm_device.go +++ b/cc/arm_device.go @@ -199,12 +199,14 @@ var ( } armCpuVariantCflagsVar = map[string]string{ - "": "", - "cortex-a7": "${armCortexA7Cflags}", - "cortex-a8": "${armCortexA8Cflags}", - "cortex-a15": "${armCortexA15Cflags}", - "krait": "${armCortexA15Cflags}", - "denver": "${armCortexA15Cflags}", + "": "", + "cortex-a7": "${armCortexA7Cflags}", + "cortex-a8": "${armCortexA8Cflags}", + "cortex-a15": "${armCortexA15Cflags}", + "cortex-a53": "${armCortexA7Cflags}", + "cortex-a53.a57": "${armCortexA7Cflags}", + "krait": "${armCortexA15Cflags}", + "denver": "${armCortexA15Cflags}", } armClangArchVariantCflagsVar = map[string]string{ @@ -214,12 +216,14 @@ var ( } armClangCpuVariantCflagsVar = map[string]string{ - "": "", - "cortex-a7": "${armClangCortexA7Cflags}", - "cortex-a8": "${armClangCortexA8Cflags}", - "cortex-a15": "${armClangCortexA15Cflags}", - "krait": "${armClangKraitCflags}", - "denver": "${armClangCortexA15Cflags}", + "": "", + "cortex-a7": "${armClangCortexA7Cflags}", + "cortex-a8": "${armClangCortexA8Cflags}", + "cortex-a15": "${armClangCortexA15Cflags}", + "cortex-a53": "${armClangCortexA7Cflags}", + "cortex-a53.a57": "${armClangCortexA7Cflags}", + "krait": "${armClangKraitCflags}", + "denver": "${armClangCortexA15Cflags}", } ) diff --git a/cc/builder.go b/cc/builder.go index 9c9bddd8..f2170823 100644 --- a/cc/builder.go +++ b/cc/builder.go @@ -44,10 +44,10 @@ var ( blueprint.RuleParams{ Depfile: "${out}.d", Deps: blueprint.DepsGCC, - Command: "$ccCmd -c $cFlags -MD -MF ${out}.d -o $out $in", + Command: "$relPwd $ccCmd -c $cFlags -MD -MF ${out}.d -o $out $in", Description: "cc $out", }, - "ccCmd", "cFlags") + "relPwd", "ccCmd", "cFlags") ld = pctx.StaticRule("ld", blueprint.RuleParams{ @@ -128,6 +128,15 @@ func TransformSourceToObj(ctx common.AndroidModuleContext, subdir string, srcFil srcRoot := ctx.AConfig().SrcDir() intermediatesRoot := ctx.AConfig().IntermediatesDir() + // We run gcc/clang with PWD=/proc/self/cwd to remove $TOP from the + // debug output. That way two builds in two different directories will + // create the same output. + relPwd := "PWD=/proc/self/cwd" + if ctx.Darwin() { + // /proc doesn't exist on Darwin + relPwd = "" + } + objFiles = make([]string, len(srcFiles)) objDir := common.ModuleObjDir(ctx) if subdir != "" { @@ -200,6 +209,7 @@ func TransformSourceToObj(ctx common.AndroidModuleContext, subdir string, srcFil Args: map[string]string{ "cFlags": moduleCflags, "ccCmd": ccCmd, + "relPwd": relPwd, }, }) } @@ -79,6 +79,8 @@ var ( "-Wno-unused", "-Winit-self", "-Wpointer-arith", + "-fdiagnostics-color", + "-fdebug-prefix-map=/proc/self/cwd=", // COMMON_RELEASE_CFLAGS "-DNDEBUG", @@ -838,7 +840,6 @@ func (c *CCLinked) flags(ctx common.AndroidModuleContext, flags CCFlags) CCFlags switch stl { case "libc++", "libc++_static": flags.CFlags = append(flags.CFlags, "-D_USING_LIBCXX") - flags.CFlags = append(flags.CFlags, "-I${SrcDir}/external/libcxx/include") if ctx.Host() { flags.CppFlags = append(flags.CppFlags, "-nostdinc++") flags.LdFlags = append(flags.LdFlags, "-nodefaultlibs") @@ -1551,7 +1552,7 @@ func (c *CCTest) flags(ctx common.AndroidModuleContext, flags CCFlags) CCFlags { } func (c *CCTest) depNames(ctx common.AndroidBaseContext, depNames CCDeps) CCDeps { - depNames.StaticLibs = append(depNames.StaticLibs, "libgtest", "libgtest_main") + depNames.StaticLibs = append(depNames.StaticLibs, "libgtest_main", "libgtest") depNames = c.CCBinary.depNames(ctx, depNames) return depNames } diff --git a/cc/clang.go b/cc/clang.go index 92061f3c..67622474 100644 --- a/cc/clang.go +++ b/cc/clang.go @@ -6,7 +6,7 @@ import ( ) // Cflags that should be filtered out when compiling with clang -var clangUnknownCflags = []string{ +var clangUnknownCflags = sorted([]string{ "-finline-functions", "-finline-limit=64", "-fno-canonical-system-headers", @@ -30,6 +30,8 @@ var clangUnknownCflags = []string{ "-Wno-unused-local-typedefs", "-Wunused-but-set-parameter", "-Wunused-but-set-variable", + "-fdiagnostics-color", + "-fdebug-prefix-map=/proc/self/cwd=", // arm + arm64 + mips + mips64 "-fgcse-after-reload", @@ -61,11 +63,9 @@ var clangUnknownCflags = []string{ "-fno-inline-functions-called-once", "-mfpmath=sse", "-mbionic", -} +}) func init() { - sort.Strings(clangUnknownCflags) - pctx.StaticVariable("clangExtraCflags", strings.Join([]string{ "-D__compiler_offsetof=__builtin_offsetof", @@ -88,6 +88,10 @@ func init() { // 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", }, " ")) pctx.StaticVariable("clangExtraConlyflags", strings.Join([]string{ @@ -120,3 +124,8 @@ func inListSorted(s string, list []string) bool { } return false } + +func sorted(list []string) []string { + sort.Strings(list) + return list +} |