This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[basic-improvements] VxWorks 1/n: put back PPC target
- From: Zack Weinberg <zack at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 29 Oct 2002 00:07:46 -0800
- Subject: [basic-improvements] VxWorks 1/n: put back PPC target
This patch is the basic new PPC VxWorks target configuration. It has
not been tested very thoroughly, but should work just fine for C
programs. C++ is not there yet. I have a few ancillary patches to go
with this, which will be sent tomorrow, when I am awake.
I also ripped all the vxworks stuff out of rs6000/sysv4.h, because no
one actually wants to use a generic sysv4 configuration for vxworks,
so it just adds unnecessary complexity.
Tested by building i686-linux -> powerpc-wrs-vxworks cross compiler
(C only). Applied to basic-improvements.
zw
* config.gcc (*-*-vxworks, powerpc-wrs-vxworks*): New stanzas.
* config/t-vxworks, config/vxworks.h, config/rs6000/t-vxworks,
config/rs6000/vxworks.h: New files.
* config/rs6000/sysv4.h: Rip out -mvxworks and all related code.
===================================================================
Index: config.gcc
--- config.gcc 29 Oct 2002 05:08:20 -0000 1.240.2.9
+++ config.gcc 29 Oct 2002 07:52:20 -0000
@@ -308,7 +308,7 @@ case $machine in
;;
esac
-# Common parts for GNU/Linux, GNU/Hurd, OpenBSD, NetBSD, and FreeBSD systems.
+# Common parts for widely ported systems.
case $machine in
*-*-linux*)
xm_defines=POSIX
@@ -423,6 +423,13 @@ case $machine in
esac
fbsd_tm_file="${fbsd_tm_file} freebsd-spec.h freebsd.h"
;;
+*-*-vxworks*)
+ tmake_file=t-vxworks
+ tm_file="${tm_file} elfos.h svr4.h vxworks.h"
+ thread_file='vxworks'
+ use_collect2=yes
+ xm_defines=POSIX
+ ;;
esac
case $machine in
@@ -2011,6 +2018,14 @@ powerpc-*-gnu*)
if test x$enable_threads = xyes; then
thread_file='posix'
fi
+ ;;
+powerpc-wrs-vxworks*)
+ # We want vxworks.h after rs6000/sysv4.h, which unfortunately
+ # means we have to redo the tm_file list from scratch.
+ tm_file="rs6000/rs6000.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h"
+ tm_file="${tm_file} vxworks.h rs6000/vxworks.h"
+ tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-vxworks"
+ extra_headers=ppc-asm.h
;;
powerpc-wrs-windiss*)
xm_defines=POSIX
===================================================================
Index: config/t-vxworks
--- config/t-vxworks 1 Jan 1970 00:00:00 -0000
+++ config/t-vxworks 29 Oct 2002 07:52:21 -0000
@@ -0,0 +1,22 @@
+# Don't run fixproto.
+STMP_FIXPROTO =
+
+# Since we have a functional assert.h, use it.
+INSTALL_ASSERT_H =
+
+# Build libgcc using the multilib mechanism
+
+LIBGCC = stmp-multilib
+INSTALL_LIBGCC = install-multilib
+
+# No special flags needed for libgcc.a
+TARGET_LIBGCC2_CFLAGS =
+
+# Don't build libgcc.a with debug info
+LIBGCC2_DEBUG_CFLAGS =
+
+# This ensures that the correct target headers are used; some
+# VxWorks system headers have names that collide with GCC's
+# internal (host) headers, e.g. regs.h.
+# FIXME: May not be necessary anymore.
+LIBGCC2_INCLUDES="-I$(SYSTEM_HEADER_DIR)"
===================================================================
Index: config/vxworks.h
--- config/vxworks.h 1 Jan 1970 00:00:00 -0000
+++ config/vxworks.h 29 Oct 2002 07:52:21 -0000
@@ -0,0 +1,65 @@
+/* Common VxWorks target definitions for GNU compiler.
+ Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Contributed by Wind River Systems.
+
+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. */
+
+/* Specify what to link with. */
+/* VxWorks does all the library stuff itself. */
+#undef LIB_SPEC
+#define LIB_SPEC ""
+
+#undef LINK_SPEC
+#define LINK_SPEC "-r"
+
+/* VxWorks provides the functionality of crt0.o and friends itself. */
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC ""
+
+#undef ENDFILE_SPEC
+#define ENDFILE_SPEC ""
+
+/* VxWorks cannot have dots in constructor labels, because it uses a
+ mutant variation of collect2 that generates C code instead of
+ assembly. Thus each constructor label must be a legitimate C
+ symbol. FIXME: Have VxWorks use real collect2 instead. */
+
+#undef NO_DOLLAR_IN_LABEL
+#define NO_DOT_IN_LABEL
+
+/* enable #pragma pack(n) */
+#define HANDLE_SYSV_PRAGMA
+
+/* No underscore is prepended to any C symbol name. */
+#undef USER_LABEL_PREFIX
+#define USER_LABEL_PREFIX ""
+
+/* VxWorks uses wchar_t == unsigned short (UCS2) on all architectures. */
+#undef WCHAR_TYPE
+#define WCHAR_TYPE "short unsigned int"
+#undef WCHAR_TYPE_SIZE
+#define WCHAR_TYPE_SIZE 16
+
+/* Dwarf2 unwind info is not supported. */
+#define DWARF2_UNWIND_INFO 0
+/* Weak symbols and link-once sections are not enabled by default. */
+#define DEFAULT_USE_WEAK 0
+
+/* Only supported debug format is Dwarf2. */
+#undef DBX_DEBUGGING_INFO
+#undef DWARF_DEBUGGING_INFO
===================================================================
Index: config/rs6000/sysv4.h
--- config/rs6000/sysv4.h 28 Oct 2002 19:48:38 -0000 1.106.2.7
+++ config/rs6000/sysv4.h 29 Oct 2002 07:52:21 -0000
@@ -147,7 +147,6 @@ extern int g_switch_set; /* Whether -G
N_("Link with libmvme.a, libc.a and crt0.o") }, \
{ "emb", 0, \
N_("Set the PPC_EMB bit in the ELF flags header") }, \
- { "vxworks", 0, N_("no description yet") }, \
{ "windiss", 0, N_("Use the WindISS simulator") }, \
{ "shlib", 0, N_("no description yet") }, \
EXTRA_SUBTARGET_SWITCHES \
@@ -1012,7 +1011,6 @@ do { \
mcall-linux : crtsavres.o%s %(endfile_linux) ; \
mcall-gnu : crtsavres.o%s %(endfile_gnu) ; \
mcall-netbsd : crtsavres.o%s %(endfile_netbsd) ; \
- mvxworks : crtsavres.o%s %(endfile_vxworks) ; \
: %(crtsavres_default) %(endfile_default) }"
#define CRTSAVRES_DEFAULT_SPEC "crtsavres.o%s"
@@ -1185,48 +1183,6 @@ ncrtn.o%s"
#define CPP_OS_NETBSD_SPEC "\
-D__powerpc__ -D__NetBSD__ -D__ELF__ -D__KPRINTF_ATTRIBUTE__"
-/* VxWorks support. */
-/* VxWorks does all the library stuff itself. */
-#define LIB_VXWORKS_SPEC ""
-
-/* VxWorks provides the functionality of crt0.o and friends itself. */
-
-#define STARTFILE_VXWORKS_SPEC ""
-
-#define ENDFILE_VXWORKS_SPEC ""
-
-/* Because it uses ld -r, vxworks has no start/end files, nor starting
- address. */
-
-#define LINK_START_VXWORKS_SPEC ""
-
-#define LINK_OS_VXWORKS_SPEC "-r"
-
-#define CPP_OS_VXWORKS_SPEC "\
--DCPU_FAMILY=PPC \
-%{!mcpu*: \
- %{mpowerpc*: -DCPU=PPC603} \
- %{!mno-powerpc: -DCPU=PPC603}} \
-%{mcpu=powerpc: -DCPU=PPC603} \
-%{mcpu=401: -DCPU=PPC403} \
-%{mcpu=403: -DCPU=PPC403} \
-%{mcpu=405: -DCPU=PPC405} \
-%{mcpu=601: -DCPU=PPC601} \
-%{mcpu=602: -DCPU=PPC603} \
-%{mcpu=603: -DCPU=PPC603} \
-%{mcpu=603e: -DCPU=PPC603} \
-%{mcpu=ec603e: -DCPU=PPC603} \
-%{mcpu=604: -DCPU=PPC604} \
-%{mcpu=604e: -DCPU=PPC604} \
-%{mcpu=620: -DCPU=PPC604} \
-%{mcpu=740: -DCPU=PPC603} \
-%{mcpu=7450: -DCPU=PPC603} \
-%{mcpu=750: -DCPU=PPC603} \
-%{mcpu=801: -DCPU=PPC603} \
-%{mcpu=821: -DCPU=PPC603} \
-%{mcpu=823: -DCPU=PPC603} \
-%{mcpu=860: -DCPU=PPC603}"
-
/* WindISS support. */
#define LIB_WINDISS_SPEC "--start-group -li -lcfp -lwindiss -lram -limpl -limpfp --end-group"
@@ -1260,7 +1216,6 @@ ncrtn.o%s"
{ "lib_gnu", LIB_GNU_SPEC }, \
{ "lib_linux", LIB_LINUX_SPEC }, \
{ "lib_netbsd", LIB_NETBSD_SPEC }, \
- { "lib_vxworks", LIB_VXWORKS_SPEC }, \
{ "lib_windiss", LIB_WINDISS_SPEC }, \
{ "lib_default", LIB_DEFAULT_SPEC }, \
{ "startfile_ads", STARTFILE_ADS_SPEC }, \
@@ -1271,7 +1226,6 @@ ncrtn.o%s"
{ "startfile_gnu", STARTFILE_GNU_SPEC }, \
{ "startfile_linux", STARTFILE_LINUX_SPEC }, \
{ "startfile_netbsd", STARTFILE_NETBSD_SPEC }, \
- { "startfile_vxworks", STARTFILE_VXWORKS_SPEC }, \
{ "startfile_windiss", STARTFILE_WINDISS_SPEC }, \
{ "startfile_default", STARTFILE_DEFAULT_SPEC }, \
{ "endfile_ads", ENDFILE_ADS_SPEC }, \
@@ -1282,7 +1236,6 @@ ncrtn.o%s"
{ "endfile_gnu", ENDFILE_GNU_SPEC }, \
{ "endfile_linux", ENDFILE_LINUX_SPEC }, \
{ "endfile_netbsd", ENDFILE_NETBSD_SPEC }, \
- { "endfile_vxworks", ENDFILE_VXWORKS_SPEC }, \
{ "endfile_windiss", ENDFILE_WINDISS_SPEC }, \
{ "endfile_default", ENDFILE_DEFAULT_SPEC }, \
{ "link_path", LINK_PATH_SPEC }, \
@@ -1297,7 +1250,6 @@ ncrtn.o%s"
{ "link_start_gnu", LINK_START_GNU_SPEC }, \
{ "link_start_linux", LINK_START_LINUX_SPEC }, \
{ "link_start_netbsd", LINK_START_NETBSD_SPEC }, \
- { "link_start_vxworks", LINK_START_VXWORKS_SPEC }, \
{ "link_start_windiss", LINK_START_WINDISS_SPEC }, \
{ "link_start_default", LINK_START_DEFAULT_SPEC }, \
{ "link_os", LINK_OS_SPEC }, \
@@ -1309,7 +1261,6 @@ ncrtn.o%s"
{ "link_os_linux", LINK_OS_LINUX_SPEC }, \
{ "link_os_gnu", LINK_OS_GNU_SPEC }, \
{ "link_os_netbsd", LINK_OS_NETBSD_SPEC }, \
- { "link_os_vxworks", LINK_OS_VXWORKS_SPEC }, \
{ "link_os_windiss", LINK_OS_WINDISS_SPEC }, \
{ "link_os_default", LINK_OS_DEFAULT_SPEC }, \
{ "cc1_endian_big", CC1_ENDIAN_BIG_SPEC }, \
@@ -1323,7 +1274,6 @@ ncrtn.o%s"
{ "cpp_os_gnu", CPP_OS_GNU_SPEC }, \
{ "cpp_os_linux", CPP_OS_LINUX_SPEC }, \
{ "cpp_os_netbsd", CPP_OS_NETBSD_SPEC }, \
- { "cpp_os_vxworks", CPP_OS_VXWORKS_SPEC }, \
{ "cpp_os_windiss", CPP_OS_WINDISS_SPEC }, \
{ "cpp_os_default", CPP_OS_DEFAULT_SPEC },
===================================================================
Index: config/rs6000/t-vxworks
--- config/rs6000/t-vxworks 1 Jan 1970 00:00:00 -0000
+++ config/rs6000/t-vxworks 29 Oct 2002 07:52:21 -0000
@@ -0,0 +1,7 @@
+# Multilibs for VxWorks.
+
+MULTILIB_OPTIONS = t403/t405/t440/t603/t604/t860
+MULTILIB_DIRNAMES = PPC403gnu PPC405gnu PPC440gnu \
+ PPC603gnu PPC604gnu PPC860gnu
+
+MULTILIB_MATCHES = t604=
===================================================================
Index: config/rs6000/vxworks.h
--- config/rs6000/vxworks.h 1 Jan 1970 00:00:00 -0000
+++ config/rs6000/vxworks.h 29 Oct 2002 07:52:22 -0000
@@ -0,0 +1,81 @@
+/* Definitions of target machine for GNU compiler. Vxworks PowerPC version.
+ Copyright (C) 1996, 2000, 2002 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. */
+
+/* N.B. Only big endian PPC is supported by VxWorks. */
+
+#undef CPP_PREDEFINES
+#define CPP_PREDEFINES \
+ "-D__vxworks -D__vxworks__ -D_BIG_ENDIAN -D__BIG_ENDIAN__"
+
+/* We have to kill off the entire specs set created by rs6000/sysv4.h
+ and substitute our own set. The top level vxworks.h has done some
+ of this for us. */
+
+#undef SUBTARGET_EXTRA_SPECS
+#undef CPP_SPEC
+#undef CC1_SPEC
+#undef ASM_SPEC
+
+#define SUBTARGET_EXTRA_SPECS /* none needed */
+
+#define CPP_SPEC \
+"-DCPU_FAMILY=PPC -D__ppc -D__EABI__ -D__ELF__ \
+ %{t403: -DCPU=PPC403 -D_SOFT_FLOAT ; \
+ t405: -DCPU=PPC405 -D_SOFT_FLOAT ; \
+ t440: -DCPU=PPC440 -D_SOFT_FLOAT ; \
+ t603: -DCPU=PPC603 ; \
+ t604: -DCPU=PPC604 ; \
+ t860: -DCPU=PPC860 -D_SOFT_FLOAT ; \
+ : -DCPU=PPC604} \
+ %{!msoft-float:-D__hardfp} \
+ %{fpic: -D__PIC__=1 -D__pic__=1 ; \
+ fPIC: -D__PIC__=2 -D__pic__=2 } \
+ %(cpp_cpu)"
+
+/* N.B. GCC does not currently support the 440 processor as distinct
+ from the 405 series. */
+#define CC1_SPEC \
+"%{t403: -mcpu=403 -mstrict-align ; \
+ t405: -mcpu=405 -mstrict-align ; \
+ t440: -mcpu=405 -mstrict-align ; \
+ t603: -mcpu=603 -mstrict-align ; \
+ t604: -mcpu=604 -mstrict-align ; \
+ t860: -mcpu=860 ; \
+ : -mcpu=604 -mstrict-align } \
+ %{G*} %{mno-sdata:-msdata=none} %{msdata:-msdata=default} \
+ %{mlittle|mlittle-endian:-mstrict-align} \
+ %{profile: -p} \
+ %{fvec:-maltivec} %{fvec-eabi:-maltivec -mabi=altivec}"
+
+#define ASM_SPEC "%(asm_cpu) \
+%{.s: %{mregnames} %{mno-regnames}} %{.S: %{mregnames} %{mno-regnames}} \
+%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \
+%{mrelocatable} %{mrelocatable-lib} %{fpic:-K PIC} %{fPIC:-K PIC} -mbig"
+
+#undef MULTILIB_DEFAULTS
+#define MULTILIB_DEFAULTS { "t604" }
+
+/* We can't use .ctors/.dtors sections. */
+#undef TARGET_ASM_OUTPUT_CONSTRUCTOR
+#undef TARGET_ASM_OUTPUT_DESTRUCTOR
+
+/* Nor sdata. */
+#undef SDATA_DEFAULT_SIZE
+#define SDATA_DEFAULT_SIZE 0