[all-commits] [llvm/llvm-project] bcaca3: [Driver] Gnu.cpp: fix libstdc++ search path for mu...
Fangrui Song via All-commits
all-commits at lists.llvm.org
Sun Mar 21 12:02:01 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: bcaca360f8b64d267c787a5f3088e73420e78f53
https://github.com/llvm/llvm-project/commit/bcaca360f8b64d267c787a5f3088e73420e78f53
Author: Fangrui Song <i at maskray.me>
Date: 2021-03-21 (Sun, 21 Mar 2021)
Changed paths:
M clang/lib/Driver/ToolChains/Gnu.cpp
M clang/lib/Driver/ToolChains/Gnu.h
Log Message:
-----------
[Driver] Gnu.cpp: fix libstdc++ search path for multilib
With this change, on Debian x86-64 (with a MULTILIB_OSDIRNAMES local patch
../lib64 -> ../lib; this does not matter because /usr/lib64/crt{1,i,n}.o do not exist),
`clang++ --target=aarch64-linux-gnu a.cc -Wl,--dynamic-linker=/usr/aarch64-linux-gnu/lib/ld-linux-aarch64.so.1 -Wl,-rpath,/usr/aarch64-linux-gnu/lib`
built executable can run under qemu-user. Previously this failed with
`/usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../include/c++/10/iostream:38:10: fatal error: 'bits/c++config.h' file not found`
On Arch Linux, due to the MULTILIB_OSDIRNAMES patch and the existence of
/usr/lib64/crt{1,i,n}.o, clang driver may pick
/usr/lib64/crt{1,i,n}.o and cause a linker error. -B can work around the problem.
`clang++ --target=aarch64-linux-gnu -B /usr/aarch64-linux-gnu/lib a.cc -Wl,--dynamic-linker=/usr/aarch64-linux-gnu/lib/ld-linux-aarch64.so.1 -Wl,-rpath,/usr/aarch64-linux-gnu/lib64:/usr/aarch64-linux-gnu/lib`
More information about the All-commits
mailing list