Subject: Re: objcopy making a mess of converting kernels to a.out format
To: Chris Gilbert <chris@dokein.co.uk>
From: Richard Earnshaw <rearnsha@arm.com>
List: port-arm
Date: 03/01/2004 10:58:08
> On Mon, 1 Mar 2004 03:02:59 +0300
> "Valeriy E. Ushakov" <uwe@ptc.spbu.ru> wrote:
>
> > On Mon, Mar 01, 2004 at 02:54:21 +0300, Valeriy E. Ushakov wrote:
> >
> > > Oh, that sounds suspiciously familiar:
> > >
> > > RCS file: /cvsroot/src/sys/arch/netwinder/conf/kern.ldscript,v
> >
> > See also:
> >
> > http://mail-index.netbsd.org/tech-toolchain/2003/06/10/0012.html
>
> It certainly looks like the issue, looking at the numbers again:
> Sections:
> Idx Name Size VMA LMA File off Algn
> 0 .text 0023bf43 f0000020 f0000020 00008020 2**5
> CONTENTS, ALLOC, LOAD, READONLY, CODE
> 1 link_set_malloc_types 00000120 f023bf64 f023bf64 00243f64 2**2
> CONTENTS, ALLOC, LOAD, READONLY, DATA
> 2 link_set_sysctl_funcs 0000008c f023c084 f023c084 00244084 2**2
> CONTENTS, ALLOC, LOAD, READONLY, DATA
> 3 link_set_evcnts 00000004 f023c110 f023c110 00244110 2**2
> CONTENTS, ALLOC, LOAD, READONLY, DATA
> 4 .data 000462c0 f023d000 f023d000 00245000 2**2
> CONTENTS, ALLOC, LOAD, DATA
>
> The maths currently works out that it's actually:
> f0000020 + 0023bf43 = f0023bf63
> Rounding up to the nearest page makes it f0023c000.
>
> However, the cats kern.ldscript isn't using SIZEOF. perhaps the issue
> is that it doesn't list the link_set* sections in it's .text section?
It's probably similar, but it's not the same. As Chris said, the ldscript
doesn't use SIZEOF, and anyway, the resulting image is correct. The
problems start when we try to translate it into an a.out file.
R.