Displaying 2 results from an estimated 2 matches for "r_ppc_pltrel24".
2017 Oct 04
2
Relocations used for PPC32 in non-PIC mode
Hello,
I am currently facing an issue at linking stage when compiling basic C code for an embedded PPC32 platform and linking with LLD. For external symbol linkage LLVM appears to use PLT which results in generating a R_PPC_PLTREL24 relocation, that is not support by LDD. Therefore even such a basic example cannot be built:
/* s.c */
int f() { return 0; }
/* t.c */
int f();
int _start() { return f(); }
$ clang -c -target ppc32-gnu-linux-eabi t.c -o t.o
$ clang -c -target ppc32-gnu-linux-eabi s.c -o s.o
$ ld.lld t.o s.o -o t...
2017 Oct 04
2
Relocations used for PPC32 in non-PIC mode
...ely need some improvements sooner or later. In fact I even submitted a patch adding a relocation to ldd just a few hours ago.
However, this particular case is not related to LDD, it is a design issue and furthermore a regression in LLVM itself. I checked gcc, and neither does it try to use PLT and R_PPC_PLTREL24 relocations unless I pass -fpic:
$ gcc -c t.c -o t.o
$ gcc -c s.c -o s.o
$ ld.lld t.o s.o -o t
vs
$ gcc -c -fpic t.c -o t.o
$ gcc -c -fpic s.c -o s.o
$ ld.lld t.o s.o -o t
error: t.c:(function _start): unrecognized reloc 18
The behaviour is simply incorrect, and in fact it may even be dangerous...