tech-toolchain archive

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

Re: amd64 kernels and text address



On 27-Mar-2008 Julio M. Merino Vidal wrote:
> Hmm, I don't see what the trick is in ofwstart.S.  Could you clarify,  
> please?

Well, since you can't position a note at the top of the file, I embedded the
"note" in the text section before start. (ppc ofw looks for a note section for
multiboot)

> Also, in the ldscript, I notice that you generated it using the -N  
> flag.  If I use this same flag to create the amd64 kernel, then the  
> text section is properly positioned at the beginning of the file.

Right, -N basically condenses the output, so that rather than doing an offset
of 0x100000 by placing 0's in there, it just marks the offset in the ELF
headers and assumes the loader does the right thing.

> However, I have made ld dump the default linker script and the one  
> used when -N is given, diffed the two scripts, and the differences  
> are minimal: i.e. I can't see anything that justifies the huge  
> difference in the location of .text in the resulting image :-(  Do  
> you know what exactly you used to make it work?  I assume that -N is  
> not OK for kernels due to its explanation.

I think N does have some addtional side effects, which are probably
undesirable.  It's been a bit since I looked at the scripts, but there is
something in the normal script that causes the offset to occur.  I think a .=
or similar.  The manpage entry for -N is true, but I think it's missing some
information about what it does in addition to what is listed.

---
Tim Rightnour <root%garbled.net@localhost>
NetBSD: Free multi-architecture OS http://www.netbsd.org/
Genecys: Open Source 3D MMORPG: http://www.genecys.org/


Home | Main Index | Thread Index | Old Index