[PATCH] D52050: [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
Wed Dec 2 07:45:45 PST 2020


glaubitz added a comment.

I stumbled over one problem with my patch which is that when I run an x32 version of clang in a x32 environment, it will still default to "-m64" instead of "-mx32".

Thus:

  glaubitz at epyc:..llvm-project/build> ./bin/clang hello.c -o hello
  /usr/bin/ld: cannot find crtbegin.o: No such file or directory
  /usr/bin/ld: cannot find -lgcc
  /usr/bin/ld: cannot find -lgcc_s
  clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
  glaubitz at epyc:..llvm-project/build> ./bin/clang -mx32 hello.c -o hello
  glaubitz at epyc:..llvm-project/build> file hello
  hello: ELF 32-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /libx32/ld-linux-x32.so.2, for GNU/Linux 3.4.0, not stripped
  glaubitz at epyc:..llvm-project/build> file bin/clang-12
  bin/clang-12: ELF 32-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /libx32/ld-linux-x32.so.2, BuildID[sha1]=6175851930c1e79df16060c731ecda2f596ef05a, for GNU/Linux 3.4.0, not stripped
  glaubitz at epyc:..llvm-project/build>

Any idea how it could make clang default to `-mx32` if this condition is met: `getToolChain().getTriple().getEnvironment() == llvm::Triple::GNUX32`?


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