[PATCH/RFA] sh-elf: Unnecessary relocations
Hans-Peter Nilsson
hp@bitrange.com
Thu Sep 26 22:14:00 GMT 2002
On Fri, 27 Sep 2002, kaz Kojima wrote:
> Hans-Peter Nilsson <hp@bitrange.com> wrote:
> > I think the point is that those relocations are for
> > *immediately* nearby addresses; they can't reach more than
> > something like 1 << 8 or 1 << 12 bytes. It'd be a gcc bug to
> > generate them for global symbols that can be overridden. I
> > think the patch should be corrected to check for R_SH_DIR8WPL
> > and R_SH_IND12W (or really, the BFD names) since there
> > supposedly exists other PC-relative relocations that should be
> > generated for global symbols in the same object. That includes
> > the 32-bit pcrel reloc (whatever the SH ELF name; I think the
> > BFD name is BFD_RELOC_32_PCREL). Right?
>
> Ah, yes. My patch might be overkill. It seems that the old
> tc-sh.c handles the following 6 relocations as such relocations:
>
> BFD_RELOC_SH_PCDISP12BY2
> BFD_RELOC_SH_PCRELIMM8BY2
> BFD_RELOC_SH_PCRELIMM8BY4
> BFD_RELOC_8_PCREL
> BFD_RELOC_SH_SWITCH16
> BFD_RELOC_SH_SWITCH32
>
> I'll make a revised patch with checking these relocations.
Thanks. I'm unsure whether you refer to relocations that should
or should not make it to the output. Anyway, the 32-bit one
should be an output-relocation. I dunno about the others,
though they don't look like they should be in an -fpic object.
Either way, if ld.so can handle them (or whatever they turn into
in a DSO) in a DT_TEXTREL (sp?) DSO, they should make it to the
output.
brgds, H-P
More information about the Binutils
mailing list