Closed 688cc089-1a96-4cb4-bd77-eaf433fc1da2 closed 5 years ago
D66925/r370426
So it is probably unnecessary to teach LLD about _LO _HA. I have an LLVM patch to emit R_PPC_GOT_TPREL16 instead of R_PPC_GOT_TPREL16_LO to circumvent the issue https://reviews.llvm.org/D66925
Your solution works! I applied D66925 patch to LLVM9 and rebuilt FreeBSD powerpc 32 bit libraries. All my static (C language) test programs are running now.
I observe that [1] ld.bfd has an internal error when it attempts to relax Initial-Exec to Local-Exec:
// a.o
addis 3, 3, tsd_tls@got@tprel@ha
lwz 3, tsd_tls@got@tprel@l(3)
add 3, 3, tsd_tls@tls
// b.o
.section .tdata,"awT"; .globl tsd_tls; tsd_tls:
// ld/ld-new a.o b.o
internal error, aborting at ../../bfd/elf32-ppc.c:7952 in ppc_elf_relocate_section
[2] GCC does not generate R_PPC_GOT_TPREL16_LO relocations
So it is probably unnecessary to teach LLD about _LO _HA. I have an LLVM patch to emit R_PPC_GOT_TPREL16 instead of R_PPC_GOT_TPREL16_LO to circumvent the issue https://reviews.llvm.org/D66925
I couldn't attach the reproduce tarball, so I posted it to:
assigned to @MaskRay
Extended Description
When statically linking a simple test program usin LLVM9 or 10 (trunk), I found the following problem:
/root/src/llvm-project/build/bin/clang -target powerpc-unknown-freebsd13.0 -O2 -g --sysroot=/usr/obj/root/src/freebsd/powerpc.powerpc64/obj-lib32/tmp/ t1.c -o t1.lld.static -fuse-ld=/root/src/llvm-project/build/bin/ld.lld -static ld.lld: error: unknown relocation (88) against symbol je_tsd_tls ld.lld: error: unknown relocation (88) against symbol je_tsd_tls ld.lld: error: unknown relocation (88) against symbol je_tsd_tls ld.lld: error: unknown relocation (88) against symbol je_tsd_tls ld.lld: error: unknown relocation (88) against symbol je_tsd_tls ld.lld: error: unknown relocation (88) against symbol je_tsd_tls ld.lld: error: unknown relocation (88) against symbol je_tsd_tls ld.lld: error: unknown relocation (88) against symbol je_tsd_tls ld.lld: error: unknown relocation (88) against symbol je_tsd_tls ld.lld: error: unknown relocation (88) against symbol je_tsd_tls ld.lld: error: unknown relocation (88) against symbol je_tsd_tls ld.lld: error: unknown relocation (88) against symbol je_tsd_tls ld.lld: error: unknown relocation (88) against symbol je_tsd_tls ld.lld: error: unknown relocation (88) against symbol je_tsd_tls ld.lld: error: unknown relocation (88) against symbol je_tsd_tls ld.lld: error: unknown relocation (88) against symbol je_tsd_tls ld.lld: error: unknown relocation (88) against symbol je_tsd_tls ld.lld: error: unknown relocation (88) against symbol je_tsd_tls ld.lld: error: unknown relocation (88) against symbol je_tsd_tls ld.lld: error: unknown relocation (88) against symbol je_tsd_tls ld.lld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors) clang-9: error: linker command failed with exit code 1 (use -v to see invocation)
A reproduce tarball will be attached.