On Tue, Nov 27, 2001 at 04:08:47PM +0100, Maciej W. Rozycki wrote:
> On Tue, 27 Nov 2001, Florian Lohoff wrote:
>
> > > Huh? You should be dealing with segments and not sections (as you are
> > > loading and not linking the image) and then only LOADable ones. I believe
> >
> > I waded through the sections list copieng all sections which are of
> > type PROGBITS which is basically the same. Also i cleared all NOBITS
>
> It's not the same, sorry -- for sections you would need to handle ones
> marked ALLOC in flags. Of these you need to load ones of type PROGBITS
> and zero-fill ones of type NOBITS. Others may be discarded. For Linux
> you may actually skip NOBITS as well, as the head code zero-fills common
> sections itself, but handling them is saner IMO.
This is mostly what i do - As the ext2 code loads in the whole file
as a chunk i am loading it after the booloader - Then copy it to the
end of the first 8Megs (Which is the minimum memory on a decstation)
and then copy the chunks marked PROGBITS to their final location.
Not optimal but it worked for all the cases where the ELF is ok.
> Still using segments is the proper way and it's simpler as well.
> Additionally for platforms that use physical (or in any way different)
> addressing upon boot, you may (and should) use segments' physical
> addresses that are not available (assigned) to sections.
>
> > sections. The problem was a progbits section with length > 0 and addr
> > = 0 which is IMHO bogus.
>
> Not bogus -- the only section which matches your criteria I'm seeing is
> ".pdr":
Yep - And that the one where the current copyelf function crashes the
box.
> [17] .pdr PROGBITS 00000000 2c4954 034440 00 0 0 4
> But it's not marked as allocatable, so it does not belong to the run-time
> image. See also the "System V Application Binary Interface, Edition 4.1",
> chapter 4 for sections and 5 for segments.
;) I am no elf god by far - I was just in the need of a bootloader so
i looked in the elf headers and collected the bits i thought were
usefull.
Flo
--
Florian Lohoff flo@rfc822.org +49-5201-669912
Nine nineth on september the 9th Welcome to the new billenium
PGP signature