From: pavenis AT lanet DOT lv To: "Mark E." , djgpp-workers AT delorie DOT com, pavenis AT lanet DOT lv Date: Tue, 13 Aug 2002 17:03:51 +0300 MIME-Version: 1.0 Subject: Re: Problem with DWARF2 debug info for DJGPP Message-ID: <3D593BF7.26818.137F06A@localhost> In-reply-to: <3D57B977.12209.41E697@localhost> References: <3D57C5D7 DOT 23156 DOT 20C047 AT localhost> X-mailer: Pegasus Mail for Windows (v4.02) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On 12 Aug 2002 at 13:34, Mark E. wrote: > Try this patch for 2.13. It fixes the problem for me: > > *** gas/write.c.orig Sat Jun 8 03:37:14 2002 > --- gas/write.c Mon Aug 12 13:32:08 2002 > *************** set_segment_vma (abfd, sec, xxx) > *** 1419,1429 **** > PTR xxx ATTRIBUTE_UNUSED; > { > static bfd_vma addr = 0; > > ! bfd_set_section_vma (abfd, sec, addr); > ! addr += bfd_section_size (abfd, sec); > } > ! #endif /* BFD_ASSEMBLER && OBJ_COFF && !TE_PE */ > > /* Finish the subsegments. After every sub-segment, we fake an > ".align ...". This conforms to BSD4.2 brane-damage. We then fake > --- 1419,1444 ---- > PTR xxx ATTRIBUTE_UNUSED; > { > static bfd_vma addr = 0; > + flagword flags; > + int debug_section; > > ! flags = bfd_get_section_flags (abfd, sec); > ! debug_section = ((flags & SEC_HAS_CONTENTS) && (flags & SEC_ALLOC) == 0) > ! || (flags & SEC_DEBUGGING); > ! > ! /* Set the vma of debugging sections to zero to keep BFD's DWARF2 reader > ! from complaining about bad data when an undefined symbol is reported > ! by the linker. */ > ! if (debug_section) > ! { > ! bfd_set_section_vma (abfd, sec, 0); > ! return; > ! } > ! > ! bfd_set_section_vma (abfd, sec, addr); > ! addr += bfd_section_size (abfd, sec); > } > ! #endif /* BFD_ASSEMBLER && OBJ_COFF && !TE_GO32 */ > > /* Finish the subsegments. After every sub-segment, we fake an > ".align ...". This conforms to BSD4.2 brane-damage. We then fake > I guess that after that VMA is being set to 0 for too much sections (see output's of objdump below). Anyway it doesn't seem to cause trouble at least immediatelly as I sucessfully bootstrapped GCC-3.2 20020812, also tested with my own applications. No regressions noticed at least in quick test. All seems to work. I don't know whether setting VMA to 0 for example for .eh_frame is harmless (even if I didn't notice any harm) Andris GCC command line options: -g3 -O2 -c (both GCC builds were compiled as DWARF2 debugging info as the default) ------------------------------------------------------------- GCC-3.2 20020812 + binutils-2.13 with Mark's patch ------------------------------------------------------------- radau.o: file format coff-go32 Sections: Idx Name Size VMA LMA File off Algn 0 .text 00001e00 00000000 00000000 000002bc 2**4 CONTENTS, ALLOC, LOAD, RELOC, CODE 1 .data 00000000 00001e00 00001e00 00000000 2**4 ALLOC, LOAD, DATA 2 .bss 00000000 00001e00 00001e00 00000000 2**2 ALLOC 3 .debug_abbrev 00000265 00000000 00000000 000020bc 2**0 CONTENTS, DEBUGGING 4 .debug_info 00000c27 00000000 00000000 00002321 2**0 CONTENTS, RELOC, DEBUGGING 5 .debug_line 000003e1 00000000 00000000 00002f48 2**0 CONTENTS, RELOC, DEBUGGING 6 .debug_macinfo 0000050e 00000000 00000000 00003329 2**0 CONTENTS, DEBUGGING 7 .gnu.linkonce.d._ZTV15RadauIntegrator 00000020 00000000 00000000 00003837 2**4 CONTENTS, ALLOC, LOAD, RELOC, DATA, LINK_ONCE_DISCARD 8 .gnu.linkonce.d._ZTI15RadauIntegrator 00000010 00000000 00000000 00003857 2**4 CONTENTS, ALLOC, LOAD, RELOC, DATA, LINK_ONCE_DISCARD 9 .gnu.linkonce.r._ZTS15RadauIntegrator 00000020 00000000 00000000 00003867 2**4 CONTENTS, ALLOC, LOAD, DATA, LINK_ONCE_DISCARD 10 .debug_frame 0000021c 00000000 00000000 00003887 2**0 CONTENTS, RELOC, DEBUGGING 11 .eh_frame 00000108 00000000 00000000 00003aa3 2**2 CONTENTS, ALLOC, LOAD, RELOC, DATA 12 .debug_pubnames 0000019a 00000000 00000000 00003bab 2**0 CONTENTS, RELOC, DEBUGGING 13 .debug_aranges 00000020 00000000 00000000 00003d45 2**0 CONTENTS, RELOC, DEBUGGING 14 .debug_ranges 00000030 00000000 00000000 00003d65 2**0 CONTENTS, DEBUGGING 15 .debug_str 00000015 00000000 00000000 00003d95 2**0 CONTENTS, DEBUGGING 16 .comment 00000028 00000000 00000000 00003daa 2**2 CONTENTS, DEBUGGING ------------------------------------------------------------- GCC-3.2 20020804 + binutils-2.12.1 ------------------------------------------------------------- radau.ot: file format coff-go32 radau.ot architecture: i386, flags 0x00000031: HAS_RELOC, HAS_SYMS, HAS_LOCALS start address 0x00000000 Sections: Idx Name Size VMA LMA File off Algn 0 .text 00001e00 00000000 00000000 000002bc 2**4 CONTENTS, ALLOC, LOAD, RELOC, CODE 1 .data 00000000 00001e00 00001e00 00000000 2**4 ALLOC, LOAD, DATA 2 .bss 00000000 00001e00 00001e00 00000000 2**2 ALLOC 3 .debug_abbrev 00000265 00001e00 00001e00 000020bc 2**0 CONTENTS, DEBUGGING 4 .debug_info 00000c27 00002065 00002065 00002321 2**0 CONTENTS, RELOC, DEBUGGING 5 .debug_line 000003e2 00002c8c 00002c8c 00002f48 2**0 CONTENTS, RELOC, DEBUGGING 6 .debug_macinfo 0000050e 0000306e 0000306e 0000332a 2**0 CONTENTS, DEBUGGING 7 .gnu.linkonce.d._ZTV15RadauIntegrator 00000020 0000357c 0000357c 00003838 2**4 CONTENTS, ALLOC, LOAD, RELOC, DATA, LINK_ONCE_DISCARD 8 .gnu.linkonce.d._ZTI15RadauIntegrator 00000010 0000359c 0000359c 00003858 2**4 CONTENTS, ALLOC, LOAD, RELOC, DATA, LINK_ONCE_DISCARD 9 .gnu.linkonce.r._ZTS15RadauIntegrator 00000020 000035ac 000035ac 00003868 2**4 CONTENTS, ALLOC, LOAD, DATA, LINK_ONCE_DISCARD 10 .debug_frame 0000021c 000035cc 000035cc 00003888 2**0 CONTENTS, RELOC, DEBUGGING 11 .eh_frame 00000108 000037e8 000037e8 00003aa4 2**2 CONTENTS, ALLOC, LOAD, RELOC, DATA 12 .debug_pubnames 0000019a 000038f0 000038f0 00003bac 2**0 CONTENTS, RELOC, DEBUGGING 13 .debug_aranges 00000020 00003a8a 00003a8a 00003d46 2**0 CONTENTS, RELOC, DEBUGGING 14 .debug_ranges 00000030 00003aaa 00003aaa 00003d66 2**0 CONTENTS, DEBUGGING 15 .debug_str 00000015 00003ada 00003ada 00003d96 2**0 CONTENTS, DEBUGGING 16 .comment 00000028 00003aef 00003aef 00003dab 2**2 CONTENTS, DEBUGGING