With foo.c int main(){ return 0; } $ /clang foo.c -v /usr/bin/ld: cannot find crtn.o: No such file or directory With clang-7 on a Linux mips64el: "/usr/bin/ld" --build-id --eh-frame-hdr -m elf64ltsmip -dynamic-linker /lib64/ld.so.1 -o a.out /usr/bin/../lib/gcc/mips64el-linux-gnuabi64/8/../../../mips64el-linux-gnuabi64/crt1.o /usr/bin/../lib/gcc/mips64el-linux-gnuabi64/8/../../../mips64el-linux-gnuabi64/crti.o /usr/bin/../lib/gcc/mips64el-linux-gnuabi64/8/crtbegin.o -L/usr/bin/../lib/gcc/mips64el-linux-gnuabi64/8 -L/usr/bin/../lib/gcc/mips64el-linux-gnuabi64/8/../../../mips64el-linux-gnuabi64 -L/lib/mips64el-linux-gnuabi64 -L/lib/../lib64 -L/usr/lib/mips64el-linux-gnuabi64 -L/usr/bin/../lib/gcc/mips64el-linux-gnuabi64/8 -L/usr/bin/../lib/gcc/mips64el-linux-gnuabi64/8/../../.. -L/usr/lib/llvm-7/bin/../lib -L/lib -L/usr/lib /tmp/foo-13e8d5.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/bin/../lib/gcc/mips64el-linux-gnuabi64/8/crtend.o /usr/bin/../lib/gcc/mips64el-linux-gnuabi64/8/../../../mips64el-linux-gnuabi64/crtn.o with clang-8: "/usr/bin/ld" --build-id --eh-frame-hdr -m elf64ltsmip -dynamic-linker /lib64/ld.so.1 -o a.out crt1.o crti.o /usr/lib/gcc/mips64el-linux-gnuabi64/8/crtbegin.o -L/usr/lib/gcc/mips64el-linux-gnuabi64/8 -L/lib/../lib64 -L/usr/lib/gcc/mips64el-linux-gnuabi64/8 -L/usr/lib/gcc/mips64el-linux-gnuabi64/8/../../.. -L/home/sylvestre/llvm-toolchain-8-8~+rc5/build-llvm/bin/../lib -L/lib -L/usr/lib /tmp/foo-05b53c.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/mips64el-linux-gnuabi64/8/crtend.o crtn.o
I had to write this patch to fix something else before: https://reviews.llvm.org/D59702
1. How do you build the clang? What command line options do you use? 2. Could you run both clang 7 and clang 8 with the `-v` command line flag and provide the output?
And one more question - what OS (name/version) do you use?
This is on Debian unstable. Full log: https://buildd.debian.org/status/fetch.php?pkg=llvm-toolchain-8&arch=mips64el&ver=1%3A8-1&stamp=1553148429&raw=0 Building with a stage2 mode with args: $CMAKE_BIN ../ \ -DCMAKE_INSTALL_PREFIX=/usr/lib/llvm-8 \ -DCMAKE_VERBOSE_MAKEFILE=ON \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-O2 -DNDEBUG -g1" \ -DBOOTSTRAP_CMAKE_CXX_FLAGS=' -fPIC -Wno-unused-command-line-argument -Wno-unknown-warning-option ' \ -DBOOTSTRAP_CMAKE_C_FLAGS=' -fPIC -Wno-unused-command-line-argument -Wno-unknown-warning-option ' \ -DLLVM_LINK_LLVM_DYLIB=ON \ -DLLVM_INSTALL_UTILS=ON \ -DLLVM_VERSION_SUFFIX= \ -DLLVM_ENABLE_SPHINX=ON \ -DSPHINX_WARNINGS_AS_ERRORS=OFF \ -DLLVM_BUILD_LLVM_DYLIB=ON \ -DLLVM_ENABLE_RTTI=ON \ -DLLVM_ENABLE_FFI=ON \ -DLLVM_USE_PERF=yes \ -DLIBCLANG_LIBRARY_VERSION=1 \ -DENABLE_LINKER_BUILD_ID=ON \ -DPOLLY_BUNDLED_JSONCPP=OFF \ -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="WebAssembly;AVR" \ -DCLANG_ENABLE_BOOTSTRAP=ON \ -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON \ -DCLANG_VENDOR=Debian \ -DCLANG_BOOTSTRAP_PASSTHROUGH="CMAKE_INSTALL_PREFIX;CMAKE_VERBOSE_MAKEFILE;CMAKE_BUILD_TYPE;CMAKE_CXX_FLAGS_RELWITHDEBINFO;LLVM_LINK_LLVM_DYLIB;LLVM_INSTALL_UTILS;LLVM_VERSION_SUFFIX;LLVM_ENABLE_SPHINX;SPHINX_WARNINGS_AS_ERRORS;LLVM_BUILD_LLVM_DYLIB;LLVM_ENABLE_RTTI;LLVM_ENABLE_FFI;LIBCLANG_LIBRARY_VERSION;ENABLE_LINKER_BUILD_ID;POLLY_BUNDLED_JSONCPP;LLVM_EXPERIMENTAL_TARGETS_TO_BUILD;LLVM_USE_PERF;LLVM_ENABLE_ASSERTIONS;LLVM_BINUTILS_INCDIR;LLVM_HOST_TRIPLE;;LLVM_COMPILER_CHECKED;COMPILER_RT_BUILD_BUILTINS;LIBOMP_LIBFLAGS;CMAKE_SHARED_LINKER_FLAGS" Full log with clang-8: clang foo.c -v Debian clang version 8.0.0-+rc5-1 (tags/RELEASE_800/rc5) (based on LLVM 8.0.0) Target: mips64el-unknown-linux-gnu Thread model: posix InstalledDir: /home/sylvestre/llvm-toolchain-8-8~+rc5/./build-llvm/bin Found candidate GCC installation: /usr/lib/gcc/mips64el-linux-gnuabi64/8 Selected GCC installation: /usr/lib/gcc/mips64el-linux-gnuabi64/8 Candidate multilib: .; Selected multilib: .; crt1.o crt1.o "/home/sylvestre/llvm-toolchain-8-8~+rc5/build-llvm/bin/clang-8" -cc1 -triple mips64el-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name foo.c -mrelocation-model pic -pic-level 1 -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -fuse-init-array -target-cpu mips64r2 -target-feature -noabicalls -target-abi n64 -mfloat-abi hard -dwarf-column-info -debugger-tuning=gdb -v -resource-dir /home/sylvestre/llvm-toolchain-8-8~+rc5/build-llvm/lib/clang/8.0.0 -internal-isystem /usr/local/include -internal-isystem /home/sylvestre/llvm-toolchain-8-8~+rc5/build-llvm/lib/clang/8.0.0/include -internal-externc-isystem /usr/include/mips64el-linux-gnuabi64 -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir /home/sylvestre/llvm-toolchain-8-8~+rc5 -ferror-limit 19 -fmessage-length 80 -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/foo-8b5ddb.o -x c foo.c -faddrsig clang -cc1 version 8.0.0 based upon LLVM 8.0.0 default target mips64el-unknown-linux-gnu ignoring nonexistent directory "/include" #include "..." search starts here: #include <...> search starts here: /usr/local/include /home/sylvestre/llvm-toolchain-8-8~+rc5/build-llvm/lib/clang/8.0.0/include /usr/include/mips64el-linux-gnuabi64 /usr/include End of search list. "/usr/bin/ld" --build-id --eh-frame-hdr -m elf64ltsmip -dynamic-linker /lib64/ld.so.1 -o a.out crt1.o crti.o /usr/lib/gcc/mips64el-linux-gnuabi64/8/crtbegin.o -L/usr/lib/gcc/mips64el-linux-gnuabi64/8 -L/lib/../lib64 -L/usr/lib/gcc/mips64el-linux-gnuabi64/8 -L/usr/lib/gcc/mips64el-linux-gnuabi64/8/../../.. -L/home/sylvestre/llvm-toolchain-8-8~+rc5/build-llvm/bin/../lib -L/lib -L/usr/lib /tmp/foo-8b5ddb.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/mips64el-linux-gnuabi64/8/crtend.o crtn.o /usr/bin/ld: cannot find crt1.o: No such file or directory /usr/bin/ld: cannot find crti.o: No such file or directory clang-8: error: linker command failed with exit code 1 (use -v to see invocation) ---- clang-7 clang-7 foo.c -v clang version 7.0.1-8 (tags/RELEASE_701/final) Target: mips64el-unknown-linux-gnu Thread model: posix InstalledDir: /usr/bin Found candidate GCC installation: /usr/bin/../lib/gcc/mips64el-linux-gnuabi64/8 Found candidate GCC installation: /usr/lib/gcc/mips64el-linux-gnuabi64/8 Selected GCC installation: /usr/bin/../lib/gcc/mips64el-linux-gnuabi64/8 Candidate multilib: .; Selected multilib: .; "/usr/lib/llvm-7/bin/clang" -cc1 -triple mips64el-unknown-linux-gnu -S -disable-free -disable-llvm-verifier -discard-value-names -main-file-name foo.c -mrelocation-model pic -pic-level 1 -mthread-model posix -mdisable-fp-elim -fmath-errno -no-integrated-as -mconstructor-aliases -fuse-init-array -target-cpu mips64r2 -target-feature -noabicalls -target-abi n64 -mfloat-abi hard -dwarf-column-info -debugger-tuning=gdb -v -resource-dir /usr/lib/llvm-7/lib/clang/7.0.1 -internal-isystem /usr/local/include -internal-isystem /usr/lib/llvm-7/lib/clang/7.0.1/include -internal-externc-isystem /usr/include/mips64el-linux-gnuabi64 -internal-externc-isystem /include -internal-externc-isystem /usr/include -fno-dwarf-directory-asm -fdebug-compilation-dir /home/sylvestre/llvm-toolchain-8-8~+rc5 -ferror-limit 19 -fmessage-length 80 -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/foo-c7da59.s -x c foo.c clang -cc1 version 7.0.1 based upon LLVM 7.0.1 default target mips64el-unknown-linux-gnu ignoring nonexistent directory "/include" #include "..." search starts here: #include <...> search starts here: /usr/local/include /usr/lib/llvm-7/lib/clang/7.0.1/include /usr/include/mips64el-linux-gnuabi64 /usr/include End of search list. "/usr/bin/as" -march mips64r2 -mabi 64 -EL -KPIC -o /tmp/foo-3cb2e7.o /tmp/foo-c7da59.s "/usr/bin/ld" --build-id --eh-frame-hdr -m elf64ltsmip -dynamic-linker /lib64/ld.so.1 -o a.out /usr/bin/../lib/gcc/mips64el-linux-gnuabi64/8/../../../mips64el-linux-gnuabi64/crt1.o /usr/bin/../lib/gcc/mips64el-linux-gnuabi64/8/../../../mips64el-linux-gnuabi64/crti.o /usr/bin/../lib/gcc/mips64el-linux-gnuabi64/8/crtbegin.o -L/usr/bin/../lib/gcc/mips64el-linux-gnuabi64/8 -L/usr/bin/../lib/gcc/mips64el-linux-gnuabi64/8/../../../mips64el-linux-gnuabi64 -L/lib/mips64el-linux-gnuabi64 -L/lib/../lib64 -L/usr/lib/mips64el-linux-gnuabi64 -L/usr/bin/../lib/gcc/mips64el-linux-gnuabi64/8 -L/usr/bin/../lib/gcc/mips64el-linux-gnuabi64/8/../../.. -L/usr/lib/llvm-7/bin/../lib -L/lib -L/usr/lib /tmp/foo-3cb2e7.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/bin/../lib/gcc/mips64el-linux-gnuabi64/8/crtend.o /usr/bin/../lib/gcc/mips64el-linux-gnuabi64/8/../../../mips64el-linux-gnuabi64/crtn.o
As a temporary workaround I could suggest to pass the following argument to the cmake. It might help. Anyway I'm working on a complete fix for the bug. -DLLVM_HOST_TRIPLE=mips64el-linux-gnuabi64
I hope r357506 fixes the regression.
Thanks Your workaround in comment #5 fixed my issue. Tom, I think we should take this fix in 8.0.1
Reopen the bug to make sure it will be backported to 8.0.1
Merged: r358947