Subject: Re: Problem on cross-m68k-netbsdelf compiler
To: None <steve@mctavish.co.uk>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: tech-toolchain
Date: 01/22/2001 22:23:35
In <Pine.NEB.4.30.0101191825380.12992-100000@oor-wullie.mctavish.co.uk>
steve@mctavish.co.uk wrote:

> On Sat, 20 Jan 2001, Izumi Tsutsui wrote:
> 
> > But there is still another problem. news68k bootloader uses
> > MI loadfile() from libsa, but it cannot read BSS size correctly.
> >
> > Because of this, the symbole table is not loaded
> > at correct place (which should be at "_end" symbol address).
> > How does this work with hp300 and mvme68k bootloaders?
> 
> Are you using a similar loadfile_machdep.h to mvme68k/hp300? Specifically,
> check the differences between when _STANDALONE is and isn't defined.

It looks there are something wrong around my toolchain.
p_memsz in the program header does not match with values in
the section header:

---
Program Header:
    LOAD off    0x00000078 vaddr 0x00000000 paddr 0x00000000 align 2**3
         filesz 0x00118d14 memsz 0x00118d14 flags r-x
    LOAD off    0x00118d90 vaddr 0x0011ad18 paddr 0x0011ad18 align 2**4
         filesz 0x0000bce4 memsz 0x00038488 flags rw-
---
Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         00100bcc  00000000  00000000  00000078  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  1 .rodata       00018148  00100bcc  00100bcc  00100c44  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  2 .data         0000bce4  0011ad18  0011ad18  00118d90  2**3
                  CONTENTS, ALLOC, LOAD, DATA
  3 .bss          0002c798  00126a00  00126a00  00124a80  2**4
                  ALLOC
---

memsz in the second program header entry is 0x38488, but it should be
0x38480 (== 0x126a00 + 0x2c798 - 0x11ad18)
            bss start  bss size  data start 

I'll track this later.

> > BTW, m68k ports which have hp300 derived pmap use
> > a.out NMAGIC kernel to map the data segment onto
> > independent pages from text. On m68k ELF kernel,
> > how should this be handled? (kern.ldscript is needed?)
> 
> I wasn't aware this was a problem. Anyone else care to comment?

According to the program header, the data segment seems loaded
to the different pages from text, but it is not page aligned.
(I don't know any bfd spec very well :-)
---
Izumi Tsutsui
tsutsui@ceres.dti.ne.jp