PPC relocs in shared libraries
Alan Modra
amodra@bigpond.net.au
Fri Sep 27 00:05:00 GMT 2002
On Thu, Sep 26, 2002 at 03:39:00PM -0400, Daniel Jacobowitz wrote:
> So we're looking at RELA sections. RELA does not use the in-section
> data, does it?
RELA relocs shouldn't, but see eg. current glibc
sysdeps/ia64/dl-machine.h:elf_machine_rela_relative :-(
> But readelf goes on to do:
>
> compunit.cu_abbrev_offset += rp->r_addend;
>
> Which then will apply the value twice, or to garbage, depending on what
> version of binutils you happen to be using. So I fixed that in my
> local copy.
Needs committing. :)
> Then there are dozens of other places in readelf which do not apply
> relocations. GDB doesn't do it either unless you have a patch I
> haven't finished cleaning up yet (first posted four or five months ago,
> and I got busy elsewhere). So I get things like this:
>
> - DW_AT_stmt_list : 0
> - DW_AT_high_pc : 0x24 36
> - DW_AT_low_pc : 0 0
> + DW_AT_stmt_list : 142
> + DW_AT_high_pc : 0x1a04 6660
> + DW_AT_low_pc : 0x19e0 6624
>
> - Extended opcode 2: set Address to 0x0
> + Extended opcode 2: set Address to 0x182c
>
> These two have the same relocations; one happens to write the relocated
> values into the section and the other doesn't.
A consequence of section contents being ignored for RELA relocs.
Note that there is one good reason to apply the reloc to the
section contents as well as emitting a reloc and that is glibc's
ELF_MACHINE_REL_RELATIVE optimization. Prior to seeing that one
I was inclined to say the section contents should be left at zero.
Not that this is particularly relevant to debug sections.
> So: Do we require full relocation processing on debug sections? If so,
> I'm going to need to finish up the patch to provide an easy way for a
> client like readelf to relocate a section reliably. At present we
> don't implement this relocation except for the location of the abbrev
> table.
>
> Also, should this code be supporting REL relocations? Or do the
> DWARF-2 sections always have RELA for some reason?
Well, x86 is REL and current gcc seems to support -gdwarf-2 on x86.
--
Alan Modra
IBM OzLabs - Linux Technology Centre
More information about the Binutils
mailing list