Subject: Re: current kernel unbootable + fix
To: Valeriy E. Ushakov <uwe@ptc.spbu.ru>
From: Jason Thorpe <thorpej@wasabisystems.com>
List: port-hpcsh
Date: 04/15/2003 09:56:02
On Sunday, April 13, 2003, at 08:17  PM, Valeriy E. Ushakov wrote:

> When kernel is linked, ld issues warnings that there are no suitable
> memory region for link_set_* sections and put them at 0x0.  This
> happens because sys/arch/hpcsh/conf/shl-elf.x defines memory region
> "ram" and explicitly places output .text and .data sections into that
> region.

Yah.  But link_set_* should be sorted with .text or .rodata by the 
linker... hm...

> But link_set_* sections are not mentioned in the script and when ld
> copies those sections from its input to output it doesn't consider
> "ram" region as suitable for those sections.

Right, you can't explicitly mention link_set_* in the linker script, 
because if you do, the start-of-section/end-of-section special marker 
symbols go away, which breaks actually *using* the link sets :-)

> I fixed the problem with adding (rwx) attributes to the "ram" section.
> The resulting kernel boots fine.  I'm not sure if it's a proper fixm
> though.  Can someone with more ld clue look into this?  Jason?

Hm.  That solution will work.  Look at 
sys/arch/evbarm/conf/ldscript.evbarm for another way that the problem 
can be solved.

Sadly, the linker script syntax doesn't deal well with these 
"anonymous" sections that link sets use.  When I attempted to deal with 
this in ldd itself, my changes to make the linker scripts more friendly 
to these sections were soundly rejected.  So, I think we're stuck with 
annoying work-arounds such as yours and mine.

         -- Jason R. Thorpe <thorpej@wasabisystems.com>