unresolvable R_PPC_REL16_{HA,LO} relocation against symbol

Alan Modra amodra@bigpond.net.au
Wed Nov 8 14:30:00 GMT 2006


On Wed, Nov 08, 2006 at 04:39:06PM +0900, Hiroki Kaminaga wrote:
> powerpc-gnu-linux-gcc -shared -o libfoo.so foo.c
> powerpc-gnu-linux-gcc -shared bar.S libfoo.so
> /usr/local/powerpc-gnu-linux/devel/lib/gcc/powerpc-gnu-linux/4.1.1/../../../../powerpc-gnu-linux/bin/ld: /tmp/ccmkHfFo.o(.text+0x6): unresolvable R_PPC_REL16_HA relocation against symbol `foo'
> /usr/local/powerpc-gnu-linux/devel/lib/gcc/powerpc-gnu-linux/4.1.1/../../../../powerpc-gnu-linux/bin/ld: /tmp/ccmkHfFo.o(.text+0xa): unresolvable R_PPC_REL16_LO relocation against symbol `foo'

The linker error is correct.  There is no support in ld.so for dynamic
R_PPC_REL16_LO/HI relocs, so you can't reference a symbol in a shared
lib that way.  (You could if your testcase had "bl foo@plt" somewhere,
as that would define foo in the PLT, which would allow the linker to
resolve the reloc.)

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Binutils mailing list