public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Not a bug, just a strange thing with recent binutils
@ 2001-05-30  7:37 Thomas Petazzoni
  0 siblings, 0 replies; only message in thread
From: Thomas Petazzoni @ 2001-05-30  7:37 UTC (permalink / raw)
  To: binutils, kos-dev

hi,

I told you in previous e-mails that recent binutils (2.11.90 for
instance) generated two program headers, when old binutils (2.9.5 or
2.10) generated only one program header with the same set of sources !

in fact we used the link script below

******** First link script ***************
OUTPUT_FORMAT("elf32-i386","elf32-i386","elf32-i386");
ENTRY(_start)
OUTPUT_ARCH("i386")
 
SECTIONS {
        . = 0x200000 + SIZEOF_HEADERS;
        _b_loader = .;
        . = ALIGN(4096);
 
        .text : { *(.text)
                  etext = .; _etext = .; }
        .data : { *(.data)
                  edata = .; _edata = .; }
        .bss :  { *(.bss) *(COMMON)
                  end = .; _end = .; }
        _e_loader = .;
}
********* End of first link script **************

and with this script, the binary file contained only one program header
with old version of binutils. and grub was able to load it, everything
worked well.

then we used the same link script (why changing ?) with recent binutils
and it didn't work anymore. grub wasn't able to laod the file because
there was 2 program headers. strange. i said it was a bug. but if you
use the following link script

************ Second link script *************
OUTPUT_FORMAT("elf32-i386","elf32-i386","elf32-i386");
ENTRY(_start)
OUTPUT_ARCH("i386")
 
SECTIONS {
        . = 0x200000 + SIZEOF_HEADERS;
        _b_loader = .;
        . = ALIGN(4096);
 
        .text : { *(.text)
                  etext = .; _etext = .; }
        .data : { *(.data) *(.rodata)              <=== i just added
.rodata here !
                  edata = .; _edata = .; }
        .bss :  { *(.bss) *(COMMON)
                  end = .; _end = .; }
        _e_loader = .;
}
*************** End of second link script ************

everything worked well again, only one program header was generated even
with recent binutils, and grub was happy.

Conclusion : it was not really a bug, but there's still a problem,
binutils do not generate the same number of program headers, with the
same set of sources. i don't know when to put two or more program
headers, but i know grub is now very happy :)

thx for all,

thomas
-- 
PETAZZONI Thomas
thomas.petazzoni@meridon.com
ICQ : 34937744
Projet KOS : http://kos.enix.org

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-05-30  7:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-30  7:37 Not a bug, just a strange thing with recent binutils Thomas Petazzoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).