public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] allow kernel compile with native ppc64 compiler
@ 2004-10-17 18:55 Olaf Hering
  2004-10-17 21:46 ` Paul Mackerras
  0 siblings, 1 reply; 7+ messages in thread
From: Olaf Hering @ 2004-10-17 18:55 UTC (permalink / raw)
  To: linuxppc64-dev; +Cc: Andrew Morton, linux-kernel


The zImage is a 32bit binary, but a native powerpc64-linux gcc will
produce 64bit objects in arch/ppc64/boot.
This patch fixes it.

Signed-off-by: Olaf Hering <olh@suse.de>

diff -purN linux-2.6.9-final/arch/ppc64/boot/Makefile linux-2.6.9-final.native/arch/ppc64/boot/Makefile
--- linux-2.6.9-final/arch/ppc64/boot/Makefile	2004-10-16 03:03:50.000000000 +0000
+++ linux-2.6.9-final.native/arch/ppc64/boot/Makefile	2004-10-17 18:44:33.229249956 +0000
@@ -23,14 +23,14 @@
 CROSS32_COMPILE ?=
 #CROSS32_COMPILE = /usr/local/ppc/bin/powerpc-linux-
 
-BOOTCC		:= $(CROSS32_COMPILE)gcc
+BOOTCC		:= $(CROSS32_COMPILE)gcc -m32
 HOSTCC		:= gcc
 BOOTCFLAGS	:= $(HOSTCFLAGS) $(LINUXINCLUDE) -fno-builtin 
-BOOTAS		:= $(CROSS32_COMPILE)as
+BOOTAS		:= $(CROSS32_COMPILE)as -a32
 BOOTAFLAGS	:= -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional
-BOOTLD		:= $(CROSS32_COMPILE)ld
+BOOTLD		:= $(CROSS32_COMPILE)ld -m elf32ppc
 BOOTLFLAGS	:= -Ttext 0x00400000 -e _start -T $(srctree)/$(src)/zImage.lds
-BOOTOBJCOPY	:= $(CROSS32_COMPILE)objcopy
+BOOTOBJCOPY	:= $(CROSS32_COMPILE)objcopy --target elf32-powerpc
 OBJCOPYFLAGS    := contents,alloc,load,readonly,data
 
 src-boot := crt0.S string.S prom.c main.c zlib.c imagesize.c div64.S
diff -purN linux-2.6.9-final/arch/ppc64/boot/zImage.lds linux-2.6.9-final.native/arch/ppc64/boot/zImage.lds
--- linux-2.6.9-final/arch/ppc64/boot/zImage.lds	2004-10-16 03:01:55.000000000 +0000
+++ linux-2.6.9-final.native/arch/ppc64/boot/zImage.lds	2004-10-17 18:48:14.824288338 +0000
@@ -1,4 +1,4 @@
-OUTPUT_ARCH(powerpc)
+OUTPUT_ARCH(powerpc:common)
 SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib);
 /* Do we need any of these for elf?
    __DYNAMIC = 0;    */
-- 
USB is for mice, FireWire is for men!

sUse lINUX ag, nÜRNBERG

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] allow kernel compile with native ppc64 compiler
  2004-10-17 18:55 [PATCH] allow kernel compile with native ppc64 compiler Olaf Hering
@ 2004-10-17 21:46 ` Paul Mackerras
  2004-10-18  4:56   ` Olaf Hering
  0 siblings, 1 reply; 7+ messages in thread
From: Paul Mackerras @ 2004-10-17 21:46 UTC (permalink / raw)
  To: Olaf Hering; +Cc: linuxppc64-dev, Andrew Morton, linux-kernel

Olaf Hering writes:

> The zImage is a 32bit binary, but a native powerpc64-linux gcc will
> produce 64bit objects in arch/ppc64/boot.
> This patch fixes it.

... and breaks the compile on older toolchains that don't understand
-m32.  We need to make the -m32 conditional on HAS_BIARCH as defined
in arch/ppc64/Makefile.

Paul.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] allow kernel compile with native ppc64 compiler
  2004-10-17 21:46 ` Paul Mackerras
@ 2004-10-18  4:56   ` Olaf Hering
  2004-10-18  5:55     ` Paul Mackerras
  0 siblings, 1 reply; 7+ messages in thread
From: Olaf Hering @ 2004-10-18  4:56 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc64-dev, Andrew Morton, linux-kernel

 On Mon, Oct 18, Paul Mackerras wrote:

> Olaf Hering writes:
> 
> > The zImage is a 32bit binary, but a native powerpc64-linux gcc will
> > produce 64bit objects in arch/ppc64/boot.
> > This patch fixes it.
> 
> ... and breaks the compile on older toolchains that don't understand
> -m32.  We need to make the -m32 conditional on HAS_BIARCH as defined
> in arch/ppc64/Makefile.

how old?

-- 
USB is for mice, FireWire is for men!

sUse lINUX ag, nÜRNBERG

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] allow kernel compile with native ppc64 compiler
  2004-10-18  4:56   ` Olaf Hering
@ 2004-10-18  5:55     ` Paul Mackerras
  2004-10-18  7:54       ` Olaf Hering
  0 siblings, 1 reply; 7+ messages in thread
From: Paul Mackerras @ 2004-10-18  5:55 UTC (permalink / raw)
  To: Olaf Hering; +Cc: linuxppc64-dev, Andrew Morton, linux-kernel

Olaf Hering writes:

> > ... and breaks the compile on older toolchains that don't understand
> > -m32.  We need to make the -m32 conditional on HAS_BIARCH as defined
> > in arch/ppc64/Makefile.
> 
> how old?

The gcc that comes with debian sid doesn't understand -m32.  That's a
32-bit gcc, which means that I set CROSS_COMPILE when doing a ppc64
kernel compile.  With your patch I have to set CROSS32_COMPILE as
well, which seems silly when I'm compiling on a ppc32 box already.

Ben H suggested making the default BOOTCC be $(CC) -m32, which makes
sense to me.

Paul.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] allow kernel compile with native ppc64 compiler
  2004-10-18  5:55     ` Paul Mackerras
@ 2004-10-18  7:54       ` Olaf Hering
  2004-10-18 10:58         ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 7+ messages in thread
From: Olaf Hering @ 2004-10-18  7:54 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc64-dev, Andrew Morton, linux-kernel

 On Mon, Oct 18, Paul Mackerras wrote:

> Olaf Hering writes:
> 
> > > ... and breaks the compile on older toolchains that don't understand
> > > -m32.  We need to make the -m32 conditional on HAS_BIARCH as defined
> > > in arch/ppc64/Makefile.
> > 
> > how old?
> 
> The gcc that comes with debian sid doesn't understand -m32.  That's a
> 32-bit gcc, which means that I set CROSS_COMPILE when doing a ppc64
> kernel compile.  With your patch I have to set CROSS32_COMPILE as
> well, which seems silly when I'm compiling on a ppc32 box already.

Makes sense, I confused a native powerpc64-linux gcc from last century
with a native/cross powerpc-linux gcc from last century.

> Ben H suggested making the default BOOTCC be $(CC) -m32, which makes
> sense to me.

That may break cross compile. I will provide a new patch.

-- 
USB is for mice, FireWire is for men!

sUse lINUX ag, nÜRNBERG

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] allow kernel compile with native ppc64 compiler
  2004-10-18  7:54       ` Olaf Hering
@ 2004-10-18 10:58         ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 7+ messages in thread
From: Benjamin Herrenschmidt @ 2004-10-18 10:58 UTC (permalink / raw)
  To: Olaf Hering
  Cc: Paul Mackerras, Andrew Morton, linuxppc64-dev, Linux Kernel list

On Mon, 2004-10-18 at 17:54, Olaf Hering wrote:

> 
> > Ben H suggested making the default BOOTCC be $(CC) -m32, which makes
> > sense to me.

How so ? The idea is to add -m32 to whatever compiler you are using for
the rest of the kernel (assuming bi-arch) which is a lot more sane than
using whatever _local_ compiler you are using _and_ assuming bi-arch...

Of course, that would only be the "defaul", with the ability of explicitly
passing CROSS32_COMPILE to make...

Ben.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] allow kernel compile with native ppc64 compiler
       [not found] ` <2Qr4K-2P8-15@gated-at.bofh.it>
@ 2004-10-18 16:23   ` Andi Kleen
  0 siblings, 0 replies; 7+ messages in thread
From: Andi Kleen @ 2004-10-18 16:23 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linux-kernel, olh

Paul Mackerras <paulus@samba.org> writes:

> Olaf Hering writes:
>
>> The zImage is a 32bit binary, but a native powerpc64-linux gcc will
>> produce 64bit objects in arch/ppc64/boot.
>> This patch fixes it.
>
> ... and breaks the compile on older toolchains that don't understand
> -m32.  We need to make the -m32 conditional on HAS_BIARCH as defined
> in arch/ppc64/Makefile.

Wouldn't it be more user friendly to use $(call check_gcc,-m32,) ? 

-Andi


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-10-18 16:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-17 18:55 [PATCH] allow kernel compile with native ppc64 compiler Olaf Hering
2004-10-17 21:46 ` Paul Mackerras
2004-10-18  4:56   ` Olaf Hering
2004-10-18  5:55     ` Paul Mackerras
2004-10-18  7:54       ` Olaf Hering
2004-10-18 10:58         ` Benjamin Herrenschmidt
     [not found] <2Qoqo-Ou-41@gated-at.bofh.it>
     [not found] ` <2Qr4K-2P8-15@gated-at.bofh.it>
2004-10-18 16:23   ` Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox