This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC] target/m68k: multilib issues


The FL_MMU logic in gcc/config/m68k/m68k-devices.def is bogus. FL_MMU is 
applied to processors for which it doesn't make sense:

- Fido1100 offers no virtual memory and no MMU (it has a Memory Protection 
Unit). The m68k-linux target builds multilibs for fidoa due to the FL_MMU 
flag, although there is no mainline Linux port for this device (neither in 
m68k nor m68knommu, AFAICT).

- CPU32 is supported by uClinux, yet it is flagged FL_MMU but not 
FL_UCLINUX.

- MC6830x devices are also supported by uClinux. They are flagged FL_MMU 
despite having no support for virtual memory (AFAICT).

The m68k-uclinux target gets m68000 multilibs for m68302 (it has an EC000 
core) apparently by accident, i.e. only because the 68000 and 68010 
processors are not flagged FL_MMU. Oddly enough, the m68k-linux target 
does not get m68000 multilibs even though the 68302 is flagged FL_MMU!

So, FL_MMU cannot consistently be taken to mean any of "has Memory 
Management Unit", "only for linux" or "not for uclinux". FL_UCLINUX seems 
to be a partial workaround.

Far better IMHO to expliticly specify multilibs instead. The following 
patch does so.

It also drops the m68k-linux multilibs for fidoa (reason being that a 
device designed for hard real-time and with hardware context switching is 
not a likely candidate for a future Linux port).

This patch does not change any other multilibs even though cpu32 is 
missing from the m68k-uclinux target. (The m68knommu Linux port is the 
only one that supports a CPU32 device, i.e. MC68360.)

Presently m68k-linux libgfortran fails to build, because of the cpu32 
multilib:

../../../../gcc-4.5-20101021/libgfortran/generated/set_exponent_r4.c: In function 'set_exponent_r4':
/home/fthain/btc-0.12/gcc-4.5/m68k-linux-gnu/sysroot/usr/include/bits/mathinline.h:275:749: error: impossible constraint in 'asm'

This is the mathinline.h from glibc. A workaround for this issue that 
fixes the build for cpu32 (but not fidoa) is this addition to 
gcc/config/m68k/t-linux:

ifeq ($(M68K_ARCH),m68k)
MULTILIB_EXTRA_OPTS=mhard-float
endif

But since uClibc has the same mathinline.h header, perhaps the best fix is 
to add the flag in libgfortran itself?

BTW, on the topic of multilib issues, has anyone managed to build 
--with-arch=cf --enable-multilib? It doesn't build for me. Is this 
configuration supported?

Regards,
Finn


2010-11-17  Finn Thain  <fthain@telegraphics.com.au>

	* config/m68k/m68k-devices.def (FL_MMU, FL_UCLINUX): Remove.
	* gcc/config/m68k/m68k.h (FL_MMU, FL_UCLINUX): Remove.
	* config/m68k/t-linux (FL_MMU): Remove.
	(M68K_MLIB_CPU): Specify multilibs explicitly. Drop fidoa.
	* config/m68k/t-uclinux (FL_MMU, FL_UCLINUX): Remove.
	(M68K_MLIB_CPU): Specify multilibs explicitly.

Index: gcc-4.5-20101021/gcc/config/m68k/m68k-devices.def
===================================================================
--- gcc-4.5-20101021.orig/gcc/config/m68k/m68k-devices.def	2009-11-17 21:23:10.000000000 +1100
+++ gcc-4.5-20101021/gcc/config/m68k/m68k-devices.def	2010-11-17 23:52:47.720286251 +1100
@@ -72,13 +72,13 @@
 /* 680x0 series processors.  */
 M68K_DEVICE ("68000", m68000,   "68000", "68000", 68000,    isa_00,    0)
 M68K_DEVICE ("68010", m68010,   "68010", "68000", 68010,    isa_10,    0)
-M68K_DEVICE ("68020", m68020,   "68020", "68020", 68020,    isa_20,    FL_MMU | FL_UCLINUX)
-M68K_DEVICE ("68030", m68030,   "68030", "68020", 68030,    isa_20,    FL_MMU | FL_UCLINUX)
-M68K_DEVICE ("68040", m68040,   "68040", "68040", 68040,    isa_40,    FL_MMU)
-M68K_DEVICE ("68060", m68060,   "68060", "68060", 68060,    isa_40,    FL_MMU)
-M68K_DEVICE ("68302", m68302,   "68302", "68000", 68000,    isa_00,    FL_MMU)
-M68K_DEVICE ("68332", m68332,   "68332", "cpu32", cpu32,    isa_cpu32, FL_MMU)
-M68K_DEVICE ("cpu32", cpu32,    "cpu32", "cpu32", cpu32,    isa_cpu32, FL_MMU)
+M68K_DEVICE ("68020", m68020,   "68020", "68020", 68020,    isa_20,    0)
+M68K_DEVICE ("68030", m68030,   "68030", "68020", 68030,    isa_20,    0)
+M68K_DEVICE ("68040", m68040,   "68040", "68040", 68040,    isa_40,    0)
+M68K_DEVICE ("68060", m68060,   "68060", "68060", 68060,    isa_40,    0)
+M68K_DEVICE ("68302", m68302,   "68302", "68000", 68000,    isa_00,    0)
+M68K_DEVICE ("68332", m68332,   "68332", "cpu32", cpu32,    isa_cpu32, 0)
+M68K_DEVICE ("cpu32", cpu32,    "cpu32", "cpu32", cpu32,    isa_cpu32, 0)
 
 /* ColdFire CFV1 processor.  */
 /* For historical reasons, the 51 multilib is named 51qe.  */
@@ -159,31 +159,31 @@ M68K_DEVICE ("537x",  mcf537x,  "5373", 
 
 /* CFV4/CFV4e processors.  */
 M68K_DEVICE ("5407",  mcf5407,  "5407",  "5407",  cfv4,     isa_b,     FL_CF_MAC)
-M68K_DEVICE ("54410", mcf54410, "54418", "54455", cfv4,     isa_c,     FL_CF_HWDIV | FL_CF_USP | FL_CF_EMAC | FL_MMU | FL_UCLINUX)
-M68K_DEVICE ("54415", mcf54415, "54418", "54455", cfv4,     isa_c,     FL_CF_HWDIV | FL_CF_USP | FL_CF_EMAC | FL_MMU | FL_UCLINUX)
-M68K_DEVICE ("54416", mcf54416, "54418", "54455", cfv4,     isa_c,     FL_CF_HWDIV | FL_CF_USP | FL_CF_EMAC | FL_MMU | FL_UCLINUX)
-M68K_DEVICE ("54417", mcf54417, "54418", "54455", cfv4,     isa_c,     FL_CF_HWDIV | FL_CF_USP | FL_CF_EMAC | FL_MMU | FL_UCLINUX)
-M68K_DEVICE ("54418", mcf54418, "54418", "54455", cfv4,     isa_c,     FL_CF_HWDIV | FL_CF_USP | FL_CF_EMAC | FL_MMU | FL_UCLINUX)
-M68K_DEVICE ("54450", mcf54450, "54455", "54455", cfv4,     isa_c,     FL_CF_HWDIV | FL_CF_USP | FL_CF_EMAC | FL_MMU | FL_UCLINUX)
-M68K_DEVICE ("54451", mcf54451, "54455", "54455", cfv4,     isa_c,     FL_CF_HWDIV | FL_CF_USP | FL_CF_EMAC | FL_MMU | FL_UCLINUX)
-M68K_DEVICE ("54452", mcf54452, "54455", "54455", cfv4,     isa_c,     FL_CF_HWDIV | FL_CF_USP | FL_CF_EMAC | FL_MMU | FL_UCLINUX)
-M68K_DEVICE ("54453", mcf54453, "54455", "54455", cfv4,     isa_c,     FL_CF_HWDIV | FL_CF_USP | FL_CF_EMAC | FL_MMU | FL_UCLINUX)
-M68K_DEVICE ("54454", mcf54454, "54455", "54455", cfv4,     isa_c,     FL_CF_HWDIV | FL_CF_USP | FL_CF_EMAC | FL_MMU | FL_UCLINUX)
-M68K_DEVICE ("54455", mcf54455, "54455", "54455", cfv4,     isa_c,     FL_CF_HWDIV | FL_CF_USP | FL_CF_EMAC | FL_MMU | FL_UCLINUX)
-M68K_DEVICE ("5470",  mcf5470,  "5475",  "5475",  cfv4e,    isa_b,     FL_CF_USP | FL_CF_EMAC | FL_CF_FPU | FL_MMU)
-M68K_DEVICE ("5471",  mcf5471,  "5475",  "5475",  cfv4e,    isa_b,     FL_CF_USP | FL_CF_EMAC | FL_CF_FPU | FL_MMU)
-M68K_DEVICE ("5472",  mcf5472,  "5475",  "5475",  cfv4e,    isa_b,     FL_CF_USP | FL_CF_EMAC | FL_CF_FPU | FL_MMU)
-M68K_DEVICE ("5473",  mcf5473,  "5475",  "5475",  cfv4e,    isa_b,     FL_CF_USP | FL_CF_EMAC | FL_CF_FPU | FL_MMU)
-M68K_DEVICE ("5474",  mcf5474,  "5475",  "5475",  cfv4e,    isa_b,     FL_CF_USP | FL_CF_EMAC | FL_CF_FPU | FL_MMU)
-M68K_DEVICE ("5475",  mcf5475,  "5475",  "5475",  cfv4e,    isa_b,     FL_CF_USP | FL_CF_EMAC | FL_CF_FPU | FL_MMU)
-M68K_DEVICE ("547x",  mcf547x,  "5475",  "5475",  cfv4e,    isa_b,     FL_CF_USP | FL_CF_EMAC | FL_CF_FPU | FL_MMU)
-M68K_DEVICE ("5480",  mcf5480,  "5485",  "5475",  cfv4e,    isa_b,     FL_CF_USP | FL_CF_EMAC | FL_CF_FPU | FL_MMU)
-M68K_DEVICE ("5481",  mcf5481,  "5485",  "5475",  cfv4e,    isa_b,     FL_CF_USP | FL_CF_EMAC | FL_CF_FPU | FL_MMU)
-M68K_DEVICE ("5482",  mcf5482,  "5485",  "5475",  cfv4e,    isa_b,     FL_CF_USP | FL_CF_EMAC | FL_CF_FPU | FL_MMU)
-M68K_DEVICE ("5483",  mcf5483,  "5485",  "5475",  cfv4e,    isa_b,     FL_CF_USP | FL_CF_EMAC | FL_CF_FPU | FL_MMU)
-M68K_DEVICE ("5484",  mcf5484,  "5485",  "5475",  cfv4e,    isa_b,     FL_CF_USP | FL_CF_EMAC | FL_CF_FPU | FL_MMU)
-M68K_DEVICE ("5485",  mcf5485,  "5485",  "5475",  cfv4e,    isa_b,     FL_CF_USP | FL_CF_EMAC | FL_CF_FPU | FL_MMU)
-M68K_DEVICE ("548x",  mcf548x,  "5485",  "5475",  cfv4e,    isa_b,     FL_CF_USP | FL_CF_EMAC | FL_CF_FPU | FL_MMU)
+M68K_DEVICE ("54410", mcf54410, "54418", "54455", cfv4,     isa_c,     FL_CF_HWDIV | FL_CF_USP | FL_CF_EMAC)
+M68K_DEVICE ("54415", mcf54415, "54418", "54455", cfv4,     isa_c,     FL_CF_HWDIV | FL_CF_USP | FL_CF_EMAC)
+M68K_DEVICE ("54416", mcf54416, "54418", "54455", cfv4,     isa_c,     FL_CF_HWDIV | FL_CF_USP | FL_CF_EMAC)
+M68K_DEVICE ("54417", mcf54417, "54418", "54455", cfv4,     isa_c,     FL_CF_HWDIV | FL_CF_USP | FL_CF_EMAC)
+M68K_DEVICE ("54418", mcf54418, "54418", "54455", cfv4,     isa_c,     FL_CF_HWDIV | FL_CF_USP | FL_CF_EMAC)
+M68K_DEVICE ("54450", mcf54450, "54455", "54455", cfv4,     isa_c,     FL_CF_HWDIV | FL_CF_USP | FL_CF_EMAC)
+M68K_DEVICE ("54451", mcf54451, "54455", "54455", cfv4,     isa_c,     FL_CF_HWDIV | FL_CF_USP | FL_CF_EMAC)
+M68K_DEVICE ("54452", mcf54452, "54455", "54455", cfv4,     isa_c,     FL_CF_HWDIV | FL_CF_USP | FL_CF_EMAC)
+M68K_DEVICE ("54453", mcf54453, "54455", "54455", cfv4,     isa_c,     FL_CF_HWDIV | FL_CF_USP | FL_CF_EMAC)
+M68K_DEVICE ("54454", mcf54454, "54455", "54455", cfv4,     isa_c,     FL_CF_HWDIV | FL_CF_USP | FL_CF_EMAC)
+M68K_DEVICE ("54455", mcf54455, "54455", "54455", cfv4,     isa_c,     FL_CF_HWDIV | FL_CF_USP | FL_CF_EMAC)
+M68K_DEVICE ("5470",  mcf5470,  "5475",  "5475",  cfv4e,    isa_b,     FL_CF_USP | FL_CF_EMAC | FL_CF_FPU)
+M68K_DEVICE ("5471",  mcf5471,  "5475",  "5475",  cfv4e,    isa_b,     FL_CF_USP | FL_CF_EMAC | FL_CF_FPU)
+M68K_DEVICE ("5472",  mcf5472,  "5475",  "5475",  cfv4e,    isa_b,     FL_CF_USP | FL_CF_EMAC | FL_CF_FPU)
+M68K_DEVICE ("5473",  mcf5473,  "5475",  "5475",  cfv4e,    isa_b,     FL_CF_USP | FL_CF_EMAC | FL_CF_FPU)
+M68K_DEVICE ("5474",  mcf5474,  "5475",  "5475",  cfv4e,    isa_b,     FL_CF_USP | FL_CF_EMAC | FL_CF_FPU)
+M68K_DEVICE ("5475",  mcf5475,  "5475",  "5475",  cfv4e,    isa_b,     FL_CF_USP | FL_CF_EMAC | FL_CF_FPU)
+M68K_DEVICE ("547x",  mcf547x,  "5475",  "5475",  cfv4e,    isa_b,     FL_CF_USP | FL_CF_EMAC | FL_CF_FPU)
+M68K_DEVICE ("5480",  mcf5480,  "5485",  "5475",  cfv4e,    isa_b,     FL_CF_USP | FL_CF_EMAC | FL_CF_FPU)
+M68K_DEVICE ("5481",  mcf5481,  "5485",  "5475",  cfv4e,    isa_b,     FL_CF_USP | FL_CF_EMAC | FL_CF_FPU)
+M68K_DEVICE ("5482",  mcf5482,  "5485",  "5475",  cfv4e,    isa_b,     FL_CF_USP | FL_CF_EMAC | FL_CF_FPU)
+M68K_DEVICE ("5483",  mcf5483,  "5485",  "5475",  cfv4e,    isa_b,     FL_CF_USP | FL_CF_EMAC | FL_CF_FPU)
+M68K_DEVICE ("5484",  mcf5484,  "5485",  "5475",  cfv4e,    isa_b,     FL_CF_USP | FL_CF_EMAC | FL_CF_FPU)
+M68K_DEVICE ("5485",  mcf5485,  "5485",  "5475",  cfv4e,    isa_b,     FL_CF_USP | FL_CF_EMAC | FL_CF_FPU)
+M68K_DEVICE ("548x",  mcf548x,  "5485",  "5475",  cfv4e,    isa_b,     FL_CF_USP | FL_CF_EMAC | FL_CF_FPU)
 
 /* Fido processor.  */
-M68K_DEVICE ("fidoa", fidoa,    "cpu32", "fidoa", cpu32,    isa_cpu32, FL_FIDOA | FL_MMU)
+M68K_DEVICE ("fidoa", fidoa,    "cpu32", "fidoa", cpu32,    isa_cpu32, FL_FIDOA)
Index: gcc-4.5-20101021/gcc/config/m68k/m68k.h
===================================================================
--- gcc-4.5-20101021.orig/gcc/config/m68k/m68k.h	2009-09-23 01:49:54.000000000 +1000
+++ gcc-4.5-20101021/gcc/config/m68k/m68k.h	2010-11-17 23:52:47.720286251 +1100
@@ -232,8 +232,6 @@ along with GCC; see the file COPYING3.  
 #define FL_ISA_B     (1 << 15)
 #define FL_ISA_C     (1 << 16)
 #define FL_FIDOA     (1 << 17)
-#define FL_MMU 	     0   /* Used by multilib machinery.  */
-#define FL_UCLINUX   0   /* Used by multilib machinery.  */
 
 #define TARGET_68010		((m68k_cpu_flags & FL_ISA_68010) != 0)
 #define TARGET_68020		((m68k_cpu_flags & FL_ISA_68020) != 0)
Index: gcc-4.5-20101021/gcc/config/m68k/t-linux
===================================================================
--- gcc-4.5-20101021.orig/gcc/config/m68k/t-linux	2009-04-22 05:03:23.000000000 +1000
+++ gcc-4.5-20101021/gcc/config/m68k/t-linux	2010-11-17 23:52:47.720286251 +1100
@@ -18,8 +18,12 @@
 
 EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o
 
-# Only include multilibs for CPUs with an MMU.
-M68K_MLIB_CPU += && match(FLAGS, "FL_MMU")
+M68K_MLIB_CPU += && ( MLIB == "68020" || \
+                      MLIB == "68040" || \
+                      MLIB == "68060" || \
+                      MLIB == "cpu32" || \
+                      MLIB == "54455" || \
+                      MLIB == "5475"  )
 
 # This rule uses MULTILIB_MATCHES to generate a definition of
 # SYSROOT_SUFFIX_SPEC.
Index: gcc-4.5-20101021/gcc/config/m68k/t-uclinux
===================================================================
--- gcc-4.5-20101021.orig/gcc/config/m68k/t-uclinux	2009-05-14 01:10:55.000000000 +1000
+++ gcc-4.5-20101021/gcc/config/m68k/t-uclinux	2010-11-17 23:52:47.720286251 +1100
@@ -19,8 +19,17 @@
 # crti and crtn are provided by uClibc.
 EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o
 
-# Include multilibs for CPUs without an MMU or with FL_UCLINUX
-M68K_MLIB_CPU += && (!match(FLAGS, "FL_MMU") || match(FLAGS, "FL_UCLINUX"))
+M68K_MLIB_CPU += && ( MLIB == "68000" || \
+                      MLIB == "68020" || \
+                      MLIB == "51qe"  || \
+                      MLIB == "5206"  || \
+                      MLIB == "5206e" || \
+                      MLIB == "5208"  || \
+                      MLIB == "5206e" || \
+                      MLIB == "5329"  || \
+                      MLIB == "5307"  || \
+                      MLIB == "5407"  || \
+                      MLIB == "54455" )
 
 # Add multilibs for execute-in-place and shared-library code.
 M68K_MLIB_OPTIONS += msep-data/mid-shared-library


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]