lld ignores symbols declared as EXTERN in linker script
| Bugzilla Link | 42329 |
| Resolution | WONTFIX |
| Resolved on | Apr 11, 2020 12:02 |
| Version | unspecified |
| OS | Linux |
| CC | @MaskRay,@smithp35 |
Extended Description
ld.lld has a different behavior compared to GNU ld when it comes to adding undefined symbols from a linker script. Here's a simple test case:
$ touch a.c $ clang -c a.c -o a.o $ echo "EXTERN(test)" > a.lds $ ld.lld -T a.lds a.o -o a.out $ objdump -t a.out | grep test $
The resulting file doesn't contain the "test" symbol, which was added through the linker script. With GNU ld on the other hand:
$ ld -T a.lds a.o -o a.out $ objdump -t a.out | grep test 0000000000000000 UND 0000000000000000 test
https://git.kernel.org/linus/7273ad2b08f8ac9563579d16a3cf528857b26f49 "kbuild: link lib-y objects to vmlinux forcibly when CONFIG_MODULES=y"
removed reliance on the behavior! Read more on https://github.com/ClangBuiltLinux/linux/issues/515
https://reviews.llvm.org/D63564