[patch] add missing mips .bss.* section support

James E Wilson wilson@specifix.com
Sat Oct 1 01:36:00 GMT 2005


I noticed this while trying to get libmudflap working for a mips-elf
embedded target.  I was using the newlib-1.13.0 release.  It is missing
support for the .sbss.* and .bss.* sections.  libmudflap is compiled
with the -fdata-sections option, and so this results in linker errors
(relocation overflow) if the linker script doesn't handle .sbss sections
correctly.  Richard Sandiford fixed the .sbss.* problem in mainline
newlib, but the .bss.* support is still missing.

Building a mips-elf toolchain, and running the testsuite, I see that
this patch fixes 96 libstdc++ failures.  This is essentially the same
problem as my last patch, except with an updated toolchain, i.e.
gcc-4.1.x instead of gcc-4.0.1.  Now the compiler is using .bss.* COMDAT
sections instead of .gnu.linkonce.bss.* sections, and is failing for the
same reason previously described.  So we need to support both types of
bss sections in the linker scripts.

This patch adds the missing .bss.* support to all of the mips linker
scripts in libgloss.  The idt.ld script change was tested with a full
mips-elf toolchain build and make check.  It fixes 96 libstdc++
failures, and there were no regressions.  The other linker script
changes were tested with one simple testcase, to verify that I didn't
get a linker script parsing error.
-- 
Jim Wilson, GNU Tools Support, http://www.specifix.com
-------------- next part --------------
2005-09-30  James E Wilson  <wilson@specifix.com>

	* mips/array.ld, mips/cfe.ld, mips/ddb-kseg0.ld, mips/ddb.ld,
	mips/dve.ld, mips/idt.ld, mips/idt32.ld, mips/idt64.ld,
	mips/idtecoff.ld, mips/jmr3904app-java.ld, mips/jmr3904app.ld,
	jmr3904dram-java.ld, mips/jmr3904dram.ld, mips/lsi.ld, mips/nullmon.ld,
	mips/pmon.ld: Add support for .bss.* sections.

Index: array.ld
===================================================================
RCS file: /cvs/src/src/libgloss/mips/array.ld,v
retrieving revision 1.6
diff -p -p -r1.6 array.ld
*** array.ld	23 Sep 2005 15:51:10 -0000	1.6
--- array.ld	30 Sep 2005 18:32:42 -0000
*************** SECTIONS
*** 172,177 ****
--- 172,178 ----
    .bss : {
      _bss_start = . ;
      *(.bss)
+     *(.bss.*)
      *(.gnu.linkonce.b.*)
      *(COMMON)
    }
Index: cfe.ld
===================================================================
RCS file: /cvs/src/src/libgloss/mips/cfe.ld,v
retrieving revision 1.8
diff -p -p -r1.8 cfe.ld
*** cfe.ld	23 Sep 2005 15:51:10 -0000	1.8
--- cfe.ld	30 Sep 2005 18:32:42 -0000
*************** SECTIONS
*** 130,135 ****
--- 130,136 ----
    .bss : {
      _bss_start = . ;
      *(.bss)
+     *(.bss.*)
      *(.gnu.linkonce.b.*)
      *(COMMON)
    }
Index: ddb-kseg0.ld
===================================================================
RCS file: /cvs/src/src/libgloss/mips/ddb-kseg0.ld,v
retrieving revision 1.8
diff -p -p -r1.8 ddb-kseg0.ld
*** ddb-kseg0.ld	23 Sep 2005 15:51:10 -0000	1.8
--- ddb-kseg0.ld	30 Sep 2005 18:32:42 -0000
*************** SECTIONS
*** 124,129 ****
--- 124,130 ----
    .bss : {
      _bss_start = . ;
      *(.bss)
+     *(.bss.*)
      *(.gnu.linkonce.b.*)
      *(COMMON)
    }
Index: ddb.ld
===================================================================
RCS file: /cvs/src/src/libgloss/mips/ddb.ld,v
retrieving revision 1.8
diff -p -p -r1.8 ddb.ld
*** ddb.ld	23 Sep 2005 15:51:10 -0000	1.8
--- ddb.ld	30 Sep 2005 18:32:42 -0000
*************** SECTIONS
*** 124,129 ****
--- 124,130 ----
    .bss : {
      _bss_start = . ;
      *(.bss)
+     *(.bss.*)
      *(.gnu.linkonce.b.*)
      *(COMMON)
    }
Index: dve.ld
===================================================================
RCS file: /cvs/src/src/libgloss/mips/dve.ld,v
retrieving revision 1.8
diff -p -p -r1.8 dve.ld
*** dve.ld	23 Sep 2005 15:51:10 -0000	1.8
--- dve.ld	30 Sep 2005 18:32:42 -0000
*************** SECTIONS
*** 125,130 ****
--- 125,131 ----
    .bss : {
      _bss_start = . ;
      *(.bss)
+     *(.bss.*)
      *(.gnu.linkonce.b.*)
      *(COMMON)
    }
Index: idt.ld
===================================================================
RCS file: /cvs/src/src/libgloss/mips/idt.ld,v
retrieving revision 1.9
diff -p -p -r1.9 idt.ld
*** idt.ld	23 Sep 2005 15:51:10 -0000	1.9
--- idt.ld	30 Sep 2005 18:32:42 -0000
*************** SECTIONS
*** 131,136 ****
--- 131,137 ----
    .bss : {
      _bss_start = . ;
      *(.bss)
+     *(.bss.*)
      *(.gnu.linkonce.b.*)
      *(COMMON)
    }
Index: idt32.ld
===================================================================
RCS file: /cvs/src/src/libgloss/mips/idt32.ld,v
retrieving revision 1.7
diff -p -p -r1.7 idt32.ld
*** idt32.ld	23 Sep 2005 15:51:10 -0000	1.7
--- idt32.ld	30 Sep 2005 18:32:42 -0000
*************** SECTIONS
*** 133,138 ****
--- 133,139 ----
    .bss : {
      _bss_start = . ;
      *(.bss)
+     *(.bss.*)
      *(.gnu.linkonce.b.*)
      *(COMMON)
    }
Index: idt64.ld
===================================================================
RCS file: /cvs/src/src/libgloss/mips/idt64.ld,v
retrieving revision 1.7
diff -p -p -r1.7 idt64.ld
*** idt64.ld	23 Sep 2005 15:51:10 -0000	1.7
--- idt64.ld	30 Sep 2005 18:32:42 -0000
*************** SECTIONS
*** 132,137 ****
--- 132,138 ----
    .bss : {
      _bss_start = . ;
      *(.bss)
+     *(.bss.*)
      *(.gnu.linkonce.b.*)
      *(COMMON)
    }
Index: idtecoff.ld
===================================================================
RCS file: /cvs/src/src/libgloss/mips/idtecoff.ld,v
retrieving revision 1.5
diff -p -p -r1.5 idtecoff.ld
*** idtecoff.ld	23 Sep 2005 15:51:10 -0000	1.5
--- idtecoff.ld	30 Sep 2005 18:32:42 -0000
*************** SECTIONS
*** 90,95 ****
--- 90,96 ----
    .bss : {
      _bss_start = . ;
      *(.bss)
+     *(.bss.*)
      *(.gnu.linkonce.b.*)
      *(COMMON)
    }
Index: jmr3904app-java.ld
===================================================================
RCS file: /cvs/src/src/libgloss/mips/jmr3904app-java.ld,v
retrieving revision 1.7
diff -p -p -r1.7 jmr3904app-java.ld
*** jmr3904app-java.ld	23 Sep 2005 15:51:10 -0000	1.7
--- jmr3904app-java.ld	30 Sep 2005 18:32:42 -0000
*************** SECTIONS
*** 90,95 ****
--- 90,96 ----
    .bss : {
      _bss_start = . ;
      *(.bss)
+     *(.bss.*)
      *(.gnu.linkonce.b.*)
      *(COMMON)
      . += 0x2000 ;  /* 8k bytes of stack. */
Index: jmr3904app.ld
===================================================================
RCS file: /cvs/src/src/libgloss/mips/jmr3904app.ld,v
retrieving revision 1.8
diff -p -p -r1.8 jmr3904app.ld
*** jmr3904app.ld	23 Sep 2005 15:51:10 -0000	1.8
--- jmr3904app.ld	30 Sep 2005 18:32:42 -0000
*************** SECTIONS
*** 123,128 ****
--- 123,129 ----
    .bss : {
      _bss_start = . ;
      *(.bss)
+     *(.bss.*)
      *(.gnu.linkonce.b.*)
      *(COMMON)
      . += 0x2000 ;  /* 8k bytes of stack. */
Index: jmr3904dram-java.ld
===================================================================
RCS file: /cvs/src/src/libgloss/mips/jmr3904dram-java.ld,v
retrieving revision 1.7
diff -p -p -r1.7 jmr3904dram-java.ld
*** jmr3904dram-java.ld	23 Sep 2005 15:51:10 -0000	1.7
--- jmr3904dram-java.ld	30 Sep 2005 18:32:42 -0000
*************** SECTIONS
*** 92,97 ****
--- 92,98 ----
    .bss : {
      _bss_start = . ;
      *(.bss)
+     *(.bss.*)
      *(.gnu.linkonce.b.*)
      *(COMMON)
    }
Index: jmr3904dram.ld
===================================================================
RCS file: /cvs/src/src/libgloss/mips/jmr3904dram.ld,v
retrieving revision 1.7
diff -p -p -r1.7 jmr3904dram.ld
*** jmr3904dram.ld	23 Sep 2005 15:51:10 -0000	1.7
--- jmr3904dram.ld	30 Sep 2005 18:32:42 -0000
*************** SECTIONS
*** 89,94 ****
--- 89,95 ----
    .bss : {
      _bss_start = . ;
      *(.bss)
+     *(.bss.*)
      *(.gnu.linkonce.b.*)
      *(COMMON)
    }
Index: lsi.ld
===================================================================
RCS file: /cvs/src/src/libgloss/mips/lsi.ld,v
retrieving revision 1.7
diff -p -p -r1.7 lsi.ld
*** lsi.ld	23 Sep 2005 15:51:10 -0000	1.7
--- lsi.ld	30 Sep 2005 18:32:42 -0000
*************** SECTIONS
*** 123,128 ****
--- 123,129 ----
    .bss : {
      _bss_start = . ;
      *(.bss)
+     *(.bss.*)
      *(.gnu.linkonce.b.*)
      *(COMMON)
    }
Index: nullmon.ld
===================================================================
RCS file: /cvs/src/src/libgloss/mips/nullmon.ld,v
retrieving revision 1.8
diff -p -p -r1.8 nullmon.ld
*** nullmon.ld	23 Sep 2005 15:51:10 -0000	1.8
--- nullmon.ld	30 Sep 2005 18:32:42 -0000
*************** SECTIONS
*** 125,130 ****
--- 125,131 ----
    .bss : {
      _bss_start = . ;
      *(.bss)
+     *(.bss.*)
      *(.gnu.linkonce.b.*)
      *(COMMON)
    }
Index: pmon.ld
===================================================================
RCS file: /cvs/src/src/libgloss/mips/pmon.ld,v
retrieving revision 1.8
diff -p -p -r1.8 pmon.ld
*** pmon.ld	23 Sep 2005 15:51:10 -0000	1.8
--- pmon.ld	30 Sep 2005 18:32:42 -0000
*************** SECTIONS
*** 125,130 ****
--- 125,131 ----
    .bss : {
      _bss_start = . ;
      *(.bss)
+     *(.bss.*)
      *(.gnu.linkonce.b.*)
      *(COMMON)
    }


More information about the Newlib mailing list