r227392 - [clang] Use -android environment for all compiler-rt libs.
Dan Albert
danalbert at google.com
Wed Jan 28 15:23:37 PST 2015
Author: danalbert
Date: Wed Jan 28 17:23:36 2015
New Revision: 227392
URL: http://llvm.org/viewvc/llvm-project?rev=227392&view=rev
Log:
[clang] Use -android environment for all compiler-rt libs.
Summary:
This was already done for the sanitizers, but it needs to be done for
the profile and builtin libs as well.
Reviewers: srhines, timmurray, eugenis, samsonov
Reviewed By: samsonov
Subscribers: compnerd, cfe-commits
Differential Revision: http://reviews.llvm.org/D7187
Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/coverage-ld.c
cfe/trunk/test/Driver/linux-ld.c
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=227392&r1=227391&r2=227392&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Jan 28 17:23:36 2015
@@ -2139,8 +2139,11 @@ static SmallString<128> getCompilerRTLib
}
static SmallString<128> getCompilerRT(const ToolChain &TC, StringRef Component,
- bool Shared = false,
- const char *Env = "") {
+ bool Shared = false) {
+ const char *Env = TC.getTriple().getEnvironment() == llvm::Triple::Android
+ ? "-android"
+ : "";
+
bool IsOSWindows = TC.getTriple().isOSWindows();
StringRef Arch = getArchNameForCompilerRTLib(TC);
const char *Prefix = IsOSWindows ? "" : "lib";
@@ -2185,16 +2188,11 @@ static void addProfileRT(const ToolChain
static void addSanitizerRuntime(const ToolChain &TC, const ArgList &Args,
ArgStringList &CmdArgs, StringRef Sanitizer,
bool IsShared) {
- const char *Env = TC.getTriple().getEnvironment() == llvm::Triple::Android
- ? "-android"
- : "";
-
// Static runtimes must be forced into executable, so we wrap them in
// whole-archive.
if (!IsShared)
CmdArgs.push_back("-whole-archive");
- CmdArgs.push_back(Args.MakeArgString(getCompilerRT(TC, Sanitizer, IsShared,
- Env)));
+ CmdArgs.push_back(Args.MakeArgString(getCompilerRT(TC, Sanitizer, IsShared)));
if (!IsShared)
CmdArgs.push_back("-no-whole-archive");
}
Modified: cfe/trunk/test/Driver/coverage-ld.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/coverage-ld.c?rev=227392&r1=227391&r2=227392&view=diff
==============================================================================
--- cfe/trunk/test/Driver/coverage-ld.c (original)
+++ cfe/trunk/test/Driver/coverage-ld.c Wed Jan 28 17:23:36 2015
@@ -26,3 +26,12 @@
//
// CHECK-FREEBSD-X86-64: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
// CHECK-FREEBSD-X86-64: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}freebsd{{/|\\\\}}libclang_rt.profile-x86_64.a"
+//
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target arm-linux-androideabi --coverage \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
+// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
+// RUN: | FileCheck --check-prefix=CHECK-ANDROID-ARM %s
+//
+// CHECK-ANDROID-ARM: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
+// CHECK-ANDROID-ARM: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}linux{{/|\\\\}}libclang_rt.profile-arm-android.a"
Modified: cfe/trunk/test/Driver/linux-ld.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/linux-ld.c?rev=227392&r1=227391&r2=227392&view=diff
==============================================================================
--- cfe/trunk/test/Driver/linux-ld.c (original)
+++ cfe/trunk/test/Driver/linux-ld.c Wed Jan 28 17:23:36 2015
@@ -71,6 +71,21 @@
// CHECK-LD-RT: libclang_rt.builtins-x86_64.a" "-lgcc_s"
//
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=arm-linux-androideabi \
+// RUN: --gcc-toolchain="" \
+// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
+// RUN: --rtlib=compiler-rt \
+// RUN: | FileCheck --check-prefix=CHECK-LD-RT-ANDROID %s
+// CHECK-LD-RT-ANDROID-NOT: warning:
+// CHECK-LD-RT-ANDROID: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-LD-RT-ANDROID: "--eh-frame-hdr"
+// CHECK-LD-RT-ANDROID: "-m" "armelf_linux_eabi"
+// CHECK-LD-RT-ANDROID: "-dynamic-linker"
+// CHECK-LD-RT-ANDROID: libclang_rt.builtins-arm-android.a" "-lgcc_s"
+// CHECK-LD-RT-ANDROID: "-lc"
+// CHECK-LD-RT-ANDROID: libclang_rt.builtins-arm-android.a" "-lgcc_s"
+//
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=x86_64-unknown-linux \
// RUN: --gcc-toolchain="" \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
More information about the cfe-commits
mailing list