Port-powerpc archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Boot code of linuxppc v. netbsd



>>>>> "ws" == Wolfgang Solfrank <ws%kurt.tools.de@localhost> writes:

ws> I'm not too familiar with XCOFF, but doesn't this format have an
ws> embedded a.out header?  If so, it doesn't have space to store an
ws> arbitrary number of sections, but only the .text, .data and .bss
ws> ones.  I'd expect that the linker/objcopy utility would at least
ws> try to fit all the sections into these three sections in order to
ws> accomodate for this deficiency.  It looks like it doesn't, but the
ws> Mac boot code loads the executable relying on this a.out header.

Well, based on the rs6000.h definitions from bfd, and some of the code
in the Linux coffboot, the xcoff format has a coff header, an
"optional" a.out header, followed by an arbitrary number of section
headers. The a.out header specifies some details for the .text, .data
and .bss sections only (plus a couple of other unused sections). Yes,
it looks like the Mac open firmware is rather lazy in loading only
these sections.

I think objcopy/ld are behaving correctly - the a.out header includes
section numbers for the .text, .data and .bss sections, so an xcoff
loader must at least use the info in the section headers to load an
xcoff binary. In fact, the mac boot even prints out all of the section
information.

>>>>> "David" == David Edelsohn <dje%watson.ibm.com@localhost> writes:

David>  XCOFF basically has three sections: text, data, and bss.  It
David> has some internal sections like read-only data, private data,
David> and TOC, but these actually are encapsulated into the three
David> standard sections.  XCOFF definitely does not have additional
David> ELF-like sections.

The xcoff format does allow an arbitrary sections. In fact, the Linux
coffboot code makes specific use of this in a rather cute way - it
puts the kernel (and md image) in their own section, but it doesn't
rely on the xcoff loader to load these sections into memory (which is
another reason for suspecting that the Mac open firmware xcoff loader
only loads .text, .data and clears .bss).

- S



Home | Main Index | Thread Index | Old Index