* [PATCH 03/18] Set -msoft-float and assembler target options in the bootwrapper.
@ 2007-01-24 21:07 Scott Wood
2007-01-24 21:31 ` Segher Boessenkool
0 siblings, 1 reply; 4+ messages in thread
From: Scott Wood @ 2007-01-24 21:07 UTC (permalink / raw)
To: linuxppc-dev
Without -msoft-float, floating point state saving code can be executed
(at least with certain buggy versions of GCC, which don't clear bit 6 of
CR before calling a varargs function with no varargs parameters).
Without the assembler target option, the assembler will use the old
dedicated mftb/mftbu instructions, rather than mfspr. This causes the
boot to hang on e500, which doesn't have the dedicated instructions.
Signed-off-by: Scott Wood <scottwood@freescale.com>
---
arch/powerpc/Makefile | 1 +
arch/powerpc/boot/Makefile | 3 ++-
2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index a00fe72..2309cdf 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -118,6 +118,7 @@ cpu-as-$(CONFIG_E200) += -Wa,-me200
AFLAGS += $(cpu-as-y)
CFLAGS += $(cpu-as-y)
+export cpu-as-y
head-y := arch/powerpc/kernel/head_32.o
head-$(CONFIG_PPC64) := arch/powerpc/kernel/head_64.o
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 906b166..e95c1b0 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -24,7 +24,8 @@ all: $(obj)/zImage
HOSTCC := gcc
BOOTCFLAGS := $(HOSTCFLAGS) -fno-builtin -nostdinc -isystem \
- $(shell $(CROSS32CC) -print-file-name=include) -fPIC
+ $(shell $(CROSS32CC) -print-file-name=include) -fPIC \
+ $(cpu-as-y) -msoft-float
BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc
ifeq ($(call cc-option-yn, -fstack-protector),y)
--
1.4.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 03/18] Set -msoft-float and assembler target options in the bootwrapper.
2007-01-24 21:07 [PATCH 03/18] Set -msoft-float and assembler target options in the bootwrapper Scott Wood
@ 2007-01-24 21:31 ` Segher Boessenkool
2007-01-24 22:18 ` Scott Wood
0 siblings, 1 reply; 4+ messages in thread
From: Segher Boessenkool @ 2007-01-24 21:31 UTC (permalink / raw)
To: Scott Wood; +Cc: linuxppc-dev
> Without -msoft-float, floating point state saving code can be executed
> (at least with certain buggy versions of GCC, which don't clear bit
> 6 of
> CR before calling a varargs function with no varargs parameters).
I have a hard time understanding what this means. Can you
elaborate please?
> AFLAGS += $(cpu-as-y)
> CFLAGS += $(cpu-as-y)
> +export cpu-as-y
Maybe it would be better to export CFLAGS instead (on the
other hand, you might have to cut out some options from it
for 32-bit compiles, dunno).
Segher
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 03/18] Set -msoft-float and assembler target options in the bootwrapper.
2007-01-24 21:31 ` Segher Boessenkool
@ 2007-01-24 22:18 ` Scott Wood
2007-01-24 22:45 ` Segher Boessenkool
0 siblings, 1 reply; 4+ messages in thread
From: Scott Wood @ 2007-01-24 22:18 UTC (permalink / raw)
To: Segher Boessenkool; +Cc: linuxppc-dev
Segher Boessenkool wrote:
>> Without -msoft-float, floating point state saving code can be executed
>> (at least with certain buggy versions of GCC, which don't clear bit 6 of
>> CR before calling a varargs function with no varargs parameters).
>
>
> I have a hard time understanding what this means. Can you
> elaborate please?
The PowerPC ABI uses bit 6 of CR to indicate to a varargs function
whether one (or more) of the varargs parameters is floating point. This
is used (among other things) by the varargs function to determine
whether to save a floating point context. Normally, GCC will clear the
bit when calling a vararg function with integer-only parameters, but at
least some versions (I saw it on 3.4.3) will not touch the bit at all
when the varargs list is empty.
Since the functions in string.S use cr1 (which contains bit 6), this
caused a fault on e500 (which doesn't have a normal floating point unit)
when I called strcmp() followed by printf() of a bare string with no
other arguments.
>> AFLAGS += $(cpu-as-y)
>> CFLAGS += $(cpu-as-y)
>> +export cpu-as-y
>
>
> Maybe it would be better to export CFLAGS instead (on the
> other hand, you might have to cut out some options from it
> for 32-bit compiles, dunno).
That'd also bring in the normal Linux headers, which the bootwrapper
appears to be trying to avoid.
-Scott
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 03/18] Set -msoft-float and assembler target options in the bootwrapper.
2007-01-24 22:18 ` Scott Wood
@ 2007-01-24 22:45 ` Segher Boessenkool
0 siblings, 0 replies; 4+ messages in thread
From: Segher Boessenkool @ 2007-01-24 22:45 UTC (permalink / raw)
To: Scott Wood; +Cc: linuxppc-dev
>>> Without -msoft-float, floating point state saving code can be
>>> executed
>>> (at least with certain buggy versions of GCC, which don't clear
>>> bit 6 of
>>> CR before calling a varargs function with no varargs parameters).
>> I have a hard time understanding what this means. Can you
>> elaborate please?
>
> The PowerPC ABI uses bit 6 of CR to indicate to a varargs function
> whether one (or more) of the varargs parameters is floating point.
> This is used (among other things) by the varargs function to
> determine whether to save a floating point context. Normally, GCC
> will clear the bit when calling a vararg function with integer-only
> parameters, but at least some versions (I saw it on 3.4.3) will not
> touch the bit at all when the varargs list is empty.
Gotcha. Now, should a varargs function that doesn't get passed
any actual varargs use that bit at all? If not, the Linux printf()
(or some support function) is broken; if so, is this fixed in later
GCC versions? If not, please report it (http://gcc.gnu.org/bugzilla).
>>> AFLAGS += $(cpu-as-y)
>>> CFLAGS += $(cpu-as-y)
>>> +export cpu-as-y
>> Maybe it would be better to export CFLAGS instead (on the
>> other hand, you might have to cut out some options from it
>> for 32-bit compiles, dunno).
>
> That'd also bring in the normal Linux headers, which the
> bootwrapper appears to be trying to avoid.
Right. cpu-as-y is an ugly name to export though, let's use a
better name (that explains what it's for -- PLATFORM-AFLAGS or
something like that).
Segher
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-01-24 23:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-24 21:07 [PATCH 03/18] Set -msoft-float and assembler target options in the bootwrapper Scott Wood
2007-01-24 21:31 ` Segher Boessenkool
2007-01-24 22:18 ` Scott Wood
2007-01-24 22:45 ` Segher Boessenkool
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).