Skip to contentSkip to conversation

gcc3 arch options

RFC PATCH In review J.A. Magallon 4 participants 7 messages May 27, 2002

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 gcc3 arch options

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:

arch/i386/Makefile renamed from arch/i386/Makefile.orig +5 -5
@@ -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
Signature · 4 lines
J.A. Magallon                           #  Let the source be with you...        
mailto:[email protected]
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
#1 lore raw

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

Signature · 4 lines
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.
#2 lore raw
In reply to J.A. Magallon
Quoted 3 lines · [email protected] 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

#3 lore raw
Quoted 6 lines · David Woodhouse
Quoted 3 lines · [email protected] 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

#4 lore raw

Hi,

Quoted 8 lines · Kai Germaschewski

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

Signature · 4 lines
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.
#5 lore raw
In reply to Kai Germaschewski
Quoted 7 lines · On 2002.05.27 Kai Germaschewski wrote:
Quoted 5 lines · David Woodhouse
Quoted 3 lines · [email protected] 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)

Quoted 9 lines
Quoted 1 line

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)
Signature · 4 lines
J.A. Magallon                           #  Let the source be with you...        
mailto:[email protected]
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
#6 lore raw
Quoted 17 lines · J.A. Magallon
Quoted 2 lines

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

Quoted 8 lines

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