binutils patch

Jakub Jelinek jakub@redhat.com
Mon Oct 8 01:22:00 GMT 2001


On Mon, Oct 08, 2001 at 01:21:49AM -0700, Geoff Keating wrote:
> > Date: Sun, 7 Oct 2001 09:00:19 -0400 (EDT)
> > From: Jack Howarth <howarth@nitro.med.uc.edu>
> 
> > This is similar to my sparc32 patch from July.
> > Basically, I don't think we should output .rela.* sections for debugging
> > sections in shared libraries (of course, unless --emit-relocs), gdb doesn't
> > use it anyway and most other ELF backends don't emit them.
> 
> I believe this is a known problem with GDB which will be corrected
> eventually.  With stabs, it's not clear what the correct behaviour is,
> but with DWARF (which will be the default in GCC 3.1) it's clearly
> correct to generate and use the relocs.

I'd say exactly the opposite for DWARF-2 - the standard makes it clear which
data needs to be adjusted and which must not and the debugger, which must
analyze the debug sections while reading them anyway, can do the relocations
even without using a .rel{,a} section.
The rules e.g. prelink uses for relocating DWARF-2 are:
DW_FORM_addr data are to be adjusted
DW_FORM_block{,1,2,4} data need adjustment (with attribute types
	DW_AT_frame_base, DW_AT_location, DW_AT_data_member_location,
	DW_AT_vtable_elem_location), particularly DW_OP_addr data in
	those location lists
in .debug_line section DW_LNE_set_address data needs to be adjusted
in .debug_aranges, unless both fields are 0, the first field needs to be
	adjusted
in .debug_loc section, DW_OP_addr data needs to be adjusted

Most of the ELF backends don't output the reloc sections for debugging
sections at all, so gdb must use these rules anyway when reading the debug
sections.

	Jakub



More information about the Binutils mailing list