Skip to contentSkip to conversation

Support for newer gcc/gas options

DISCUSSION Dimitri Torfs 3 participants 15 messages Dec 23, 2003 – Jan 26, 2004 MIPS

lore
Share & tools
lore
#0 lore raw

Hi,

I just upgraded to the arch/mips/Makefile which adds support for newer gcc/gas options. I now get the warning

"cc1: warning: The -march option is incompatible to -mipsN and therefore
+ignored."

when compiling. I have the CONFIG_CPU_VR41XX option set, which sets the c-flags to:

"-I /home/dimitri/work/linux/include/asm/gcc -G 0 -mno-abicalls -fno-pic -pipe -finline-limit=100000 -mabi=32 -march=r4100 -mips3 -Wa,-32 -Wa,-march=r4100 -Wa,-mips3 -Wa,--trap"

I suppose that for the newer gcc versions only -march= should be set (I'm using gcc-3.2.2) ?

Dimitri

Signature · 4 lines
Dimitri Torfs             |  NSCE 
[email protected] |  Sint Stevens Woluwestraat 55
tel: +32 2 2908451        |  1130 Brussel
fax: +32 2 7262686        |  Belgium
#1 lore raw
Quoted 9 lines · Dimitri Torfs

I just upgraded to the arch/mips/Makefile which adds support for newer gcc/gas options. I now get the warning

"cc1: warning: The -march option is incompatible to -mipsN and therefore
+ignored."

when compiling. I have the CONFIG_CPU_VR41XX option set, which sets the c-flags to:

Quoted 6 lines

"-I /home/dimitri/work/linux/include/asm/gcc -G 0 -mno-abicalls -fno-pic -pipe -finline-limit=100000 -mabi=32 -march=r4100 -mips3 -Wa,-32 -Wa,-march=r4100 -Wa,-mips3 -Wa,--trap"

I suppose that for the newer gcc versions only -march= should be set (I'm using gcc-3.2.2) ?

Thanks for the report -- I suppose we can remove "-mips" whenever
"-mabi=" is supported by gcc. I'll do an update in January after I am back from vacation.

Signature · 3 lines
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--------------------------------------------------------------+
+        e-mail: [email protected], PGP key available        +
#2 lore raw
Quoted 15 lines · Maciej W. Rozycki
Quoted 13 lines · Dimitri Torfs

I just upgraded to the arch/mips/Makefile which adds support for newer gcc/gas options. I now get the warning

"cc1: warning: The -march option is incompatible to -mipsN and therefore
+ignored."

when compiling. I have the CONFIG_CPU_VR41XX option set, which sets the c-flags to:

"-I /home/dimitri/work/linux/include/asm/gcc -G 0 -mno-abicalls -fno-pic -pipe -finline-limit=100000 -mabi=32 -march=r4100 -mips3 -Wa,-32 -Wa,-march=r4100 -Wa,-mips3 -Wa,--trap"

Quoted 6 lines
Quoted 2 lines

I suppose that for the newer gcc versions only -march= should be set (I'm using gcc-3.2.2) ?

Thanks for the report -- I suppose we can remove "-mips" whenever
"-mabi=" is supported by gcc. I'll do an update in January after I am back from vacation.

Tried removing the -mips3 gcc option => -D_MIPS_ISA=_MIPS_ISA_MIPS1 is set. I think it might be better to use "-mtune=<cpu> -mipsN". That seems to set the correct options, without any warnings (using gcc 3.2.2). After having carefully read the gcc documentation (again) regarding the MIPS options, I think that's the way to go for newer gcc's as well. If anyone has already tried ?

Dimitri

Signature · 4 lines
Dimitri Torfs       |  NSCE 
[email protected] |  The Corporate Village
tel: +32 2 7008541  |  Da Vincilaan 7 - D1 
fax: +32 2 7008622  |  B-1935 Zaventem - Belgium
#3 lore raw

Dimitri Torfs wrote:
[snip]

Quoted 10 lines
Quoted 3 lines

Thanks for the report -- I suppose we can remove "-mips" whenever
"-mabi=" is supported by gcc. I'll do an update in January after I am back from vacation.

Tried removing the -mips3 gcc option => -D_MIPS_ISA=_MIPS_ISA_MIPS1 is set. I think it might be better to use "-mtune=<cpu> -mipsN". That seems to set the correct options, without any warnings (using gcc 3.2.2). After having carefully read the gcc documentation (again) regarding the MIPS options, I think that's the way to go for newer gcc's as well. If anyone has already tried ?

The supposed way is to use -mabi=FOO -march=BAR, where BAR can also be e.g. "mips3". This will choose the proper (probably generic) architecture as well as the ISA defines. Btw, the ISA defines aren't used in the kernel anymore.

Thiemo

#4 lore raw
Quoted 3 lines · Thiemo Seufer

[snip]
The supposed way is to use -mabi=FOO -march=BAR, where BAR can also be e.g. "mips3".

The -march=mipsN is from gcc-3.3 and higher, right ?

Quoted 2 lines

This will choose the proper (probably generic) architecture as well as the ISA defines.

I expected, when using -march=r4100, that MIPS3 would be used. That was apparently not the case (is this maybe a bug in gcc-3.2.2 ?).

Quoted 2 lines

Btw, the ISA defines aren't used in the
kernel anymore.

Well, asm-mips/asm.h still contains some #ifdef's based on the _MIPS_ISA.

Dimitri

Signature · 4 lines
Dimitri Torfs       |  NSCE 
[email protected] |  The Corporate Village
tel: +32 2 7008541  |  Da Vincilaan 7 - D1 
fax: +32 2 7008622  |  B-1935 Zaventem - Belgium
#5 lore raw
In reply to Maciej W. Rozycki
Quoted 10 lines · Maciej W. Rozycki
Quoted 10 lines

"cc1: warning: The -march option is incompatible to -mipsN and therefore
+ignored."

when compiling. I have the CONFIG_CPU_VR41XX option set, which sets the c-flags to:

"-I /home/dimitri/work/linux/include/asm/gcc -G 0 -mno-abicalls -fno-pic -pipe -finline-limit=100000 -mabi=32 -march=r4100 -mips3 -Wa,-32 -Wa,-march=r4100 -Wa,-mips3 -Wa,--trap"

Quoted 6 lines
Quoted 2 lines

I suppose that for the newer gcc versions only -march= should be set (I'm using gcc-3.2.2) ?

Thanks for the report -- I suppose we can remove "-mips" whenever
"-mabi=" is supported by gcc. I'll do an update in January after I am back from vacation.

It took a bit longer than I planned, sorry. Anyway, here are two
functionally equivalent patches, for 2.4 and the head, that remove an ISA specification if a tool supports "-march=" and "-mabi=" at the same time. Please try the appropriate one.

Maciej

Signature · 55 lines
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--------------------------------------------------------------+
+        e-mail: [email protected], PGP key available        +

patch-mips-2.4.23-20031209-mabi-2
diff -up --recursive --new-file linux-mips-2.4.23-20031209.macro/arch/mips/Makefile linux-mips-2.4.23-20031209/arch/mips/Makefile
--- linux-mips-2.4.23-20031209.macro/arch/mips/Makefile	2003-12-22 02:35:03.000000000 +0000
+++ linux-mips-2.4.23-20031209/arch/mips/Makefile	2004-01-20 08:13:20.000000000 +0000
@@ -98,6 +98,12 @@ while :; do \
 	gas_abi=; gas_opt=; gas_cpu=; gas_isa=; \
 	break; \
 done; \
+if test "$gcc_opt" = -march && test -n "$gcc_abi"; then \
+	gcc_isa=; \
+fi; \
+if test "$gas_opt" = -Wa,-march && test -n "$gas_abi"; then \
+	gas_isa=; \
+fi; \
 echo $$gcc_abi $$gcc_opt$$gcc_cpu $$gcc_isa $$gas_abi $$gas_opt$$gas_cpu $$gas_isa)
 
 #
diff -up --recursive --new-file linux-mips-2.4.23-20031209.macro/arch/mips64/Makefile linux-mips-2.4.23-20031209/arch/mips64/Makefile
--- linux-mips-2.4.23-20031209.macro/arch/mips64/Makefile	2003-12-22 02:32:44.000000000 +0000
+++ linux-mips-2.4.23-20031209/arch/mips64/Makefile	2004-01-20 08:13:28.000000000 +0000
@@ -87,6 +87,12 @@ while :; do \
 	gas_opt=; gas_cpu=; gas_isa=; \
 	break; \
 done; \
+if test "$gcc_opt" = -march; then \
+	gcc_isa=; \
+fi; \
+if test "$gas_opt" = -Wa,-march; then \
+	gas_isa=; \
+fi; \
 echo $$gcc_opt$$gcc_cpu $$gcc_isa $$gas_opt$$gas_cpu $$gas_isa)
 
 #

patch-mips-2.6.0-20040108-mabi-2
diff -up --recursive --new-file linux-mips-2.6.0-20040108.macro/arch/mips/Makefile linux-mips-2.6.0-20040108/arch/mips/Makefile
--- linux-mips-2.6.0-20040108.macro/arch/mips/Makefile	2004-01-07 04:56:39.000000000 +0000
+++ linux-mips-2.6.0-20040108/arch/mips/Makefile	2004-01-20 08:13:49.000000000 +0000
@@ -111,6 +111,12 @@ done; \
 if test x$(gcc-abi) != x$(gas-abi); then \
 	gas_abi="-Wa,-$(gas-abi) -Wa,-mgp$(gcc-abi)"; \
 fi; \
+if test "$gcc_opt" = -march && test -n "$gcc_abi"; then \
+	gcc_isa=; \
+fi; \
+if test "$gas_opt" = -Wa,-march && test -n "$gas_abi"; then \
+	gas_isa=; \
+fi; \
 echo $$gcc_abi $$gcc_opt$$gcc_cpu $$gcc_isa $$gas_abi $$gas_opt$$gas_cpu $$gas_isa)
 
 #
#6 lore raw

Maciej W. Rozycki wrote:
[snip]

Quoted 3 lines

It took a bit longer than I planned, sorry. Anyway, here are two
functionally equivalent patches, for 2.4 and the head, that remove an ISA specification if a tool supports "-march=" and "-mabi=" at the same time.

FYI:
A test for the existence of -march= should be enough, -mabi= was implemented earlier. OTOH, it does no harm to check both.

Thiemo

#7 lore raw
Quoted 7 lines · Thiemo Seufer
Quoted 3 lines

It took a bit longer than I planned, sorry. Anyway, here are two
functionally equivalent patches, for 2.4 and the head, that remove an ISA specification if a tool supports "-march=" and "-mabi=" at the same time.

FYI:
A test for the existence of -march= should be enough, -mabi= was implemented earlier. OTOH, it does no harm to check both.

Well, FWIW my port of gcc 2.95.4 supports -march= (by aliasing it to
-mcpu=, but the option is passed down to gas as is) to cooperate with current binutils, but its support for -mabi= varies depending on the
configuration: mips64el-linux-gcc does support the option, but mipsel-linux-gcc does not. I suppose others may also want to have -march= support in 2.95.4 for binutils compatibility, especially as AFAICS 2.95.4 has a huge speed advantage over later versions of gcc.

Maciej

Signature · 3 lines
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--------------------------------------------------------------+
+        e-mail: [email protected], PGP key available        +
#8 lore raw
In reply to Maciej W. Rozycki
Quoted 6 lines · Maciej W. Rozycki

It took a bit longer than I planned, sorry. Anyway, here are two
functionally equivalent patches, for 2.4 and the head, that remove an ISA specification if a tool supports "-march=" and "-mabi=" at the same time. Please try the appropriate one.

Tried the head one, it had some typos (patch follows). Unfortunately, as I wrote earlier, gcc-3.2 doesn't set the ISA correctly when using -march=, so it doesn't work for 3.2.

arch/mips/Makefile +6 -0
@@ -111,6 +111,12 @@
 if test x$(gcc-abi) != x$(gas-abi); then \
 	gas_abi="-Wa,-$(gas-abi) -Wa,-mgp$(gcc-abi)"; \
 fi; \
+if test "$$gcc_opt" = -march= && test -n "$$gcc_abi"; then \
+	gcc_isa=; \
+fi; \
+if test "$$gas_opt" = -Wa,-march= && test -n "$$gas_abi"; then \
+	gas_isa=; \
+fi; \
 echo $$gcc_abi $$gcc_opt$$gcc_cpu $$gcc_isa $$gas_abi $$gas_opt$$gas_cpu $$gas_isa)
 
 #
Signature · 4 lines
Dimitri Torfs       |  NSCE 
[email protected] |  The Corporate Village
tel: +32 2 7008541  |  Da Vincilaan 7 - D1 
fax: +32 2 7008622  |  B-1935 Zaventem - Belgium
#9 lore raw
Quoted 6 lines · Dimitri Torfs
Quoted 4 lines

It took a bit longer than I planned, sorry. Anyway, here are two
functionally equivalent patches, for 2.4 and the head, that remove an ISA specification if a tool supports "-march=" and "-mabi=" at the same time. Please try the appropriate one.

Tried the head one, it had some typos (patch follows). Unfortunately, as I wrote

Oops, thanks for the correction -- as I still have only gcc 2.95.4, I
wasn't able to see the typos immediately.

Quoted 2 lines

earlier, gcc-3.2 doesn't set the ISA correctly when using -march=, so it doesn't work for 3.2.

But do we care of the ISA? I don't think so -- it's just a leftover from
the days the MIPS world was less complicated. If gcc 3.2 correctly emits code for the selected processor and obeys the selected ABI, then everything is fine. Are the binaries correct? If so, I'd like to apply the patch.

The few remaining bits in <asm/asm.h> that still depend on _MIPS_ISA
should be rewritten to make use of appropriate CONFIG_CPU_HAS_* settings. Or perhaps we can just scrap them -- nothing uses them at all (and current gcc is able to emit conditional move instructions itself). OTOH, for hand-coded assembly it might be a good idea to put them into gas as macros -- similarly to what gas does for the Alpha for certain instructions that are only available with later architecture revisions. I'll work on it in some spare time.

Maciej

Signature · 3 lines
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--------------------------------------------------------------+
+        e-mail: [email protected], PGP key available        +
#10 lore raw
Quoted 12 lines · Maciej W. Rozycki
Quoted 6 lines · Dimitri Torfs
Quoted 4 lines

It took a bit longer than I planned, sorry. Anyway, here are two
functionally equivalent patches, for 2.4 and the head, that remove an ISA specification if a tool supports "-march=" and "-mabi=" at the same time. Please try the appropriate one.

Tried the head one, it had some typos (patch follows). Unfortunately, as I wrote

Oops, thanks for the correction -- as I still have only gcc 2.95.4, I
wasn't able to see the typos immediately.

Quoted 8 lines
Quoted 2 lines

earlier, gcc-3.2 doesn't set the ISA correctly when using -march=, so it doesn't work for 3.2.

But do we care of the ISA? I don't think so -- it's just a leftover from
the days the MIPS world was less complicated. If gcc 3.2 correctly emits code for the selected processor and obeys the selected ABI, then everything is fine. Are the binaries correct? If so, I'd like to apply the patch.

I actually had problems compiling when the -mips3 was not set. The compiler choked on compiling some empty file, if I remember correctly. I will try again later to see what exactly went wrong.

Dimitri

Signature · 4 lines
Dimitri Torfs       |  NSCE 
[email protected] |  The Corporate Village
tel: +32 2 7008541  |  Da Vincilaan 7 - D1 
fax: +32 2 7008622  |  B-1935 Zaventem - Belgium
#11 lore raw
Quoted 10 lines · Dimitri Torfs
Quoted 5 lines · Maciej W. Rozycki

But do we care of the ISA? I don't think so -- it's just a leftover from
the days the MIPS world was less complicated. If gcc 3.2 correctly emits code for the selected processor and obeys the selected ABI, then everything is fine. Are the binaries correct? If so, I'd like to apply the patch.

I actually had problems compiling when the -mips3 was not set. The compiler choked on compiling some empty file, if I remember correctly. I will try again later to see what exactly went wrong.

Compiler choked on the first file it tries to compile: gcc added -mips1 automatically to the as command line which conflicts with the -Wa,--trap option:

/usr/local/lib/gcc-lib/mips-linux/3.2.2/../../../../mips-linux/bin/as
-G 0 -O2 -g0 -32 -march=r4100 -v -mips1 -non_shared -32 -march=r4100 --trap -o scripts/.tmp_empty.o -
Assembler messages:
Error: trap exception not supported at ISA 1

Removing the line which unsets the gas_isa option makes it work again:
/usr/local/lib/gcc-lib/mips-linux/3.2.2/../../../../mips-linux/bin/as -G 0 -O2 -g0 -32 -march=r4100 -v -mips1 -non_shared -32 -march=r4100 -mips3 --trap -o scripts/.tmp_empty.o

Dimitri

Signature · 4 lines
Dimitri Torfs       |  NSCE 
[email protected] |  The Corporate Village
tel: +32 2 7008541  |  Da Vincilaan 7 - D1 
fax: +32 2 7008622  |  B-1935 Zaventem - Belgium
#12 lore raw
Quoted 12 lines · Dimitri Torfs

Compiler choked on the first file it tries to compile: gcc added

(quoted diff) +0 -2
-mips1 automatically to the as command line which conflicts with the
-Wa,--trap option:

/usr/local/lib/gcc-lib/mips-linux/3.2.2/../../../../mips-linux/bin/as
-G 0 -O2 -g0 -32 -march=r4100 -v -mips1 -non_shared -32 -march=r4100 --trap -o scripts/.tmp_empty.o -
Assembler messages:
Error: trap exception not supported at ISA 1

Removing the line which unsets the gas_isa option makes it work again:
/usr/local/lib/gcc-lib/mips-linux/3.2.2/../../../../mips-linux/bin/as

Review

Quoted 2 lines
(quoted diff) +0 -2
-G 0 -O2 -g0 -32 -march=r4100 -v -mips1 -non_shared -32 -march=r4100
-mips3 --trap -o scripts/.tmp_empty.o

Thanks for digging into it. Actually after fixing the typos I've noticed
gcc 2.95.4 always implies the ISA from the ABI unless overridden and -mabi=64 implies -mips4, so it bails out with -march/-mcpu set to something like r4600. This also proves the uncertainity about what's passed to gas and so far including an ISA specification in gas settings is tolerable if carefully chosen. So here's a set of new updates -- now the ISA specifier is removed from gcc flags only if it actually works and the ISA specifier for gas is untouched.

Hopefully this is the last attempt. Please try it.

Maciej

Signature · 75 lines
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--------------------------------------------------------------+
+        e-mail: [email protected], PGP key available        +

patch-mips-2.4.23-20031209-mabi-8
diff -up --recursive --new-file linux-mips-2.4.23-20031209.macro/arch/mips/Makefile linux-mips-2.4.23-20031209/arch/mips/Makefile
--- linux-mips-2.4.23-20031209.macro/arch/mips/Makefile	2003-12-22 02:35:03.000000000 +0000
+++ linux-mips-2.4.23-20031209/arch/mips/Makefile	2004-01-21 23:53:31.000000000 +0000
@@ -98,6 +98,11 @@ while :; do \
 	gas_abi=; gas_opt=; gas_cpu=; gas_isa=; \
 	break; \
 done; \
+if test "$$gcc_opt" = -march= && test -n "$$gcc_abi"; then \
+	$(CC) $$gcc_abi $$gcc_opt$$gcc_cpu -S -o /dev/null \
+		-xc /dev/null > /dev/null 2>&1 && \
+		gcc_isa=; \
+fi; \
 echo $$gcc_abi $$gcc_opt$$gcc_cpu $$gcc_isa $$gas_abi $$gas_opt$$gas_cpu $$gas_isa)
 
 #
diff -up --recursive --new-file linux-mips-2.4.23-20031209.macro/arch/mips64/Makefile linux-mips-2.4.23-20031209/arch/mips64/Makefile
--- linux-mips-2.4.23-20031209.macro/arch/mips64/Makefile	2003-12-22 02:32:44.000000000 +0000
+++ linux-mips-2.4.23-20031209/arch/mips64/Makefile	2004-01-21 23:53:25.000000000 +0000
@@ -37,7 +37,7 @@ endif
 # crossformat linking we rely on the elf2ecoff tool for format conversion.
 #
 GCCFLAGS	:= -I $(TOPDIR)/include/asm/gcc
-GCCFLAGS	+= -mabi=64 -G 0 -mno-abicalls -fno-pic -Wa,--trap -pipe
+GCCFLAGS	+= -G 0 -mno-abicalls -fno-pic -Wa,--trap -pipe
 GCCFLAGS	+= $(call check_gcc, -finline-limit=100000,)
 LINKFLAGS	+= -G 0 -static # -N
 MODFLAGS	+= -mlong-calls
@@ -76,6 +76,7 @@ while :; do \
 	done; \
 	break; \
 done; \
+gcc_abi=-mabi=64; \
 gcc_cpu=$$cpu; gcc_isa=$$isa; \
 gas_cpu=$$cpu; gas_isa=-Wa,$$isa; \
 while :; do \
@@ -87,7 +88,12 @@ while :; do \
 	gas_opt=; gas_cpu=; gas_isa=; \
 	break; \
 done; \
-echo $$gcc_opt$$gcc_cpu $$gcc_isa $$gas_opt$$gas_cpu $$gas_isa)
+if test "$$gcc_opt" = -march=; then \
+	$(CC) $$gcc_abi $$gcc_opt$$gcc_cpu -S -o /dev/null \
+		-xc /dev/null > /dev/null 2>&1 && \
+		gcc_isa=; \
+fi; \
+echo $$gcc_abi $$gcc_opt$$gcc_cpu $$gcc_isa $$gas_opt$$gas_cpu $$gas_isa)
 
 #
 # CPU-dependent compiler/assembler options for optimization.

patch-mips-2.6.0-20040108-mabi-8
diff -up --recursive --new-file linux-mips-2.6.0-20040108.macro/arch/mips/Makefile linux-mips-2.6.0-20040108/arch/mips/Makefile
--- linux-mips-2.6.0-20040108.macro/arch/mips/Makefile	2004-01-07 04:56:39.000000000 +0000
+++ linux-mips-2.6.0-20040108/arch/mips/Makefile	2004-01-21 23:53:58.000000000 +0000
@@ -108,9 +108,14 @@ while :; do \
 	gas_abi=; gas_opt=; gas_cpu=; gas_isa=; \
 	break; \
 done; \
-if test x$(gcc-abi) != x$(gas-abi); then \
+if test "$(gcc-abi)" != "$(gas-abi)"; then \
 	gas_abi="-Wa,-$(gas-abi) -Wa,-mgp$(gcc-abi)"; \
 fi; \
+if test "$$gcc_opt" = -march= && test -n "$$gcc_abi"; then \
+	$(CC) $$gcc_abi $$gcc_opt$$gcc_cpu -S -o /dev/null \
+		-xc /dev/null > /dev/null 2>&1 && \
+		gcc_isa=; \
+fi; \
 echo $$gcc_abi $$gcc_opt$$gcc_cpu $$gcc_isa $$gas_abi $$gas_opt$$gas_cpu $$gas_isa)
 
 #
#13 lore raw
Quoted 10 lines · Maciej W. Rozycki

Thanks for digging into it. Actually after fixing the typos I've noticed
gcc 2.95.4 always implies the ISA from the ABI unless overridden and -mabi=64 implies -mips4, so it bails out with -march/-mcpu set to something like r4600. This also proves the uncertainity about what's passed to gas and so far including an ISA specification in gas settings is tolerable if carefully chosen. So here's a set of new updates -- now the ISA specifier is removed from gcc flags only if it actually works and the ISA specifier for gas is untouched.

Quoted 2 lines

Hopefully this is the last attempt. Please try it.

Ok for me (tested the HEAD one).

Dimitri

Signature · 4 lines
Dimitri Torfs       |  NSCE 
[email protected] |  The Corporate Village
tel: +32 2 7008541  |  Da Vincilaan 7 - D1 
fax: +32 2 7008622  |  B-1935 Zaventem - Belgium
#14 lore raw
Quoted 9 lines · Dimitri Torfs
Quoted 9 lines

Thanks for digging into it. Actually after fixing the typos I've noticed
gcc 2.95.4 always implies the ISA from the ABI unless overridden and -mabi=64 implies -mips4, so it bails out with -march/-mcpu set to something like r4600. This also proves the uncertainity about what's passed to gas and so far including an ISA specification in gas settings is tolerable if carefully chosen. So here's a set of new updates -- now the ISA specifier is removed from gcc flags only if it actually works and the ISA specifier for gas is untouched.

Quoted 3 lines
Quoted 1 line

Hopefully this is the last attempt. Please try it.

Ok for me (tested the HEAD one).

Thanks. Ralf, OK to apply these?

Signature · 76 lines
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--------------------------------------------------------------+
+        e-mail: [email protected], PGP key available        +

patch-mips-2.4.23-20031209-mabi-8
diff -up --recursive --new-file linux-mips-2.4.23-20031209.macro/arch/mips/Makefile linux-mips-2.4.23-20031209/arch/mips/Makefile
--- linux-mips-2.4.23-20031209.macro/arch/mips/Makefile	2003-12-22 02:35:03.000000000 +0000
+++ linux-mips-2.4.23-20031209/arch/mips/Makefile	2004-01-21 23:53:31.000000000 +0000
@@ -98,6 +98,11 @@ while :; do \
 	gas_abi=; gas_opt=; gas_cpu=; gas_isa=; \
 	break; \
 done; \
+if test "$$gcc_opt" = -march= && test -n "$$gcc_abi"; then \
+	$(CC) $$gcc_abi $$gcc_opt$$gcc_cpu -S -o /dev/null \
+		-xc /dev/null > /dev/null 2>&1 && \
+		gcc_isa=; \
+fi; \
 echo $$gcc_abi $$gcc_opt$$gcc_cpu $$gcc_isa $$gas_abi $$gas_opt$$gas_cpu $$gas_isa)
 
 #
diff -up --recursive --new-file linux-mips-2.4.23-20031209.macro/arch/mips64/Makefile linux-mips-2.4.23-20031209/arch/mips64/Makefile
--- linux-mips-2.4.23-20031209.macro/arch/mips64/Makefile	2003-12-22 02:32:44.000000000 +0000
+++ linux-mips-2.4.23-20031209/arch/mips64/Makefile	2004-01-21 23:53:25.000000000 +0000
@@ -37,7 +37,7 @@ endif
 # crossformat linking we rely on the elf2ecoff tool for format conversion.
 #
 GCCFLAGS	:= -I $(TOPDIR)/include/asm/gcc
-GCCFLAGS	+= -mabi=64 -G 0 -mno-abicalls -fno-pic -Wa,--trap -pipe
+GCCFLAGS	+= -G 0 -mno-abicalls -fno-pic -Wa,--trap -pipe
 GCCFLAGS	+= $(call check_gcc, -finline-limit=100000,)
 LINKFLAGS	+= -G 0 -static # -N
 MODFLAGS	+= -mlong-calls
@@ -76,6 +76,7 @@ while :; do \
 	done; \
 	break; \
 done; \
+gcc_abi=-mabi=64; \
 gcc_cpu=$$cpu; gcc_isa=$$isa; \
 gas_cpu=$$cpu; gas_isa=-Wa,$$isa; \
 while :; do \
@@ -87,7 +88,12 @@ while :; do \
 	gas_opt=; gas_cpu=; gas_isa=; \
 	break; \
 done; \
-echo $$gcc_opt$$gcc_cpu $$gcc_isa $$gas_opt$$gas_cpu $$gas_isa)
+if test "$$gcc_opt" = -march=; then \
+	$(CC) $$gcc_abi $$gcc_opt$$gcc_cpu -S -o /dev/null \
+		-xc /dev/null > /dev/null 2>&1 && \
+		gcc_isa=; \
+fi; \
+echo $$gcc_abi $$gcc_opt$$gcc_cpu $$gcc_isa $$gas_opt$$gas_cpu $$gas_isa)
 
 #
 # CPU-dependent compiler/assembler options for optimization.


patch-mips-2.6.0-20040108-mabi-8
diff -up --recursive --new-file linux-mips-2.6.0-20040108.macro/arch/mips/Makefile linux-mips-2.6.0-20040108/arch/mips/Makefile
--- linux-mips-2.6.0-20040108.macro/arch/mips/Makefile	2004-01-07 04:56:39.000000000 +0000
+++ linux-mips-2.6.0-20040108/arch/mips/Makefile	2004-01-21 23:53:58.000000000 +0000
@@ -108,9 +108,14 @@ while :; do \
 	gas_abi=; gas_opt=; gas_cpu=; gas_isa=; \
 	break; \
 done; \
-if test x$(gcc-abi) != x$(gas-abi); then \
+if test "$(gcc-abi)" != "$(gas-abi)"; then \
 	gas_abi="-Wa,-$(gas-abi) -Wa,-mgp$(gcc-abi)"; \
 fi; \
+if test "$$gcc_opt" = -march= && test -n "$$gcc_abi"; then \
+	$(CC) $$gcc_abi $$gcc_opt$$gcc_cpu -S -o /dev/null \
+		-xc /dev/null > /dev/null 2>&1 && \
+		gcc_isa=; \
+fi; \
 echo $$gcc_abi $$gcc_opt$$gcc_cpu $$gcc_isa $$gas_abi $$gas_opt$$gas_cpu $$gas_isa)
 
 #