[PATCH] Add m68k-uclinux target

Bernardo Innocenti bernie@develer.com
Mon Sep 15 00:25:00 GMT 2003


This is the final patch in the ColdFire/uClinux support set.
It adds the uClinux target definition to GCC and libstdc++.

Unlike the official, 2.95.x based toolchain, GCC 3.4 will
stop abusing the m68k-elf target and use its own target
triplet instead (m68k-unknown-uclinux).

The script that builds the full uClinux toolchain ensures
backwards compatibility by creating a few symbolic links.


For GCC:

2003-09-15  Bernardo Innocenti  <bernie@develer.com>

	* config/m68k/t-uclinux: New file.
	* config/m68k/uclinux.h: Ditto.
	* gcc/config.gcc (m68k-*-uclinux*): New target.


For libstdc++:

2003-09-15  Bernardo Innocenti  <bernie@develer.com>

	* crossconfig.m4 (*-uclinux*): New target.
	* configure: Regenerate (well, not really).


diff -Nru gcc-3.4-20030813.orig/gcc/config/m68k/t-uclinux gcc-3.4-20030813/gcc/config/m68k/t-uclinux
--- gcc-3.4-20030813.orig/gcc/config/m68k/t-uclinux	1970-01-01 01:00:00.000000000 +0100
+++ gcc-3.4-20030813/gcc/config/m68k/t-uclinux	2003-08-19 21:29:30.000000000 +0200
@@ -0,0 +1,27 @@
+# Don't run fixproto
+STMP_FIXPROTO =
+
+LIB1ASMSRC = m68k/lb1sf68.asm
+LIB1ASMFUNCS = _mulsi3 _udivsi3 _divsi3 _umodsi3 _modsi3 \
+   _double _float _floatex \
+   _eqdf2 _nedf2 _gtdf2 _gedf2 _ltdf2 _ledf2 \
+   _eqsf2 _nesf2 _gtsf2 _gesf2 _ltsf2 _lesf2
+
+LIB2FUNCS_EXTRA = fpgnulib.c xfgnulib.c
+
+fpgnulib.c: $(srcdir)/config/m68k/fpgnulib.c
+	cp $(srcdir)/config/m68k/fpgnulib.c fpgnulib.c
+xfgnulib.c: $(srcdir)/config/m68k/fpgnulib.c
+	echo '#define EXTFLOAT' > xfgnulib.c
+	cat $(srcdir)/config/m68k/fpgnulib.c >> xfgnulib.c
+
+MULTILIB_OPTIONS = m68000/m5200/m5206e/m528x/m5307/m5407/mcpu32 msep-data/mid-shared-library
+MULTILIB_DIRNAMES =
+MULTILIB_MATCHES = m68000=mc68000 m68000=m68302 mcpu32=m68332 m5206e=m5272
+MULTILIB_EXCEPTIONS = m68000/msep-data* m68000/mid-shared-library* msep-data* mid-shared-library*
+
+LIBGCC = stmp-multilib
+INSTALL_LIBGCC = install-multilib
+
+# We don't use crtbegin.o and crtend.o
+EXTRA_PARTS=
diff -Nru gcc-3.4-20030813.orig/gcc/config/m68k/uclinux.h gcc-3.4-20030813/gcc/config/m68k/uclinux.h
--- gcc-3.4-20030813.orig/gcc/config/m68k/uclinux.h	1970-01-01 01:00:00.000000000 +0100
+++ gcc-3.4-20030813/gcc/config/m68k/uclinux.h	2003-08-20 19:26:09.000000000 +0200
@@ -0,0 +1,61 @@
+/* Definitions of target machine for GNU compiler.  m68k/ColdFire based
+   uClinux system using ELF objects with special linker post-processing
+   to produce FLAT executables.
+
+   Copyright (C) 2003 Free Software Foundation, Inc.
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING.  If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+
+/* Undo the definition of STARTFILE_SPEC from m68kelf.h so we'll
+   pick the default from gcc.c (just link crt0.o from multilib dir).  */
+#undef	STARTFILE_SPEC
+
+/* Override the default LIB_SPEC from gcc.c.  We don't currently support
+   profiling, or libg.a.  */
+#undef LIB_SPEC
+#define LIB_SPEC "\
+%{mid-shared-library:-R libc.gdb%s} -lc \
+"
+
+/* we don't want a .eh_frame section.  */
+#define EH_FRAME_IN_DATA_SECTION
+
+/* ??? Quick hack to get constructors working.  Make this look more like a
+   COFF target, so the existing dejagnu/libgloss support works.  A better
+   solution would be to make the necessary dejagnu and libgloss changes so
+   that we can use normal the ELF constructor mechanism.  */
+#undef INIT_SECTION_ASM_OP
+#undef FINI_SECTION_ASM_OP
+#undef ENDFILE_SPEC
+#define ENDFILE_SPEC ""
+ 
+/* Bring in standard linux defines */
+#undef TARGET_OS_CPP_BUILTINS
+#define TARGET_OS_CPP_BUILTINS()		\
+  do						\
+    {						\
+	builtin_define_std ("mc68000");		\
+	builtin_define ("__uClinux__");		\
+	builtin_define_std ("linux");		\
+	builtin_define_std ("unix");		\
+	builtin_define ("__gnu_linux__");	\
+	builtin_assert ("system=posix");	\
+    }						\
+  while (0)
+
diff -Nru gcc-3.4-20030813.orig/gcc/config.gcc gcc-3.4-20030813/gcc/config.gcc
--- gcc-3.4-20030813.orig/gcc/config.gcc	2003-08-08 23:13:37.000000000 +0200
+++ gcc-3.4-20030813/gcc/config.gcc	2003-08-19 21:36:32.000000000 +0200
@@ -1400,6 +1400,11 @@
 	tm_defines="MOTOROLA USE_GAS LINUX_DEFAULT_ELF"
 	tmake_file="t-slibgcc-elf-ver t-linux"
 	;;
+m68k-*-uclinux*)		# Motorola m68k/ColdFire running uClinux with uClibc
+	tm_file="m68k/m68k.h m68k/m68k-none.h m68k/m68kelf.h dbxelf.h elfos.h m68k/uclinux.h"
+ 	tm_defines="MOTOROLA USE_GAS"
+	tmake_file=m68k/t-uclinux
+	;;
 m68k-*-rtems*)
 	tmake_file="m68k/t-m68kbare t-rtems m68k/t-crtstuff"
 	tm_file="m68k/m68k-none.h m68k/m68kelf.h dbxelf.h elfos.h m68k/m68kemb.h m68k/m68020-elf.h m68k/rtemself.h rtems.h"
diff -Nru gcc-3.4-20030813.orig/libstdc++-v3/crossconfig.m4 gcc-3.4-20030813/libstdc++-v3/crossconfig.m4
--- gcc-3.4-20030813.orig/libstdc++-v3/crossconfig.m4	2003-08-21 02:34:59.000000000 +0200
+++ gcc-3.4-20030813/libstdc++-v3/crossconfig.m4	2003-08-19 00:18:24.000000000 +0200
@@ -87,7 +87,7 @@
 	;;
     esac
     ;;
-  *-linux*)
+  *-linux* | *-uclinux*)
     #os_include_dir="os/gnu-linux"
     AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
       machine/endian.h machine/param.h sys/machine.h sys/types.h \
diff -Nru gcc-3.4-20030813.orig/libstdc++-v3/configure gcc-3.4-20030813/libstdc++-v3/configure
--- gcc-3.4-20030813.orig/libstdc++-v3/configure	2003-08-21 02:34:59.000000000 +0200
+++ gcc-3.4-20030813/libstdc++-v3/configure	2003-08-19 00:19:25.000000000 +0200
@@ -11519,7 +11519,7 @@
 	;;
     esac
     ;;
-  *-linux*)
+  *-linux* | *-uclinux*)
     #os_include_dir="os/gnu-linux"
 
 


-- 
  // Bernardo Innocenti - Develer S.r.l., R&D dept.
\X/  http://www.develer.com/

Please don't send Word attachments - http://www.gnu.org/philosophy/no-word-attachments.html





More information about the Gcc-patches mailing list