This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Fix handling of dwarf sections for IRIX 6
- From: Richard Sandiford <rsandifo at redhat dot com>
- To: binutils at sources dot redhat dot com
- Date: Tue, 16 Dec 2003 21:24:33 +0000
- Subject: Fix handling of dwarf sections for IRIX 6
gcc's IRIX 6 configuration will emit section statements of the form:
.section .debug_abbrev,0x7000001e,0,0,0
where 0x7000001e == SHT_MIPS_DWARF. This is correct in theory, but as
explained in the comment below, GAS expects the dwarf sections to have
type SHT_PROGBITS instead. Any deviation will lead to a warning.
I've been using this patch locally for some time and it's enough to get
good gcc testresults using GNU as & ld. OK to install?
Richard
* config/tc-mips.c (s_change_section): When parsing the MIPS-specific
.section syntax, map SHT_MIPS_DWARF to SHT_PROGBITS.
Index: gas/config/tc-mips.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mips.c,v
retrieving revision 1.240
diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.240 tc-mips.c
*** gas/config/tc-mips.c 6 Dec 2003 13:52:23 -0000 1.240
--- gas/config/tc-mips.c 16 Dec 2003 21:07:37 -0000
*************** s_change_section (int ignore ATTRIBUTE_U
*** 11981,11986 ****
--- 11981,12002 ----
section_name = xstrdup (section_name);
+ /* When using the generic form of .section (as implemented by obj-elf.c),
+ there's no way to set the section type to SHT_MIPS_DWARF. Users have
+ traditionally had to fall back on the more common @progbits instead.
+
+ There's nothing really harmful in this, since bfd will correct
+ SHT_PROGBITS to SHT_MIPS_DWARF before writing out the file. But it
+ means that, for backwards compatibiltiy, the special_section entries
+ for dwarf sections must use SHT_PROGBITS rather than SHT_MIPS_DWARF.
+
+ Even so, we shouldn't force users of the MIPS .section syntax to
+ incorrectly label the sections as SHT_PROGBITS. The best compromise
+ seems to be to map SHT_MIPS_DWARF to SHT_PROGBITS before calling the
+ generic type-checking code. */
+ if (section_type == SHT_MIPS_DWARF)
+ section_type = SHT_PROGBITS;
+
obj_elf_change_section (section_name, section_type, section_flag,
section_entry_size, 0, 0, 0);