sorting dynamic relocation entries.

Ian Lance Taylor ian@zembu.com
Tue Mar 14 09:46:00 GMT 2000


   Date: Tue, 14 Mar 2000 14:40:00 -0700
   From: Koundinya K <knk@dde.dk>

       Though things are happening as required in _bfd_mips_elf_final_link(), the final
   shared lib generated still does not have the relocation records sorted. I am doing as per
   the pointers you provided. I am just working on the test case that I described
   y'day...where I have just 3 dynamic relocs. I am attaching the code and the output from
   the debugging statements that I have introduced.

You need to find out when set_section_contents is called for the
.rel.dyn section, and make sure you sort the relocations before that
is done.

This may well happen in elf_bfd_final_link, which implies that you
need to sort the contents in finish_dynamic_sections.

Don't do the sort as you did in the sample code, in which you swap
things in, sort them, and swap them out.  Instead, swap the relocs in
the comparison function.  That way you don't need a temporary buffer.

Ian


More information about the Binutils mailing list