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

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 31 13:58:00 PDT 2021


MaskRay added a comment.

Mostly looks good.

> `clang/test/Driver/Inputs/basic_cross_linux_tree/usr/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/x32/crtbegin.o`

Worth bumping the version. 4.6 is quite old and as a host compiler llvm-project has stopped supporting it. The distributions having 4.6 are all end-of-life.
Using a new version (matching your reality) can give impression that the user who contributed the original code may still need it for a while (say 5 years).

> Currently, support for the x32 ABI is handled as an extension to the x86_64 target only.

As a multilib to the x86_64 target.

> However, Debian has a full self-hosting x32 port which is treated as a separate architecture with its own architecture triplets as well as search paths.

I still don't quite understand this. Shouldn't a native x32 port use `x86_64-unknown-linux-gnux32`? Why does it use the multilib style `/x32` suffix?



================
Comment at: clang/lib/Driver/ToolChains/Gnu.cpp:2110
+  static const char *const X32Triples[] = {"x86_64-linux-gnux32",
+                                           "x86_64-unknown-linux-gnux32",
+                                           "x86_64-pc-linux-gnux32"};
----------------
Personally I'd defer adding a triplet until it is proven to be used on a system.

This is not free, for every x86-64 user (even if they don't use multilib or x32), their clang driver runs need to stat the directory under lib/gcc or lib/gcc-cross.


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