[PATCH] [clang] Use -android environment for all compiler-rt libs.
Dan Albert
danalbert at google.com
Mon Jan 26 12:30:45 PST 2015
Hi eugenis, srhines,
This was already done for the sanitizers, but it needs to be done for
the profile and builtin libs as well.
REPOSITORY
rL LLVM
http://reviews.llvm.org/D7187
Files:
lib/Driver/Tools.cpp
test/Driver/coverage-ld.c
test/Driver/linux-ld.c
Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -2154,7 +2154,12 @@
// and available, check for possible errors, etc.
static void addClangRT(const ToolChain &TC, const ArgList &Args,
ArgStringList &CmdArgs) {
- CmdArgs.push_back(Args.MakeArgString(getCompilerRT(TC, "builtins")));
+ const char *Env = TC.getTriple().getEnvironment() == llvm::Triple::Android
+ ? "-android"
+ : "";
+ CmdArgs.push_back(Args.MakeArgString(getCompilerRT(TC, "builtins",
+ /* Shared = */ false,
+ Env)));
if (!TC.getTriple().isOSWindows()) {
// FIXME: why do we link against gcc when we are using compiler-rt?
@@ -2174,7 +2179,12 @@
Args.hasArg(options::OPT_coverage)))
return;
- CmdArgs.push_back(Args.MakeArgString(getCompilerRT(TC, "profile")));
+ const char *Env = TC.getTriple().getEnvironment() == llvm::Triple::Android
+ ? "-android"
+ : "";
+
+ CmdArgs.push_back(Args.MakeArgString(getCompilerRT(TC, "profile",
+ /* Shared = */ false, Env)));
}
static void addSanitizerRuntime(const ToolChain &TC, const ArgList &Args,
Index: test/Driver/coverage-ld.c
===================================================================
--- test/Driver/coverage-ld.c
+++ test/Driver/coverage-ld.c
@@ -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"
Index: test/Driver/linux-ld.c
===================================================================
--- test/Driver/linux-ld.c
+++ test/Driver/linux-ld.c
@@ -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 \
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7187.18776.patch
Type: text/x-patch
Size: 3414 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150126/f204818e/attachment.bin>
More information about the cfe-commits
mailing list