[PATCH] sh: Add PIC implementation for crt1.S

Peter Griffin pgriffin at mpc-data.co.uk
Tue May 5 13:44:35 UTC 2009


On Fri, 2009-05-01 at 17:56 +0200, Carmelo Amoroso wrote:
> Peter Griffin wrote:
> >> Hi Pete,
> >> I tried you patch but I cannot link a pie application (simple hello)
> >> due to linker error as below:
> >>
> >> /opt/STM/STLinux-2.3/devkit/sh4_uclibc/lib/gcc/sh4-linux-uclibc/4.2.4/../../../../sh4-linux-uclibc/bin/ld:
> >> /opt/STM/STLinux-2.3/devkit/sh4_uclibc/target/usr/lib/Scrt1.o(.text+0x40):
> >> unresolvable R_SH_GOTOFF relocation against symbol `__uClibc_main'
> >> /opt/STM/STLinux-2.3/devkit/sh4_uclibc/lib/gcc/sh4-linux-uclibc/4.2.4/../../../../sh4-linux-uclibc/bin/ld:
> >> final link failed: Nonrepresentable section on output
> >> collect2: ld returned 1 exit status
> >>
> >> I've fixed your patch... GOTOFF relocation should be used for static
> >> data access, not for function call. I've fixed it by using a GOT
> >> entry. I've linked a pie hello application and I do not have any
> >> TEXTREL.
> >> Please may you try my version (attached) on your system.
> >>
> >> Thanks,
> >> Carmelo
> > Hi Carmelo,
> > 
> > Sorry about the delay in getting back to you. I'm having problems
> > recreating the toolchain I used to build the SH2A PIC binaries. Nothing
> > to do with the patch or your changes.
> > 
> > I should have submitted the patch a couple of weeks ago when I had
> > everything still on my system :-(
> > 
> > I'll let you know when I get it going.
> > 
> > regards,
> > 
> > Peter.
> > 
> Ok,
> I'm using the modify version of your patch on MMU sh4/nptl system
> without problem, and indeed it solved the issue with dbus.
> I'd like to have just one patch working fin for sh2a; so I'll wait
> your feedback before committing it.
> 
> Thanks,
> Carmelo
> 
Hi Carmelo,

I sorted out my toolchain problem and tested the patch with your changes.
It works fine on SH2A with a PIE hello program. 

I'm glad the patch also helped to solve your problem :-)

Cheers,

Pete.



More information about the uClibc mailing list