This is the mail archive of the
mailing list for the binutils project.
Re: .reloc improvement
Alan Modra <firstname.lastname@example.org> writes:
> This patch makes some improvements to relocations emitted by the
> .reloc directive:
> 1) A symbol on these relocs is converted to section symbol plus offset
> if the symbol satisifes S_IS_LOCAL and some section related
> conditions. For example, forward/backward labels like "1f", and
> ELF locals like .L123 will be converted. This helps keep the
> symbol table tidy.
> 2) These relocations are merge sorted with the normal fixup relocs,
> instead of being emitted after the fixup relocs. A merge sort
> ought to be sufficient; If someone generates .reloc with offsets
> out of order then I'd say they obviously don't care about reloc
> 3) Time taken to find .reloc frags should be considerably better
> than it used to be.
> * write.c (resolve_reloc_expr_symbols): Convert local symbols
> on relocs to section+offset.
> (get_frag_for_reloc): New function.
> (write_relocs): Merge sort fixup relocs with those from .reloc
Thanks for doing this. The relaxation might need to be conditional
for some REL targets though. E.g. one of the main .reloc uses for
MIPS is to add an R_MIPS_JALR hint to say where an indirect PIC call
actually goes. There's no room in the instruction itself for an
in-place addend, so on REL targets, the addend needs to be zero.
It's very unlikely anyone would use R_MIPS_JALR with local labels,
but the same might apply to other relocs (especially PC-relative relocs)
for which the relocation field is smaller than an address.
Maybe one way would be to create a fake, temporary fixup and pass
that to tc_fix_adjustable. Doesn't feel very clean though. :-)