Use armv7a-linux-androideabi for arm device triple.
* This is a workaround of llvm LTO bug.
* Keep using current NDK include directory path.
NDKTriple is default ClangTriple but kept as GccTriple for arm device.
Bug: 72619014
Test: make checkbuild
Change-Id: I5dc63c99760325c60bc2da98fd6a3125cef7267d
diff --git a/cc/compiler.go b/cc/compiler.go
index bbece1c..5ef20f0 100644
--- a/cc/compiler.go
+++ b/cc/compiler.go
@@ -283,7 +283,7 @@
// behavior here, and the NDK always has all the NDK headers available.
flags.SystemIncludeFlags = append(flags.SystemIncludeFlags,
"-isystem "+getCurrentIncludePath(ctx).String(),
- "-isystem "+getCurrentIncludePath(ctx).Join(ctx, tc.ClangTriple()).String())
+ "-isystem "+getCurrentIncludePath(ctx).Join(ctx, config.NDKTriple(tc)).String())
// Traditionally this has come from android/api-level.h, but with the
// libc headers unified it must be set by the build system since we
diff --git a/cc/config/arm_device.go b/cc/config/arm_device.go
index 0d3750e..66b3b38 100644
--- a/cc/config/arm_device.go
+++ b/cc/config/arm_device.go
@@ -325,6 +325,12 @@
}
func (t *toolchainArm) ClangTriple() string {
+ // http://b/72619014 work around llvm LTO bug.
+ return "armv7a-linux-androideabi"
+}
+
+func (t *toolchainArm) ndkTriple() string {
+ // Use current NDK include path, while ClangTriple is changed.
return t.GccTriple()
}
diff --git a/cc/config/toolchain.go b/cc/config/toolchain.go
index 279ceef..7961575 100644
--- a/cc/config/toolchain.go
+++ b/cc/config/toolchain.go
@@ -68,6 +68,8 @@
ClangLdflags() string
ClangInstructionSetFlags(string) (string, error)
+ ndkTriple() string
+
YasmFlags() string
WindresFlags() string
@@ -87,6 +89,19 @@
type toolchainBase struct {
}
+func (t *toolchainBase) ndkTriple() string {
+ return ""
+}
+
+func NDKTriple(toolchain Toolchain) string {
+ triple := toolchain.ndkTriple()
+ if triple == "" {
+ // Use the clang triple if there is no explicit NDK triple
+ triple = toolchain.ClangTriple()
+ }
+ return triple
+}
+
func (toolchainBase) InstructionSetFlags(s string) (string, error) {
if s != "" {
return "", fmt.Errorf("instruction_set: %s is not a supported instruction set", s)
diff --git a/cc/makevars.go b/cc/makevars.go
index 7d226d4..042af2a 100644
--- a/cc/makevars.go
+++ b/cc/makevars.go
@@ -307,7 +307,7 @@
ctx.Strict(makePrefix+"STRIP", gccCmd(toolchain, "strip"))
ctx.Strict(makePrefix+"GCC_VERSION", toolchain.GccVersion())
ctx.Strict(makePrefix+"NDK_GCC_VERSION", toolchain.GccVersion())
- ctx.Strict(makePrefix+"NDK_TRIPLE", toolchain.ClangTriple())
+ ctx.Strict(makePrefix+"NDK_TRIPLE", config.NDKTriple(toolchain))
}
if target.Os.Class == android.Host || target.Os.Class == android.HostCross {