Re: [PATCH 1/1] POWERPC: Fix ppc32 compile with gcc+SSP in 2.6.16

From: John Mylchreest
Date: Tue Apr 04 2006 - 04:57:46 EST


On Sun, Apr 02, 2006 at 01:42:15PM +0200, Olaf Hering <olh@xxxxxxx> wrote:
> On Sun, Apr 02, John Mylchreest wrote:
>
> > Going from that, I can push a patch for gcc upstream to remove the
> > __KERNEL__ dep, but gcc4.1 ships with ssp by standard, and the semantics
> > between the IBM patch for SSP applied to gcc-3 and ggc-4 have changed.
>
> gcc4.1 has no obvious problems with --enable-ssp
>
> > -fno-stack-protector would work for gcc4, but for gcc3 it could still be
> > patially enabled, and requires -fno-stack-protector-all. Mind If I ask
> > whats incorrect about defining __KERNEL__ for the bootcflags?
>
> arch/powerpc/boot is no kernel code, its supposed to be selfcontained.
> Prepare a patch which uses the cc-option macro.

As requested, please see attached a small patch which rectifies this
with negating cflags. The cc-option macro won't always work, and as such
I have declared a new macro to honour $(CROSS32CC).

Thoughts welcome,
John

--
Role: Gentoo Linux Kernel Lead
Gentoo Linux: http://www.gentoo.org
Public Key: gpg --recv-keys 9C745515
Key fingerprint: A0AF F3C8 D699 A05A EC5C 24F7 95AA 241D 9C74 5515

--- a/arch/powerpc/boot/Makefile 2006-04-03 17:33:44.000000000 +0000
+++ b/arch/powerpc/boot/aMakefile 2006-04-04 08:51:13.000000000 +0000
@@ -21,9 +21,19 @@
# in the toplevel makefile.


+# cc-option-crosscc
+# We can't rely on the host compiler in this situation, so we define
+# a modified cc-option macro for this task.
+# Usage: cflags-y += $(call cc-option-crosscc, -march=winchip-c6, -march=i586)
+
+cc-option-crosscc = $(shell if $(CROSS32CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
+ > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
+
HOSTCC := gcc
BOOTCFLAGS := $(HOSTCFLAGS) -fno-builtin -nostdinc -isystem \
- $(shell $(CROSS32CC) -print-file-name=include) -fPIC
+ $(shell $(CROSS32CC) -print-file-name=include) -fPIC \
+ $(call cc-option-crosscc, -fno-stack-protector) \
+ $(call cc-option-crosscc, -fno-stack-protector-all)
BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc
OBJCOPYFLAGS := contents,alloc,load,readonly,data
OBJCOPY_COFF_ARGS := -O aixcoff-rs6000 --set-start 0x500000

Attachment: pgp00000.pgp
Description: PGP signature