[PATCH] D52050: WIP: [Driver] Fix architecture triplets and search paths for Linux x32

Harald van Dijk via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 30 02:21:38 PDT 2021


hvdijk added a comment.

I may be missing something, but I do not understand the problem. What systems, other than Debian multi-arch, are you looking to also add support for? My own native x32 system uses `(/usr)/libx32` for x32 libraries. Debian uses `(/usr)/lib/x86_64-linux-gnux32`. I can understand if some people might use `(/usr)/lib` without any `x32` suffix, though I am not aware of anyone doing this. Where does `lib32` come from, though? What other systems are you trying to account for?

I may have some spare time soon, I can take a look and do some testing as well.



================
Comment at: clang/lib/Driver/ToolChains/Linux.cpp:217
+      return "lib32";
+    else
+      return "libx32";
----------------
x86_64-linux-gnux32 never uses `lib32`, does it? It might use `lib` (mostly theoretical), or it might use `libx32`. Leaving this unmodified, always returning `libx32` for x32, looks to me like it matches x86_64-linux-gnu, which always returns `lib64` even though some people put libraries for that in `/lib` too.


================
Comment at: clang/lib/Driver/ToolChains/Linux.cpp:90
       return "x86_64-linux-android";
-    // 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"))
-      return "x86_64-linux-gnu";
+    if (TargetEnvironment == llvm::Triple::GNUX32) {
+      if (D.getVFS().exists(SysRoot + "/lib/x86_64-linux-gnux32"))
----------------
glaubitz wrote:
> MaskRay wrote:
> > I have cleaned up the code a bit. You may need to rebase.
> Yeah, I have done that but not uploaded my latest diff yet (which doesn't work on x32, unfortunately). I will do that now.
This should have a `TargetEnvironment == llvm::Triple::GNUX32` check.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D52050/new/

https://reviews.llvm.org/D52050



More information about the cfe-commits mailing list