[PATCH] D22904: Fix two bugs for musl-libc on ARM
Lei Zhang via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 28 19:25:37 PDT 2016
zlei updated this revision to Diff 66074.
zlei added a comment.
Restructure the code and add a few tests.
https://reviews.llvm.org/D22904
Files:
lib/Driver/ToolChains.cpp
test/Driver/linux-ld.c
Index: test/Driver/linux-ld.c
===================================================================
--- test/Driver/linux-ld.c
+++ test/Driver/linux-ld.c
@@ -1613,24 +1613,36 @@
// RUN: --target=thumb-pc-linux-musleabihf \
// RUN: | FileCheck --check-prefix=CHECK-MUSL-ARMHF %s
// RUN: %clang %s -### -o %t.o 2>&1 \
+// RUN: --target=thumbv7-pc-linux-musleabi -mhard-float \
+// RUN: | FileCheck --check-prefix=CHECK-MUSL-ARMHF %s
+// RUN: %clang %s -### -o %t.o 2>&1 \
// RUN: --target=thumbeb-pc-linux-musleabi \
// RUN: | FileCheck --check-prefix=CHECK-MUSL-ARMEB %s
// RUN: %clang %s -### -o %t.o 2>&1 \
// RUN: --target=thumbeb-pc-linux-musleabihf \
// RUN: | FileCheck --check-prefix=CHECK-MUSL-ARMEBHF %s
// RUN: %clang %s -### -o %t.o 2>&1 \
+// RUN: --target=thumbv7eb-pc-linux-musleabi -mhard-float \
+// RUN: | FileCheck --check-prefix=CHECK-MUSL-ARMEBHF %s
+// RUN: %clang %s -### -o %t.o 2>&1 \
// RUN: --target=arm-pc-linux-musleabi \
// RUN: | FileCheck --check-prefix=CHECK-MUSL-ARM %s
// RUN: %clang %s -### -o %t.o 2>&1 \
// RUN: --target=arm-pc-linux-musleabihf \
// RUN: | FileCheck --check-prefix=CHECK-MUSL-ARMHF %s
// RUN: %clang %s -### -o %t.o 2>&1 \
+// RUN: --target=armv7-pc-linux-musleabi -mhard-float \
+// RUN: | FileCheck --check-prefix=CHECK-MUSL-ARMHF %s
+// RUN: %clang %s -### -o %t.o 2>&1 \
// RUN: --target=armeb-pc-linux-musleabi \
// RUN: | FileCheck --check-prefix=CHECK-MUSL-ARMEB %s
// RUN: %clang %s -### -o %t.o 2>&1 \
// RUN: --target=armeb-pc-linux-musleabihf \
// RUN: | FileCheck --check-prefix=CHECK-MUSL-ARMEBHF %s
// RUN: %clang %s -### -o %t.o 2>&1 \
+// RUN: --target=armv7eb-pc-linux-musleabi -mhard-float \
+// RUN: | FileCheck --check-prefix=CHECK-MUSL-ARMEBHF %s
+// RUN: %clang %s -### -o %t.o 2>&1 \
// RUN: --target=aarch64-pc-linux-musleabi \
// RUN: | FileCheck --check-prefix=CHECK-MUSL-AARCH64 %s
// RUN: %clang %s -### -o %t.o 2>&1 \
Index: lib/Driver/ToolChains.cpp
===================================================================
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -4264,19 +4264,28 @@
if (Triple.isAndroid())
return Triple.isArch64Bit() ? "/system/bin/linker64" : "/system/bin/linker";
- else if (Triple.isMusl()) {
+
+ if (Triple.isMusl()) {
std::string ArchName;
+ bool IsArm = false;
+
switch (Arch) {
+ case llvm::Triple::arm:
case llvm::Triple::thumb:
ArchName = "arm";
+ IsArm = true;
break;
+ case llvm::Triple::armeb:
case llvm::Triple::thumbeb:
ArchName = "armeb";
+ IsArm = true;
break;
default:
ArchName = Triple.getArchName().str();
}
- if (Triple.getEnvironment() == llvm::Triple::MuslEABIHF)
+ if (IsArm &&
+ (Triple.getEnvironment() == llvm::Triple::MuslEABIHF ||
+ tools::arm::getARMFloatABI(*this, Args) == tools::arm::FloatABI::Hard))
ArchName += "hf";
return "/lib/ld-musl-" + ArchName + ".so.1";
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22904.66074.patch
Type: text/x-patch
Size: 3041 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160729/56e05c3e/attachment.bin>
More information about the cfe-commits
mailing list