This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Help needed to track down bug: linking Linux kernel with gold creates unbootable kernel

On 04/22/2010 02:10 PM, H.J. Lu wrote:
On Mon, Apr 12, 2010 at 10:27 PM, Ian Lance Taylor<> wrote:
John Reiser<> writes:

The differing .p_align values of 0x1000 vs 0x200000 indicate that
gold has a bug interpreting the commands from the linker script
for alignment of Elf64_Phdr.

It is perhaps worth noting that for x86_64 gold by default uses -z max-page-size 0x1000 whereas the default for GNU ld is -z max-page-size 0x200000. While I haven't looked at the Linux linker script, perhaps it is assuming the latter.

Linux kernel linker scripts needs to align .rodata section to 2MB:

. = ALIGN((1<< 21));

Since gold can only align to 4K, gold can't be used on Linux

The linker script statement ". = ALIGN((1<< 21));" requires alignment to 2 MiB. If gold "can only align to 4 KiB", then gold must emit an error message upon processing input that requires a larger alignment. It is a bug that current gold does not emit such a message for this case.

It seems strange to me that "gold by default uses -z max-page-size 0x1000"
implies "gold cannot align to anything more than 0x1000".  At the minimum,
specifying "-z max-page-size 0x200000" ought to be a workaround here.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]