gold-linked dragonfly kernel unbootable, likely due to segment page size, alignment

John Marino binutils@marino.st
Sun Feb 19 17:05:00 GMT 2012


I have spent a few hours tweaking linker scripts to attempt to link a 
DragonFly BSD kernel that boots, but so far in vain.

I have attached readelf output for kernels built with gnu ld and gold to 
list the program headers, along with the version of the linker script 
I've been using.

This is the x86_64 platform, so the LOAD segment alignment of 0x200000 
is what we want, but gold stubbornly uses 0x1000 over 3 segments versus 
the desired 0x200000 over 2 segments.

I have:
1) Tried building gold with a max-page-size of 0x200000 hardcoded in 
x86_64.cc
2) Tried -z max-page-size=0x200000
3) Tried setting DATA_SEGMENT_ALIGN (0x200000, 0x200000) in the linker 
script

So far nothing has made any difference at all.  At first glance, it 
appears the linkers interpret differently what the minimum page size 
should be.

The other information which may be important is that the first LOAD 
segment of the gold-built kernel has flags of "R" whereas the ld-built 
first LOAD segment has flags of "R E".

I'm pretty sure the only reason the gold-linked kernel won't load is due 
to size and alignment of the LOAD SEGMENTS.  What setting can be used to 
force gold to create two 0x200000 segments like ld does?

John
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ldscript.x86_64.txt
URL: <https://sourceware.org/pipermail/binutils/attachments/20120219/ea070fa4/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: dfly64.segments.gold.txt
URL: <https://sourceware.org/pipermail/binutils/attachments/20120219/ea070fa4/attachment-0001.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: dfly64.segments.ld.txt
URL: <https://sourceware.org/pipermail/binutils/attachments/20120219/ea070fa4/attachment-0002.txt>


More information about the Binutils mailing list