[PATCH] D52050: WIP: [Driver] Fix architecture triplets and search paths for Linux x32
John Paul Adrian Glaubitz via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 30 01:32:53 PDT 2021
glaubitz updated this revision to Diff 334071.
glaubitz retitled this revision from "[Driver] Fix architecture triplets and search paths for Linux x32" to "WIP: [Driver] Fix architecture triplets and search paths for Linux x32".
glaubitz added a comment.
Updated version which unfortunately still fails.
One of the problems is that I don't know how to detect a native x32 system
in getOSLibDir() in clang/lib/Driver/ToolChains/Linux.cpp.
On a native x32 system, libraries are not in /libx32.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D52050/new/
https://reviews.llvm.org/D52050
Files:
clang/lib/Driver/ToolChains/Gnu.cpp
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
@@ -87,6 +87,8 @@
case llvm::Triple::x86_64:
if (IsAndroid)
return "x86_64-linux-android";
+ if (D.getVFS().exists(SysRoot + "/lib/x86_64-linux-gnux32"))
+ return "x86_64-linux-gnux32";
// We don't want this for x32, otherwise it will match x86_64 libs
if (TargetEnvironment != llvm::Triple::GNUX32 &&
D.getVFS().exists(SysRoot + "/lib/x86_64-linux-gnu"))
@@ -210,7 +212,10 @@
if (Triple.getArch() == llvm::Triple::x86_64 &&
Triple.getEnvironment() == llvm::Triple::GNUX32)
- return "libx32";
+ if (getDriver().getVFS().exists(SysRoot + "/lib/x86_64-linux-gnux32"))
+ return "lib32";
+ else
+ return "libx32";
if (Triple.getArch() == llvm::Triple::riscv32)
return "lib32";
Index: clang/lib/Driver/ToolChains/Gnu.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2105,8 +2105,10 @@
"x86_64-redhat-linux", "x86_64-suse-linux",
"x86_64-manbo-linux-gnu", "x86_64-linux-gnu",
"x86_64-slackware-linux", "x86_64-unknown-linux",
- "x86_64-amazon-linux", "x86_64-linux-android"};
- static const char *const X32LibDirs[] = {"/libx32"};
+ "x86_64-amazon-linux", "x86_64-linux-android",
+ "x86_64-linux-gnux32", "x86_64-unknown-linux-gnux32",
+ "x86_64-pc-linux-gnux32"};
+ static const char *const X32LibDirs[] = {"/libx32", "/lib"};
static const char *const X86LibDirs[] = {"/lib32", "/lib"};
static const char *const X86Triples[] = {
"i686-linux-gnu", "i686-pc-linux-gnu", "i386-redhat-linux6E",
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52050.334071.patch
Type: text/x-patch
Size: 1849 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210330/401e87fb/attachment.bin>
More information about the cfe-commits
mailing list