[PATCH] D22904: Fix two bugs for musl-libc on ARM
Lei Zhang via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 28 01:19:14 PDT 2016
zlei created this revision.
zlei added reviewers: cfe-commits, rafael.
Herald added subscribers: samparker, srhines, danalbert, tberghammer, rengolin, aemerson.
Bug #1: triples like `armv7-pc-linux-musl` uses wrong linker name `ld-musl-armv7.so.1`; the right name should be `ld-musl-arm.so.1`, disregarding the subarch field.
Bug #2: when compiler option `-mhard-float` is used, we should use the "hardfloat" linker, no matter whether the triple itself mentions "hardfloat".
https://reviews.llvm.org/D22904
Files:
lib/Driver/ToolChains.cpp
Index: lib/Driver/ToolChains.cpp
===================================================================
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -4262,21 +4262,29 @@
const enum Distro Distro = DetectDistro(getDriver(), Arch);
- if (Triple.isAndroid())
+ if (Triple.isAndroid()) {
return Triple.isArch64Bit() ? "/system/bin/linker64" : "/system/bin/linker";
- else if (Triple.isMusl()) {
+ } else 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.65881.patch
Type: text/x-patch
Size: 1146 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160728/7b5b62b1/attachment-0001.bin>
More information about the cfe-commits
mailing list