[clang] b3163c1 - [Driver] Support PowerPC SPE musl dynamic linker name ld-musl-powerpc-sf.so.1

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 28 15:40:00 PST 2021


Author: Patrick Oppenlander
Date: 2021-11-28T15:39:55-08:00
New Revision: b3163c1cdde09467382984e5879aa9701b7036d3

URL: https://github.com/llvm/llvm-project/commit/b3163c1cdde09467382984e5879aa9701b7036d3
DIFF: https://github.com/llvm/llvm-project/commit/b3163c1cdde09467382984e5879aa9701b7036d3.diff

LOG: [Driver] Support PowerPC SPE musl dynamic linker name ld-musl-powerpc-sf.so.1

Musl treats PowerPC SPE as a soft-float target (as the PowerPC SPE ABI
is soft-float compatible).

Reviewed By: jhibbits, MaskRay

Differential Revision: https://reviews.llvm.org/D105869

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/Linux.cpp
    clang/test/Driver/linux-ld.c

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
index 0224383e63a1a..198774506e5e5 100644
--- a/clang/lib/Driver/ToolChains/Linux.cpp
+++ b/clang/lib/Driver/ToolChains/Linux.cpp
@@ -421,6 +421,9 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
         (Triple.getEnvironment() == llvm::Triple::MuslEABIHF ||
          tools::arm::getARMFloatABI(*this, Args) == tools::arm::FloatABI::Hard))
       ArchName += "hf";
+    if (Arch == llvm::Triple::ppc &&
+        Triple.getSubArch() == llvm::Triple::PPCSubArch_spe)
+      ArchName = "powerpc-sf";
 
     return "/lib/ld-musl-" + ArchName + ".so.1";
   }

diff  --git a/clang/test/Driver/linux-ld.c b/clang/test/Driver/linux-ld.c
index 89fd22f7e8c60..31905e1a3d00b 100644
--- a/clang/test/Driver/linux-ld.c
+++ b/clang/test/Driver/linux-ld.c
@@ -1718,6 +1718,9 @@
 // RUN:     --target=powerpc64-pc-linux-musl \
 // RUN:   | FileCheck --check-prefix=CHECK-MUSL-PPC64 %s
 // RUN: %clang %s -### -o %t.o 2>&1 \
+// RUN:     --target=powerpcspe-pc-linux-musl \
+// RUN:   | FileCheck --check-prefix=CHECK-MUSL-PPCSPE %s
+// RUN: %clang %s -### -o %t.o 2>&1 \
 // RUN:     --target=thumb-pc-linux-musleabi \
 // RUN:   | FileCheck --check-prefix=CHECK-MUSL-ARM %s
 // RUN: %clang %s -### -o %t.o 2>&1 \
@@ -1767,6 +1770,7 @@
 // CHECK-MUSL-MIPS64EL:   "-dynamic-linker" "/lib/ld-musl-mips64el.so.1"
 // CHECK-MUSL-PPC:        "-dynamic-linker" "/lib/ld-musl-powerpc.so.1"
 // CHECK-MUSL-PPC64:      "-dynamic-linker" "/lib/ld-musl-powerpc64.so.1"
+// CHECK-MUSL-PPCSPE:     "-dynamic-linker" "/lib/ld-musl-powerpc-sf.so.1"
 // CHECK-MUSL-ARM:        "-dynamic-linker" "/lib/ld-musl-arm.so.1"
 // CHECK-MUSL-ARMHF:      "-dynamic-linker" "/lib/ld-musl-armhf.so.1"
 // CHECK-MUSL-ARMEB:      "-dynamic-linker" "/lib/ld-musl-armeb.so.1"


        


More information about the cfe-commits mailing list