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@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@epyc:..llvm-project/build> ./bin/clang -mx32 hello.c -o hello glaubitz@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@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@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 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits