Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Matthew Reppert <repp0017@tc.umn.edu>
To: ralf@gnu.org
Subject: [PATCH] Enable compilation on MIPS with gcc-3.3
Date: Sun, 25 Jan 2004 00:37:10 -0600	[thread overview]
Message-ID: <1075012630.5829.333.camel@minerva> (raw)

[-- Attachment #1: Type: text/plain, Size: 4723 bytes --]

Hi,

arch/mips/Makefile uses gcc's -mcpu= flag to pass subarchitecture
selection choices to gcc. -mcpu= was deprecated in gcc 3.1, and has
been removed as of gcc 3.3. We need to use -march= for gcc 3.x (where
x >= 3), but some versions of gcc don't understand -march= (namely
2.95.x, which some people still use.)

This patch introduces a variable in arch/mips/makefile, gcc-tune-flag,
which is "cpu" if gcc understands -mcpu and "arch" if it doesn't, and
uses it to build the -mcpu=/-march= bits in CFLAGS for each processor
type.

Matt


diff -puN arch/mips/Makefile~mips-arch arch/mips/Makefile
--- linux-2.6.2-rc1-mm2_mips/arch/mips/Makefile~mips-arch	2004-01-25 00:13:03.295170984 -0600
+++ linux-2.6.2-rc1-mm2_mips-arashi/arch/mips/Makefile	2004-01-25 00:23:39.594438792 -0600
@@ -38,6 +38,8 @@ ifdef CONFIG_CROSSCOMPILE
 CROSS_COMPILE		:= $(tool-prefix)
 endif
 
+gcc-tune-flag		= $(shell if $(CC) -dumpspecs | grep mcpu; then echo cpu; else echo arch; fi)
+
 #
 # GCC uses -G 0 -mabicalls -fpic as default.  We don't want PIC in the kernel
 # code since it only slows down the whole thing.  At some point we might make
@@ -75,49 +77,49 @@ check_warning = $(shell if $(CC) $(1) -c
 #                A kernel built those options will only work on hardware which
 #                actually supports this ISA.
 #
-cflags-$(CONFIG_CPU_R3000)	+= -mcpu=r3000
+cflags-$(CONFIG_CPU_R3000)	+= -$(gcc-tune-flag)=r3000
 32bit-isa-$(CONFIG_CPU_R3000)	+= -mips1
 64bit-isa-$(CONFIG_CPU_R3000)	+= -mboom
-cflags-$(CONFIG_CPU_TX39XX)	+= -mcpu=r3000
+cflags-$(CONFIG_CPU_TX39XX)	+= -$(gcc-tune-flag)=r3000
 32bit-isa-$(CONFIG_CPU_TX39XX)	+= -mips1
 64bit-isa-$(CONFIG_CPU_TX39XX)	+= -mboom
-cflags-$(CONFIG_CPU_R6000)	+= -mcpu=r6000
+cflags-$(CONFIG_CPU_R6000)	+= -$(gcc-tune-flag)=r6000
 32bit-isa-$(CONFIG_CPU_R6000)	+= -mips2 -Wa,--trap
 64bit-isa-$(CONFIG_CPU_R6000)	+= -mboom -Wa,--trap
-cflags-$(CONFIG_CPU_R4300)	+= -mcpu=r4300
+cflags-$(CONFIG_CPU_R4300)	+= -$(gcc-tune-flag)=r4300
 32bit-isa-$(CONFIG_CPU_R4300)	+= -mips2 -Wa,--trap
 64bit-isa-$(CONFIG_CPU_R4300)	+= -mips3 -Wa,--trap
-cflags-$(CONFIG_CPU_VR41XX)	+= -mcpu=r4600
+cflags-$(CONFIG_CPU_VR41XX)	+= -$(gcc-tune-flag)=r4600
 32bit-isa-$(CONFIG_CPU_VR41XX)	+= -mips2 -Wa,--trap
 64bit-isa-$(CONFIG_CPU_VR41XX)	+= -mips3 -Wa,--trap
-cflags-$(CONFIG_CPU_R4X00)	+= -mcpu=r4600
+cflags-$(CONFIG_CPU_R4X00)	+= -$(gcc-tune-flag)=r4600
 32bit-isa-$(CONFIG_CPU_R4X00)	+= -mips2 -Wa,--trap
 64bit-isa-$(CONFIG_CPU_R4X00)	+= -mips3 -Wa,--trap
-cflags-$(CONFIG_CPU_MIPS32)	+= $(call check_gcc, -mtune=mips32, -mcpu=r4600)
+cflags-$(CONFIG_CPU_MIPS32)	+= $(call check_gcc, -mtune=mips32, -$(gcc-tune-flag)=r4600)
 32bit-isa-$(CONFIG_CPU_MIPS32)	+= $(call check_gcc, -mips32 -mabi=32, -mips2) -Wa,--trap
 64bit-isa-$(CONFIG_CPU_MIPS32)	+= -mboom
 cflags-$(CONFIG_CPU_MIPS64)	+= 
 32bit-isa-$(CONFIG_CPU_MIPS64)	+= $(call check_gcc, -mips32, -mips2) -Wa,--trap
 64bit-isa-$(CONFIG_CPU_MIPS64)	+= $(call check_gcc, -mips64, -mips4) -Wa,--trap
-cflags-$(CONFIG_CPU_R5000)	+= -mcpu=r8000
+cflags-$(CONFIG_CPU_R5000)	+= -$(gcc-tune-flag)=r8000
 32bit-isa-$(CONFIG_CPU_R5000)	+= -mips2 -Wa,--trap
 64bit-isa-$(CONFIG_CPU_R5000)	+= -mips4 -Wa,--trap
-cflags-$(CONFIG_CPU_R5432)	+= -mcpu=r5000
+cflags-$(CONFIG_CPU_R5432)	+= -$(gcc-tune-flag)=r5000
 32bit-isa-$(CONFIG_CPU_R5432)	+= -mips1 -Wa,--trap
 64bit-isa-$(CONFIG_CPU_R5432)	+= -mips3 -Wa,--trap
-cflags-$(CONFIG_CPU_NEVADA)	+= -mcpu=r8000 -mmad
+cflags-$(CONFIG_CPU_NEVADA)	+= -$(gcc-tune-flag)=r8000 -mmad
 32bit-isa-$(CONFIG_CPU_NEVADA)	+= -mips2 -Wa,--trap
 64bit-isa-$(CONFIG_CPU_NEVADA)	+= -mips3 -Wa,--trap
-cflags-$(CONFIG_CPU_RM7000)	+= $(call check_gcc, -mcpu=r7000, -mcpu=r5000)
+cflags-$(CONFIG_CPU_RM7000)	+= $(call check_gcc, -$(gcc-tune-flag)=r7000, -$(gcc-tune-flag)=r5000)
 32bit-isa-$(CONFIG_CPU_RM7000)	+= -mips2 -Wa,--trap
 64bit-isa-$(CONFIG_CPU_RM7000)	+= -mips4 -Wa,--trap
-cflags-$(CONFIG_CPU_SB1)	+= $(call check_gcc, -mcpu=sb1, -mcpu=r8000)
+cflags-$(CONFIG_CPU_SB1)	+= $(call check_gcc, -$(gcc-tune-flag)=sb1, -$(gcc-tune-flag)=r8000)
 32bit-isa-$(CONFIG_CPU_SB1)	+= $(call check_gcc, -mips32, -mips2) -Wa,--trap
 64bit-isa-$(CONFIG_CPU_SB1)	+= $(call check_gcc, -mips64, -mips4) -Wa,--trap
-cflags-$(CONFIG_CPU_R8000)	+= -mcpu=r8000
+cflags-$(CONFIG_CPU_R8000)	+= -$(gcc-tune-flag)=r8000
 32bit-isa-$(CONFIG_CPU_R8000)	+= -mips2 -Wa,--trap
 64bit-isa-$(CONFIG_CPU_R8000)	+= -mips4 -Wa,--trap
-cflags-$(CONFIG_CPU_R10000)	+= -mcpu=r8000
+cflags-$(CONFIG_CPU_R10000)	+= -$(gcc-tune-flag)=r8000
 32bit-isa-$(CONFIG_CPU_R10000)	+= -mips2 -Wa,--trap
 64bit-isa-$(CONFIG_CPU_R10000)	+= -mips4 -Wa,--trap
 

_


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

                 reply	other threads:[~2004-01-25  6:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1075012630.5829.333.camel@minerva \
    --to=repp0017@tc.umn.edu \
    --cc=ralf@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox