[llvm-bugs] [Bug 43738] New: cross linker with system directory fails with misleading error message
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Oct 20 21:22:18 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=43738
Bug ID: 43738
Summary: cross linker with system directory fails with
misleading error message
Product: lld
Version: unspecified
Hardware: All
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
Assignee: unassignedbugs at nondot.org
Reporter: denik at google.com
CC: llvm-bugs at lists.llvm.org, peter.smith at linaro.org
Let's build arm64 object file.
$ clang --sysroot=/build/arm64-generic --target=aarch64 -o test.o -c test.c
Sanity check that lld passes with the correct library directory:
$ ld.lld --sysroot=/build/arm64-generic -m aarch64linux -shared -o test.so
-L/build/arm64-generic/usr/lib64 test.o -lc
$ echo $?
0
When we add a system directory BEFORE the sysroot library directory lld fails
with misleading error message:
$ ld.lld --sysroot=/build/arm64-generic -m aarch64linux -shared -o test.so
-L/usr/lib64 -L/build/arm64-generic/usr/lib64 test.o -lc
ld.lld: error: test.o is incompatible with aarch64linux
$ echo $?
1
If we add a system directory AFTER the sysroot library directory lld passes:
$ ld.lld --sysroot=/build/arm64-generic -m aarch64linux -shared -o test.so
-L/build/arm64-generic/usr/lib64 -L/usr/lib64 test.o -lc
$ echo $?
0
Here is the behavior of ld.gold (case when lld failed).
It skips incompatible libraries until it finds the right one:
$ ld.gold --sysroot=/build/arm64-generic -m aarch64linux -shared -o test.so
-L/usr/lib64 -L/build/arm64-generic/usr/lib64 test.o -lc
/usr/x86_64-pc-linux-gnu/binutils-bin/2.27.0/ld.gold.real: warning: skipping
incompatible /usr/lib64/libc.so while searching for c
$ echo $?
0
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20191021/2f52afde/attachment.html>
More information about the llvm-bugs
mailing list