This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: unresolvable R_PPC_REL16_{HA,LO} relocation against symbol


> From: Hiroki Kaminaga <kaminaga@sm.sony.co.jp>
...
> Below is reduced test case, with binutils version >= 2.17.
> 
> $ cat foo.c 
> int foo(void) {return 0;}
> 
> $ cat bar.S 
> 	.section ".text"
> 	.align 2
> 	.globl bar
> 	.type bar, @function
> bar:
> 	li 14,0
> 	addis 10,10,foo-.@ha
> 	lwz 10,foo-.@l(10)
> 	mr 3,14
> 	blr
> 	.size bar, .-bar
> 
> $ cat Makefile 
> CROSS=powerpc-gnu-linux-
> CC=$(CROSS)gcc
> 
> all: foo bar
> foo: 
> 	$(CC) -shared -o libfoo.so foo.c
> bar: foo
> 	$(CC) -shared bar.S libfoo.so
> 
> $ make
> 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'
> /usr/local/powerpc-gnu-linux/devel/lib/gcc/powerpc-gnu-linux/4.1.1/../../../../powerpc-gnu-linux/bin/ld: final link failed: Nonrepresentable section on output
> collect2: ld returned 1 exit status
> make: *** [bar] Error 1

I guess this problem in binutils is caused in:
bfd/elf32-ppc.c:ppc_elf_relocate_section()
by setting TRUE to unresolved_reloc in RELOC_FOR_GLOBAL_SYMBOL()
but not clearing it at  case R_PPC_REL16*: and do some calculations.

Am I in the right direction?


Thanks in Advance.

(Hiroki Kaminaga)
t
--


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]