From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15444 invoked by alias); 22 Apr 2010 21:25:49 -0000 Received: (qmail 15430 invoked by uid 22791); 22 Apr 2010 21:25:48 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from bitwagon.com (HELO bitwagon.com) (74.82.39.175) by sourceware.org (qpsmtpd/0.43rc1) with SMTP; Thu, 22 Apr 2010 21:25:44 +0000 Received: from f11-64.local ([67.171.180.43]) by bitwagon.com for ; Thu, 22 Apr 2010 14:25:40 -0700 Message-ID: <4BD0BEC8.8050609@bitwagon.com> Date: Thu, 22 Apr 2010 21:25:00 -0000 From: John Reiser User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100330 Fedora/3.0.4-1.fc11 Thunderbird/3.0.4 MIME-Version: 1.0 To: binutils@sourceware.org Subject: Re: Help needed to track down bug: linking Linux kernel with gold creates unbootable kernel References: <4BBF7F0B.10508@gmail.com> <4BC07486.5070508@gmail.com> <4BC213FF.6090200@bitwagon.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2010-04/txt/msg00339.txt.bz2 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 > kernel. 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. --