]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[build] Use ".bss.*" names for uninitialised-data sections
authorMichael Brown <mcb30@etherboot.org>
Fri, 17 Oct 2008 02:12:11 +0000 (03:12 +0100)
committerMichael Brown <mcb30@etherboot.org>
Fri, 17 Oct 2008 02:12:11 +0000 (03:12 +0100)
The section name seems to have significance for some versions of
binutils.

There is no way to instruct gcc that sections such as .bss16 contain
uninitialised data; it will emit them with contents explicitly set to
zero.  We therefore have to rely on the linker script to force these
sections to become uninitialised-data sections.  We do this by marking
them as NOLOAD; this seems to be the closest semantic equivalent in the
linker script language.

However, this gets ignored by some versions of ld (including 2.17 as
shipped with Debian Etch), which mark the resulting sections with
(CONTENTS,ALLOC,LOAD,DATA).  Combined with the fact that this version of
ld seems to ignore the specified LMA for these sections, this means that
they end up overlapping other sections, and so parts of .prefix (for
example) get obliterated by .data16's bss section.

Rename the .bss sections from .section_bss to .bss.section; this seems to
cause these versions of ld to treat them as uninitialised data.

src/arch/i386/scripts/efi.lds
src/arch/i386/scripts/i386.lds

index 7d3281cc174c65d89190a70fe10affddd131f957..357769e024225d4dfe9768feca960f2330df742b 100644 (file)
@@ -28,7 +28,7 @@ SECTIONS {
        *(.prefix)
        *(.prefix.*)
        _mprefix = .;
-    } .prefix_bss (NOLOAD) : {
+    } .bss.prefix (NOLOAD) : {
        _eprefix = .;
     }
     _prefix_filesz     = ABSOLUTE ( _mprefix - _prefix );
@@ -45,7 +45,7 @@ SECTIONS {
        *(.text)
        *(.text.*)
        _mtext = .;
-    } .text_bss (NOLOAD) : {
+    } .bss.text (NOLOAD) : {
        _etext = .;
     }
     _text_filesz       = ABSOLUTE ( _mtext - _text );
@@ -62,7 +62,7 @@ SECTIONS {
        *(.rodata)
        *(.rodata.*)
        _mrodata = .;
-    } .rodata_bss (NOLOAD) : {
+    } .bss.rodata (NOLOAD) : {
        _erodata = .;
     }
     _rodata_filesz     = ABSOLUTE ( _mrodata - _rodata );
@@ -86,7 +86,7 @@ SECTIONS {
        *(.stack)
        *(.stack.*)
        _mdata = .;
-    } .data_bss (NOLOAD) : {
+    } .bss.data (NOLOAD) : {
        _edata = .;
     }
     _data_filesz       = ABSOLUTE ( _mdata - _data );
@@ -102,7 +102,7 @@ SECTIONS {
        _bss = .;
        /* EFI seems to not support proper bss sections */
        _mbss = .;
-    } .bss_bss (NOLOAD) : {
+    } .bss.bss (NOLOAD) : {
        _ebss = .;
     }
     _bss_filesz                = ABSOLUTE ( _mbss - _bss );
@@ -121,7 +121,7 @@ SECTIONS {
         */
        . += 1;
        _mreloc = .;
-    } .reloc_bss (NOLOAD) : {
+    } .bss.reloc (NOLOAD) : {
        _ereloc = .;
     }
     _reloc_filesz      = ABSOLUTE ( _mreloc - _reloc );
index 575cb88163f3b668844863a617efc0cc92757bc4..985a9b00b6d497f902b9a0cc0112253956bf5ee0 100644 (file)
@@ -34,7 +34,7 @@ SECTIONS {
        *(.prefix)
        *(.prefix.*)
        _mprefix = .;
-    } .prefix_bss (NOLOAD) : AT ( _end_lma ) {
+    } .bss.prefix (NOLOAD) : AT ( _end_lma ) {
        _eprefix = .;
     }
     _prefix_filesz     = ABSOLUTE ( _mprefix - _prefix );
@@ -52,7 +52,7 @@ SECTIONS {
        *(.text16)
        *(.text16.*)
        _mtext16 = .;
-    } .text16_bss (NOLOAD) : AT ( _end_lma ) {
+    } .bss.text16 (NOLOAD) : AT ( _end_lma ) {
        _etext16 = .;
     }
     _text16_filesz     = ABSOLUTE ( _mtext16 - _text16 );
@@ -71,7 +71,7 @@ SECTIONS {
        *(.data16)
        *(.data16.*)
        _mdata16 = .;
-    } .data16_bss (NOLOAD) : AT ( _end_lma ) {
+    } .bss.data16 (NOLOAD) : AT ( _end_lma ) {
        *(.bss16)
        *(.bss16.*)
        *(.stack16)
@@ -98,7 +98,7 @@ SECTIONS {
        *(.data.*)
        *(SORT(.tbl.*))         /* Various tables.  See include/tables.h */
        _mtextdata = .;
-    } .textdata_bss (NOLOAD) : AT ( _end_lma ) {
+    } .bss.textdata (NOLOAD) : AT ( _end_lma ) {
        *(.bss)
        *(.bss.*)
        *(COMMON)
@@ -119,7 +119,7 @@ SECTIONS {
        *(.zinfo)
        *(.zinfo.*)
        _mzinfo = .;
-    } .zinfo_bss (NOLOAD) : AT ( _end_lma ) {
+    } .bss.zinfo (NOLOAD) : AT ( _end_lma ) {
        _ezinfo = .;
     }
     _zinfo_filesz      = ABSOLUTE ( _mzinfo - _zinfo );