linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb.auug.org.au>
To: Matt Fleming <matt.fleming@intel.com>
Cc: "H. Peter Anvin" <hpa@linux.intel.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: build failure in Linus' tree with gcc 4.4.3
Date: Mon, 20 Feb 2012 14:22:08 +1100	[thread overview]
Message-ID: <20120220142208.ab97f13b9ade345402d054fb@canb.auug.org.au> (raw)
In-Reply-To: <20120220133936.936bff0d5817ac609a5211e0@canb.auug.org.au>

[-- Attachment #1: Type: text/plain, Size: 3000 bytes --]

Hi all,

On Mon, 20 Feb 2012 13:39:36 +1100 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> Hi all,
> 
> My x86_64 allmodconfig build fail like this:
> 
>   OBJCOPY arch/x86/boot/vmlinux.bin
>   AS      arch/x86/boot/header.o
>   LD      arch/x86/boot/setup.elf
>   OBJCOPY arch/x86/boot/setup.bin
>   BUILD   arch/x86/boot/bzImage
> Setup is 14768 bytes (padded to 14848 bytes).
> System is 4766 kB
> /bin/sh: line 1: 20126 Segmentation fault      arch/x86/boot/tools/build arch/x86/boot/setup.bin arch/x86/boot/vmlinux.bin > arch/x86/boot/bzImage
> 
> I have bisected it down to commit
> 291f36325f9f252bd76ef5f603995f37e453fc60 ("x86, efi: EFI boot stub
> support").  This may well be a compiler bug that this commit just happens
> to poke.
> 
> The toolchain is PowerPC hosted cross tools:
> x86_64-linux-gcc (GCC) 4.4.3
> GNU ld (GNU Binutils) 2.20
> 
> I tried an allmodconfig build with my native compiler (gcc (Debian
> 4.6.2-14) 4.6.2, GNU gold (GNU Binutils for Debian 2.22) 1.11) and it
> worked fine.
> 
> That is a large commit, so I am not sure where to go from here.

Actually, that commit does the following:

diff --git a/arch/x86/boot/tools/build.c b/arch/x86/boot/tools/build.c
index fdc60a0..4e9bd6b 100644
--- a/arch/x86/boot/tools/build.c
+++ b/arch/x86/boot/tools/build.c
@@ -135,6 +135,9 @@ static void usage(void)
 
 int main(int argc, char ** argv)
 {
+#ifdef CONFIG_EFI_STUB
+	unsigned int file_sz, pe_header;
+#endif
 	unsigned int i, sz, setup_sectors;
 	int c;
 	u32 sys_size;
@@ -194,6 +197,42 @@ int main(int argc, char ** argv)
 	buf[0x1f6] = sys_size >> 16;
 	buf[0x1f7] = sys_size >> 24;
 
+#ifdef CONFIG_EFI_STUB
+	file_sz = sz + i + ((sys_size * 16) - sz);
+
+	pe_header = *(unsigned int *)&buf[0x3c];
+
+	/* Size of code */
+	*(unsigned int *)&buf[pe_header + 0x1c] = file_sz;
+
+	/* Size of image */
+	*(unsigned int *)&buf[pe_header + 0x50] = file_sz;
+
+#ifdef CONFIG_X86_32
+	/* Address of entry point */
+	*(unsigned int *)&buf[pe_header + 0x28] = i;
+
+	/* .text size */
+	*(unsigned int *)&buf[pe_header + 0xb0] = file_sz;
+
+	/* .text size of initialised data */
+	*(unsigned int *)&buf[pe_header + 0xb8] = file_sz;
+#else
+	/*
+	 * Address of entry point. startup_32 is at the beginning and
+	 * the 64-bit entry point (startup_64) is always 512 bytes
+	 * after.
+	 */
+	*(unsigned int *)&buf[pe_header + 0x28] = i + 512;
+
+	/* .text size */
+	*(unsigned int *)&buf[pe_header + 0xc0] = file_sz;
+
+	/* .text size of initialised data */
+	*(unsigned int *)&buf[pe_header + 0xc8] = file_sz;
+#endif /* CONFIG_X86_32 */
+#endif /* CONFIG_EFI_STUB */
+
 	crc = partial_crc32(buf, i, crc);
 	if (fwrite(buf, 1, i, stdout) != i)
 		die("Writing setup failed");

Which is all endian specific code that will run on the host when building
the kernel ...

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2012-02-20  3:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-20  2:39 build failure in Linus' tree with gcc 4.4.3 Stephen Rothwell
2012-02-20  3:22 ` Stephen Rothwell [this message]
2012-02-20  9:43   ` Matt Fleming
2012-02-21 10:01     ` Matt Fleming
2012-02-21 10:38       ` Stephen Rothwell
2012-02-21 11:32         ` Matt Fleming
2012-02-21 11:51           ` Stephen Rothwell
2012-02-21 11:58             ` Matt Fleming

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120220142208.ab97f13b9ade345402d054fb@canb.auug.org.au \
    --to=sfr@canb.auug.org.au \
    --cc=hpa@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt.fleming@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).