[PATCH] D85582: [clang][Driver] Search lib32 on Linux/sparc64 with -m32
Rainer Orth via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Aug 8 00:55:40 PDT 2020
ro created this revision.
ro added reviewers: echristo, MaskRay, phosek.
ro added a project: clang.
Herald added subscribers: fedor.sergeev, jyknight.
ro requested review of this revision.
When building current master on `sparc64-unknown-linux-gnu` (Debian 5.7.10), all 32-bit tests failed to link because the matching startup files and libraries weren't found. As on Linux/x86_64 they live in `lib32` subdirectories.
This patch searches those directories as on x86 and ppc, allowing 32-bit links to succeed.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D85582
Files:
clang/lib/Driver/ToolChains/Linux.cpp
Index: clang/lib/Driver/ToolChains/Linux.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Linux.cpp
+++ clang/lib/Driver/ToolChains/Linux.cpp
@@ -185,17 +185,18 @@
return Triple.isArch32Bit() ? "lib" : "lib64";
}
- // It happens that only x86 and PPC use the 'lib32' variant of oslibdir, and
- // using that variant while targeting other architectures causes problems
- // because the libraries are laid out in shared system roots that can't cope
- // with a 'lib32' library search path being considered. So we only enable
- // them when we know we may need it.
+ // It happens that only x86, PPC, and SPARC use the 'lib32' variant of
+ // oslibdir, and using that variant while targeting other architectures
+ // causes problems because the libraries are laid out in shared system
+ // roots that can't cope with a 'lib32' library search path being
+ // considered. So we only enable them when we know we may need it.
//
// FIXME: This is a bit of a hack. We should really unify this code for
// reasoning about oslibdir spellings with the lib dir spellings in the
// GCCInstallationDetector, but that is a more significant refactoring.
if (Triple.getArch() == llvm::Triple::x86 ||
- Triple.getArch() == llvm::Triple::ppc)
+ Triple.getArch() == llvm::Triple::ppc ||
+ Triple.getArch() == llvm::Triple::sparc)
return "lib32";
if (Triple.getArch() == llvm::Triple::x86_64 &&
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85582.284124.patch
Type: text/x-patch
Size: 1489 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200808/c65c27ab/attachment.bin>
More information about the cfe-commits
mailing list