This is the mail archive of the
mailing list for the binutils project.
Re: Help needed to track down bug: linking Linux kernel with gold creates unbootable kernel
On Thu, Apr 22, 2010 at 2:10 PM, H.J. Lu <firstname.lastname@example.org> wrote:
> On Mon, Apr 12, 2010 at 10:27 PM, Ian Lance Taylor <email@example.com> wrote:
>> John Reiser <firstname.lastname@example.org> 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
If gold should be compatible with ld, this patch should be applied.
diff --git a/gold/x86_64.cc b/gold/x86_64.cc
index 9110278..99be4de 100644
@@ -516,7 +516,7 @@ const Target::Target_info Target_x86_64::x86_64_info =
'\0', // wrap_char
"/lib/ld64.so.1", // program interpreter
0x400000, // default_text_segment_address
- 0x1000, // abi_pagesize (overridable by -z max-page-size)
+ 0x200000, // abi_pagesize (overridable by -z max-page-size)
0x1000, // common_pagesize (overridable by -z common-page-size)
elfcpp::SHN_UNDEF, // small_common_shndx
elfcpp::SHN_X86_64_LCOMMON, // large_common_shndx