[PATCH/RFA] sh-elf: Unnecessary relocations

kaz Kojima kkojima@rr.iij4u.or.jp
Fri Sep 27 08:40:00 GMT 2002


Hans-Peter Nilsson <hp@bitrange.com> wrote:
>> +#as: -big
>> +#objdump: -r
>> +#name: PC-relative loads
>> +
>> +.*:     file format .*sh.*
>> diff -urN ORIG/src/gas/testsuite/gas/sh/pcrel2.s TMP/src/gas/testsuite/gas/sh/pcrel2.s
> 
> Something is missing in the pcrel2.d file, it seems.  Other than
> that, it seems ok.

I thought it checks that there is no relocations made. How can
I write such script?

>> +	.globl	foo
>> +foo:
> 
>> +	.long	. - foo
> 
> A thought here.  Isn't this commonly generated by gcc in the
> absence of -fpic/-fPIC?  If so, then I guess -fpic/-fPIC is
> required for DSO:s and there's no support for DT_TEXTREL.
> Is that the case?  (I don't mind, though; -fpic/-fPIC is
> required for CRIS but elf32-cris.c emits an error message in
> elf_backend_check_relocs when bad relocs are found when
> -shared.)

SH gcc generates such expressions for the switch statement in
non-pic case. I'm not sure about another cases without -fpic,
though.
Thanks,
	kaz



More information about the Binutils mailing list