public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH][RFC] gcc3 arch options
@ 2002-05-27 15:00 J.A. Magallon
  2002-05-27 15:08 ` Thunder from the hill
  2002-05-27 15:18 ` David Woodhouse
  0 siblings, 2 replies; 8+ messages in thread
From: J.A. Magallon @ 2002-05-27 15:00 UTC (permalink / raw)
  To: Lista Linux-Kernel; +Cc: Alan Cox, Marcelo Tosatti

Hi.

Patch below adds support for newer gcc -march code generation options.
It adds options for pentium-mmx, pentium-pro, pentium2, pentium3 and pentium4.
(note: pII part depends or previous patch).
It just what Luca Barbieri did adding PII.

I have been running a PII optmized kernel on a dual PII@400 box and nothing
has broken for 2 days....

Patch follows:

--- linux-2.4.19-pre8-jam4/arch/i386/Makefile.orig	2002-05-26 11:39:23.000000000 +0200
+++ linux-2.4.19-pre8-jam4/arch/i386/Makefile	2002-05-26 11:43:06.000000000 +0200
@@ -43,23 +43,23 @@
 endif
 
 ifdef CONFIG_M586MMX
-CFLAGS += -march=i586
+CFLAGS += $(shell if $(CC) -march=pentium-mmx -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=pentium-mmx"; else echo "-march=i586"; fi)
 endif
 
 ifdef CONFIG_M686
-CFLAGS += -march=i686
+CFLAGS += $(shell if $(CC) -march=pentium-pro -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=pentium-pro; else echo "-march=i686"; fi)
 endif
 
 ifdef CONFIG_MPENTIUMII
-CFLAGS += -march=i686
+CFLAGS += $(shell if $(CC) -march=pentium2 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=pentium2"; else echo "-march=i686"; fi)
 endif
 
 ifdef CONFIG_MPENTIUMIII
-CFLAGS += -march=i686
+CFLAGS += $(shell if $(CC) -march=pentium3 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=pentium3"; else echo "-march=i686"; fi)
 endif
 
 ifdef CONFIG_MPENTIUM4
-CFLAGS += -march=i686
+CFLAGS += $(shell if $(CC) -march=pentium4 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=pentium4"; else echo "-march=i686"; fi)
 endif
 
 ifdef CONFIG_MK6


-- 
J.A. Magallon                           #  Let the source be with you...        
mailto:jamagallon@able.es
Mandrake Linux release 8.3 (Cooker) for i586
Linux werewolf 2.4.19-pre8-jam4 #2 SMP dom may 26 11:20:42 CEST 2002 i686

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

* Re: [PATCH][RFC] gcc3 arch options
  2002-05-27 15:00 [PATCH][RFC] gcc3 arch options J.A. Magallon
@ 2002-05-27 15:08 ` Thunder from the hill
  2002-05-27 15:18 ` David Woodhouse
  1 sibling, 0 replies; 8+ messages in thread
From: Thunder from the hill @ 2002-05-27 15:08 UTC (permalink / raw)
  To: J.A. Magallon; +Cc: Lista Linux-Kernel, Alan Cox, Marcelo Tosatti

Hi,

 ifdef CONFIG_M686
 CFLAGS += -march=i686
-CFLAGS += $(shell if $(CC) -march=pentium-pro -S -o /dev/null -xc > /dev/null >/dev/null 2>&1; then echo "-march=pentium-pro; else echo > "-march=i686"; fi)
+CFLAGS += $(shell if $(CC) -march=pentium-pro -S -o /dev/null -xc > /dev/null >/dev/null 2>&1; then echo "-march=pentium-pro"; else echo > "-march=i686"; fi)
 endif

Regards,
Thunder
-- 
Was it a black who passed along in the sand?
Was it a white who left his footprints?
Was it an african? An indian?
Sand says, 'twas human.


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

* Re: [PATCH][RFC] gcc3 arch options
  2002-05-27 15:00 [PATCH][RFC] gcc3 arch options J.A. Magallon
  2002-05-27 15:08 ` Thunder from the hill
@ 2002-05-27 15:18 ` David Woodhouse
  2002-05-27 15:47   ` Kai Germaschewski
  1 sibling, 1 reply; 8+ messages in thread
From: David Woodhouse @ 2002-05-27 15:18 UTC (permalink / raw)
  To: J.A. Magallon; +Cc: Lista Linux-Kernel, Alan Cox, Marcelo Tosatti


jamagallon@able.es said:
> +CFLAGS += $(shell if $(CC) -march=pentium-mmx -S -o /dev/null -xc /
> dev/null >/dev/null 2>&1; then echo "-march=pentium-mmx"; else echo
> "-march=i586"; fi)

Doesn't this run the shell command every time $(CFLAGS) is used?

--
dwmw2



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

* Re: [PATCH][RFC] gcc3 arch options
@ 2002-05-27 15:33 Thunder from the hill
  0 siblings, 0 replies; 8+ messages in thread
From: Thunder from the hill @ 2002-05-27 15:33 UTC (permalink / raw)
  To: Linux Kernel Mailing List

Hi,

On Mon, 27 May 2002, David Woodhouse wrote:
> jamagallon@able.es said:
> > +CFLAGS += $(shell if $(CC) -march=pentium-mmx -S -o /dev/null -xc /
> > dev/null >/dev/null 2>&1; then echo "-march=pentium-mmx"; else echo
> > "-march=i586"; fi)
> 
> Doesn't this run the shell command every time $(CFLAGS) is used?

It does. But I don'y know whether it is _TOO_ expensive, others do it as 
well. I think in the GCC compile we have it either.

However, we might better determine that in advance.

Regards,
Thunder
-- 
Was it a black who passed along in the sand?
Was it a white who left his footprints?
Was it an african? An indian?
Sand says, 'twas human.



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

* Re: [PATCH][RFC] gcc3 arch options
  2002-05-27 15:18 ` David Woodhouse
@ 2002-05-27 15:47   ` Kai Germaschewski
  2002-05-27 16:01     ` Thunder from the hill
  2002-05-27 21:42     ` J.A. Magallon
  0 siblings, 2 replies; 8+ messages in thread
From: Kai Germaschewski @ 2002-05-27 15:47 UTC (permalink / raw)
  To: David Woodhouse
  Cc: J.A. Magallon, Lista Linux-Kernel, Alan Cox, Marcelo Tosatti

On Mon, 27 May 2002, David Woodhouse wrote:

> jamagallon@able.es said:
> > +CFLAGS += $(shell if $(CC) -march=pentium-mmx -S -o /dev/null -xc /
> > dev/null >/dev/null 2>&1; then echo "-march=pentium-mmx"; else echo
> > "-march=i586"; fi)
> 
> Doesn't this run the shell command every time $(CFLAGS) is used?

CFLAGS is initially defined with ':=', which, as opposed to '=' means to 
evaluate directly and store the resulting string, so it should be fine. 

Even if it wasn't, only the evaluations from the top-level Makefile would
cause the command to be executed, make will always pass down the evaluated 
result to the subdir makes.

--Kai




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

* Re: [PATCH][RFC] gcc3 arch options
  2002-05-27 15:47   ` Kai Germaschewski
@ 2002-05-27 16:01     ` Thunder from the hill
  2002-05-27 21:42     ` J.A. Magallon
  1 sibling, 0 replies; 8+ messages in thread
From: Thunder from the hill @ 2002-05-27 16:01 UTC (permalink / raw)
  To: Kai Germaschewski; +Cc: Linux Kernel Mailing List

Hi,

On Mon, 27 May 2002, Kai Germaschewski wrote:
> CFLAGS is initially defined with ':=', which, as opposed to '=' means to 
> evaluate directly and store the resulting string, so it should be fine. 
> 
> Even if it wasn't, only the evaluations from the top-level Makefile would
> cause the command to be executed, make will always pass down the evaluated 
> result to the subdir makes.
> 
> --Kai

I've had an evaluation; it does not. So nothing to worry about

Regards,
Thunder
-- 
Was it a black who passed along in the sand?
Was it a white who left his footprints?
Was it an african? An indian?
Sand says, 'twas human.


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

* Re: [PATCH][RFC] gcc3 arch options
  2002-05-27 15:47   ` Kai Germaschewski
  2002-05-27 16:01     ` Thunder from the hill
@ 2002-05-27 21:42     ` J.A. Magallon
  2002-05-27 22:47       ` Kai Germaschewski
  1 sibling, 1 reply; 8+ messages in thread
From: J.A. Magallon @ 2002-05-27 21:42 UTC (permalink / raw)
  To: Kai Germaschewski
  Cc: David Woodhouse, Lista Linux-Kernel, Alan Cox, Marcelo Tosatti


On 2002.05.27 Kai Germaschewski wrote:
>On Mon, 27 May 2002, David Woodhouse wrote:
>
>> jamagallon@able.es said:
>> > +CFLAGS += $(shell if $(CC) -march=pentium-mmx -S -o /dev/null -xc /
>> > dev/null >/dev/null 2>&1; then echo "-march=pentium-mmx"; else echo
>> > "-march=i586"; fi)
>> 
>> Doesn't this run the shell command every time $(CFLAGS) is used?
>
>CFLAGS is initially defined with ':=', which, as opposed to '=' means to 
>evaluate directly and store the resulting string, so it should be fine. 
>
>Even if it wasn't, only the evaluations from the top-level Makefile would
>cause the command to be executed, make will always pass down the evaluated 
>result to the subdir makes.
>

It even does not depend on that. That is exactly the difference between
$(shell ) and backquoting.

Try this (with both = and :=):

# Makefile

A=
B=
#A:=
#B:=
A+=$(shell date)
B+=`date`

all:
    @echo "A="$(A)
    @sleep 2
    @echo "A="$(A)
    @sleep 2
    @echo "B="$(B)
    @sleep 2
    @echo "B="$(B)


-- 
J.A. Magallon                           #  Let the source be with you...        
mailto:jamagallon@able.es
Mandrake Linux release 8.3 (Cooker) for i586
Linux werewolf 2.4.19-pre8-jam4 #2 SMP dom may 26 11:20:42 CEST 2002 i686

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

* Re: [PATCH][RFC] gcc3 arch options
  2002-05-27 21:42     ` J.A. Magallon
@ 2002-05-27 22:47       ` Kai Germaschewski
  0 siblings, 0 replies; 8+ messages in thread
From: Kai Germaschewski @ 2002-05-27 22:47 UTC (permalink / raw)
  To: J.A. Magallon; +Cc: Lista Linux-Kernel

On Mon, 27 May 2002, J.A. Magallon wrote:

> >CFLAGS is initially defined with ':=', which, as opposed to '=' means to 
> >evaluate directly and store the resulting string, so it should be fine. 
> 
> It even does not depend on that. That is exactly the difference between
> $(shell ) and backquoting.
> 
> Try this (with both = and :=):
> 
> # Makefile
> 
> A=
> B=
> #A:=
> #B:=
> A+=$(shell date)
> B+=`date`
> 
> all:
>     @echo "A="$(A)
>     @sleep 2
>     @echo "A="$(A)
>     @sleep 2
>     @echo "B="$(B)
>     @sleep 2
>     @echo "B="$(B)

Actually, it makes a difference. Backquoting doesn't really have anything 
to do with the problem at all, since make doesn't understand it, it
just puts literally "`date`" into the variable, so you pass
echo "B="`date` to the shell, which will then to the substitution.

(Try

C = `echo all.c`

all: $(C)

it won't compile all, even if there is all.c - backquoting can only work
in the command part of a rule.)

Anyway, A= vs A:=, A += $(shell ...) behaves differently, as I 
conjectured. Example:

VAR =
#VAR :=
VAR += $(shell echo $$RANDOM)

all:
	@echo $(VAR)
	@echo $(VAR)


Not that it really matters...

--Kai






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

end of thread, other threads:[~2002-05-27 22:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-05-27 15:00 [PATCH][RFC] gcc3 arch options J.A. Magallon
2002-05-27 15:08 ` Thunder from the hill
2002-05-27 15:18 ` David Woodhouse
2002-05-27 15:47   ` Kai Germaschewski
2002-05-27 16:01     ` Thunder from the hill
2002-05-27 21:42     ` J.A. Magallon
2002-05-27 22:47       ` Kai Germaschewski
  -- strict thread matches above, loose matches on Subject: below --
2002-05-27 15:33 Thunder from the hill

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