https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94391
H.J. Lu <hjl.tools at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|WONTFIX |WORKSFORME --- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> --- (In reply to Yuxuan Shui from comment #0) > Test case: > > Source file (a.c): > extern char _binary_a_c_size[]; > unsigned long foo() { return (unsigned long)_binary_a_c_size; } Try --- extern unsigned long _binary_a_c_size; unsigned long foo() { return _binary_a_c_size; } --- > Run: > objcopy -B i386:x86-64 -I binary -O elf64-x86-64 a.c b.o > gcc -fuse-ld=lld -fpie -pie a.c b.o > > lld complains about: > > ld.lld: error: relocation R_X86_64_PC32 cannot refer to absolute symbol: > _binary_a_c_size This is an lld bug.