-fPIC produces un-share-able X86_64 relocations
x86_64 (cross)compiler with
R_X86_64_PC32 relocations that don't work for
That's required on the Haiku platform: executables must be linked with -shared. I know nothing about this, but ...
- only some
R_X86_64_PC32relocations fail, while others that appear in objdump -r output seem to be normal.
- some of the offending symbols appear in assembler output:
- the working native C compiler writes this to load a function address, producing an acceptable
movq testfunction@GOTPCREL(%rip), %rax
movq %rax, %rdi
Steps to reproduce
link compiled files with features like
base_DataziTuple_swap_closure, on ELF platform, with
ld -shared option.
ld: Tuple.o: relocation R_X86_64_PC32 against symbol `base_DataziTuple_swap_closure' can not be used when making a shared object; recompile with -fPIC ld: final link failed: bad value
8.6.3 stage1 cross compiler, built and running on i386; as far as I'm able to get 8.8.1, it generates the same code, so I expect it to have the same problem if I can compile it.
- GHC version used: 8.6.3
- Operating System: Haiku
- System Architecture: i386 / x86_64