* Don't use HOSTCFLAGS in BOOTCFLAGS
@ 2007-05-29 3:29 David Gibson
2007-05-29 5:12 ` Segher Boessenkool
0 siblings, 1 reply; 7+ messages in thread
From: David Gibson @ 2007-05-29 3:29 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev
In the bootwrapper code for powerpc, we include HOSTCFLAGS into the
BOOTCFLAGS used for buildinf the zImage wrapper code. Since the
wrapper code is not host code, this makes no sense. This patch
removes the use of HOSTCFLAGS here, instead including directly into
BOOTCFLAGS those flags from the normal kernel CFLAGS which also make
sense in the bootwrapper code.
In particular, this makes the bootwrapper use -msoft-float, preventing
the compiler from generating floating point instructions. Previously,
under some circumstances the compiler could generate floating point
instructions in the bootwrapper which would cause exceptions on
embedded CPUS which don't have floating point support.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Index: working-2.6/arch/powerpc/boot/Makefile
===================================================================
--- working-2.6.orig/arch/powerpc/boot/Makefile 2007-05-28 16:29:34.000000000 +1000
+++ working-2.6/arch/powerpc/boot/Makefile 2007-05-28 16:29:56.000000000 +1000
@@ -11,7 +11,7 @@
# bootloader and increase compatibility with OpenFirmware.
#
# To this end we need to define BOOTCC, etc, as the tools
-# needed to build the 32 bit image. These are normally HOSTCC,
+# needed to build the 32 bit image.
# but may be a third compiler if, for example, you are cross
# compiling from an intel box. Once the 64bit ppc gcc is
# stable it will probably simply be a compiler switch to
@@ -22,9 +22,11 @@
all: $(obj)/zImage
-HOSTCC := gcc
-BOOTCFLAGS := $(HOSTCFLAGS) -fno-builtin -fno-unit-at-a-time -nostdinc -isystem \
- $(shell $(CROSS32CC) -print-file-name=include) -fPIC
+BOOTCFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
+ -fno-strict-aliasing -O2 -msoft-float -pipe \
+ -fomit-frame-pointer -fno-builtin -fno-unit-at-a-time \
+ -fPIC -nostdinc \
+ -isystem $(shell $(CROSS32CC) -print-file-name=include)
BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc
ifeq ($(call cc-option-yn, -fstack-protector),y)
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Don't use HOSTCFLAGS in BOOTCFLAGS
2007-05-29 3:29 David Gibson
@ 2007-05-29 5:12 ` Segher Boessenkool
2007-05-29 5:34 ` David Gibson
0 siblings, 1 reply; 7+ messages in thread
From: Segher Boessenkool @ 2007-05-29 5:12 UTC (permalink / raw)
To: David Gibson; +Cc: linuxppc-dev, Paul Mackerras
> # To this end we need to define BOOTCC, etc, as the tools
> -# needed to build the 32 bit image. These are normally HOSTCC,
> +# needed to build the 32 bit image.
> # but may be a third compiler if, for example, you are cross
You've broken this comment, you should pay for it now :-)
> -HOSTCC := gcc
> -BOOTCFLAGS := $(HOSTCFLAGS) -fno-builtin -fno-unit-at-a-time
> -nostdinc -isystem \
> - $(shell $(CROSS32CC) -print-file-name=include) -fPIC
> +BOOTCFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
> + -fno-strict-aliasing -O2 -msoft-float -pipe \
-Os instead?
> + -fomit-frame-pointer -fno-builtin -fno-unit-at-a-time \
Why -fno-unit-at-a-time ?
> + -fPIC -nostdinc \
> + -isystem $(shell $(CROSS32CC) -print-file-name=include)
Also, is there any reason why you can't simply use $(CC) -m32 with
the kernel $(CFLAGS) ?
Segher
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Don't use HOSTCFLAGS in BOOTCFLAGS
2007-05-29 5:12 ` Segher Boessenkool
@ 2007-05-29 5:34 ` David Gibson
2007-05-29 6:26 ` Segher Boessenkool
0 siblings, 1 reply; 7+ messages in thread
From: David Gibson @ 2007-05-29 5:34 UTC (permalink / raw)
To: Segher Boessenkool; +Cc: linuxppc-dev, Paul Mackerras
On Tue, May 29, 2007 at 07:12:21AM +0200, Segher Boessenkool wrote:
> > # To this end we need to define BOOTCC, etc, as the tools
> > -# needed to build the 32 bit image. These are normally HOSTCC,
> > +# needed to build the 32 bit image.
> > # but may be a third compiler if, for example, you are cross
>
> You've broken this comment, you should pay for it now :-)
Eck, yes.
> > -HOSTCC := gcc
> > -BOOTCFLAGS := $(HOSTCFLAGS) -fno-builtin -fno-unit-at-a-time
> > -nostdinc -isystem \
> > - $(shell $(CROSS32CC) -print-file-name=include) -fPIC
> > +BOOTCFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
> > + -fno-strict-aliasing -O2 -msoft-float -pipe \
>
> -Os instead?
Hrm, yeah, that's probably a good idea.
> > + -fomit-frame-pointer -fno-builtin -fno-unit-at-a-time \
>
> Why -fno-unit-at-a-time ?
Crap. Because I forgot that the patch stack I was working on had my
patch which adds -fno-unit-at-a-time (I often use that when debugging,
because it makes the disassembly more comprehensible). In fact
without that patch, this one doesn't apply.
> > + -fPIC -nostdinc \
> > + -isystem $(shell $(CROSS32CC) -print-file-name=include)
>
> Also, is there any reason why you can't simply use $(CC) -m32 with
> the kernel $(CFLAGS) ?
I did think about that. But the kernel CFLAGS does includes
-ffixed-r2 and -Iarch/powerpc which I don't think we want here.
Revised version coming shortly.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply [flat|nested] 7+ messages in thread
* Don't use HOSTCFLAGS in BOOTCFLAGS
@ 2007-05-29 5:37 David Gibson
2007-05-29 14:21 ` Josh Boyer
0 siblings, 1 reply; 7+ messages in thread
From: David Gibson @ 2007-05-29 5:37 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev
In the bootwrapper code for powerpc, we include HOSTCFLAGS into the
BOOTCFLAGS used for buildinf the zImage wrapper code. Since the
wrapper code is not host code, this makes no sense. This patch
removes the use of HOSTCFLAGS here, instead including directly into
BOOTCFLAGS those flags from the normal kernel CFLAGS which also make
sense in the bootwrapper code.
In particular, this makes the bootwrapper use -msoft-float, preventing
the compiler from generating floating point instructions. Previously,
under some circumstances the compiler could generate floating point
instructions in the bootwrapper which would cause exceptions on
embedded CPUS which don't have floating point support.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Index: working-2.6/arch/powerpc/boot/Makefile
===================================================================
--- working-2.6.orig/arch/powerpc/boot/Makefile 2007-05-29 15:22:07.000000000 +1000
+++ working-2.6/arch/powerpc/boot/Makefile 2007-05-29 15:31:30.000000000 +1000
@@ -11,20 +11,18 @@
# bootloader and increase compatibility with OpenFirmware.
#
# To this end we need to define BOOTCC, etc, as the tools
-# needed to build the 32 bit image. These are normally HOSTCC,
-# but may be a third compiler if, for example, you are cross
-# compiling from an intel box. Once the 64bit ppc gcc is
-# stable it will probably simply be a compiler switch to
-# compile for 32bit mode.
+# needed to build the 32 bit image. That's normally the same
+# compiler for the rest of the kernel, with the -m32 flag added.
# To make it easier to setup a cross compiler,
# CROSS32_COMPILE is setup as a prefix just like CROSS_COMPILE
# in the toplevel makefile.
all: $(obj)/zImage
-HOSTCC := gcc
-BOOTCFLAGS := $(HOSTCFLAGS) -fno-builtin -nostdinc -isystem \
- $(shell $(CROSS32CC) -print-file-name=include) -fPIC
+BOOTCFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
+ -fno-strict-aliasing -Os -msoft-float -pipe \
+ -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \
+ -isystem $(shell $(CROSS32CC) -print-file-name=include)
BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc
ifeq ($(call cc-option-yn, -fstack-protector),y)
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Don't use HOSTCFLAGS in BOOTCFLAGS
2007-05-29 5:34 ` David Gibson
@ 2007-05-29 6:26 ` Segher Boessenkool
2007-05-29 6:33 ` David Gibson
0 siblings, 1 reply; 7+ messages in thread
From: Segher Boessenkool @ 2007-05-29 6:26 UTC (permalink / raw)
To: David Gibson; +Cc: linuxppc-dev, Paul Mackerras
>> Also, is there any reason why you can't simply use $(CC) -m32 with
>> the kernel $(CFLAGS) ?
>
> I did think about that. But the kernel CFLAGS does includes
> -ffixed-r2 and -Iarch/powerpc which I don't think we want here.
Both of these should be fairly harmless. But sure, it
is cleaner to have separate flags -- the booter and the
kernel run in different environments, after all.
Segher
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Don't use HOSTCFLAGS in BOOTCFLAGS
2007-05-29 6:26 ` Segher Boessenkool
@ 2007-05-29 6:33 ` David Gibson
0 siblings, 0 replies; 7+ messages in thread
From: David Gibson @ 2007-05-29 6:33 UTC (permalink / raw)
To: Segher Boessenkool; +Cc: linuxppc-dev, Paul Mackerras
On Tue, May 29, 2007 at 08:26:49AM +0200, Segher Boessenkool wrote:
> >> Also, is there any reason why you can't simply use $(CC) -m32 with
> >> the kernel $(CFLAGS) ?
> >
> > I did think about that. But the kernel CFLAGS does includes
> > -ffixed-r2 and -Iarch/powerpc which I don't think we want here.
>
> Both of these should be fairly harmless. But sure, it
> is cleaner to have separate flags -- the booter and the
> kernel run in different environments, after all.
Well, the -I is potentially dangerous, because it allows people to get
away with header file dependecies outside the booter specific headers.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Don't use HOSTCFLAGS in BOOTCFLAGS
2007-05-29 5:37 Don't use HOSTCFLAGS in BOOTCFLAGS David Gibson
@ 2007-05-29 14:21 ` Josh Boyer
0 siblings, 0 replies; 7+ messages in thread
From: Josh Boyer @ 2007-05-29 14:21 UTC (permalink / raw)
To: David Gibson; +Cc: linuxppc-dev, Paul Mackerras
On Tue, 2007-05-29 at 15:37 +1000, David Gibson wrote:
> In the bootwrapper code for powerpc, we include HOSTCFLAGS into the
> BOOTCFLAGS used for buildinf the zImage wrapper code. Since the
> wrapper code is not host code, this makes no sense. This patch
> removes the use of HOSTCFLAGS here, instead including directly into
> BOOTCFLAGS those flags from the normal kernel CFLAGS which also make
> sense in the bootwrapper code.
>
> In particular, this makes the bootwrapper use -msoft-float, preventing
> the compiler from generating floating point instructions. Previously,
> under some circumstances the compiler could generate floating point
> instructions in the bootwrapper which would cause exceptions on
> embedded CPUS which don't have floating point support.
This is essentially the cleanup Paul asked me to do of my original
-msoft-float addition. Matches the patch I have sitting locally that I
haven't gotten around to sending out yet.
>
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Acked-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2007-05-29 14:23 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-29 5:37 Don't use HOSTCFLAGS in BOOTCFLAGS David Gibson
2007-05-29 14:21 ` Josh Boyer
-- strict thread matches above, loose matches on Subject: below --
2007-05-29 3:29 David Gibson
2007-05-29 5:12 ` Segher Boessenkool
2007-05-29 5:34 ` David Gibson
2007-05-29 6:26 ` Segher Boessenkool
2007-05-29 6:33 ` David Gibson
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).