Port-powerpc archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
GCC>3.0 NetBSD/PPC support
[yes I know, its a cross post.]
Hello,
Unless somone screams I'm going to try to get the attached merged into
the GCC>3.0 tree. It adds what appears to be working NetBSD/PowerPC
support. The C compiler certainly works, G++ and F77 don't badly fail,
not sure about exceptions, ...
For reference, the port in the NetBSD tree looks nothing like this.
A few of those long in the tooth should appreciate the irony in me doing
this GCC port :-)
Andrew
2001-07-09 Andrew Cagney <ac131313%redhat.com@localhost>
* config.gcc: Recognize powerpc-*-netbsd*.
* config/rs6000/netbsd.h: New file.
* config/rs6000/t-ppccomm (EXTRA_MULTILIB_PARTS): Add
ncrti$(objext) and ncrtn$(objext).
(ncrti.S, ncrtn.S): New targets.
($(T)ncrti$(objext), $(T)ncrtn$(objext)): New targets.
* config/rs6000/sysv4.h (ASM_SPEC): Check for -mcall-netbsd.
(CC1_SPEC, CC1_SPEC, LINK_START_SPEC, LINK_OS_SPEC): Ditto.
(CPP_ENDIAN_SPEC, CPP_SPEC, STARTFILE_SPEC): Ditto.
(LIB_SPEC, ENDFILE_SPEC): Ditto.
(LIB_NETBSD_SPEC, STARTFILE_NETBSD_SPEC): Define.
(ENDFILE_NETBSD_SPEC, LINK_START_NETBSD_SPEC): Define.
(LINK_OS_NETBSD_SPEC, CPP_OS_NETBSD_SPEC): Define.
(SUBTARGET_EXTRA_SPECS): Add NetBSD specs.
Index: gcc/config/rs6000/netbsd.h
===================================================================
RCS file: netbsd.h
diff -N netbsd.h
*** /dev/null Tue May 5 13:32:27 1998
--- netbsd.h Mon Jul 9 06:57:00 2001
***************
*** 0 ****
--- 1,48 ----
+ /* Definitions of target machine for GNU compiler,
+ for PowerPC NetBSD systems.
+ Copyright 2001 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. */
+
+ /* Under NetBSD, the normal location of the various *crt*.o files is
+ the /usr/lib directory [from config/netbsd.h]. */
+
+ #undef STANDARD_STARTFILE_PREFIX
+ #define STANDARD_STARTFILE_PREFIX "/usr/lib/"
+
+ /* Override the defaults. */
+ #undef LIB_DEFAULT_SPEC
+ #define LIB_DEFAULT_SPEC "%(lib_netbsd)"
+
+ #undef STARTFILE_DEFAULT_SPEC
+ #define STARTFILE_DEFAULT_SPEC "%(startfile_netbsd)"
+
+ #undef ENDFILE_DEFAULT_SPEC
+ #define ENDFILE_DEFAULT_SPEC "%(endfile_netbsd)"
+
+ #undef LINK_START_DEFAULT_SPEC
+ #define LINK_START_DEFAULT_SPEC "%(link_start_netbsd)"
+
+ #undef LINK_OS_DEFAULT_SPEC
+ #define LINK_OS_DEFAULT_SPEC "%(link_os_netbsd)"
+
+ #undef CPP_OS_DEFAULT_SPEC
+ #define CPP_OS_DEFAULT_SPEC "%(cpp_os_netbsd)"
+
+ #undef TARGET_VERSION
+ #define TARGET_VERSION fprintf (stderr, " (PowerPC NetBSD/ELF)");
Index: gcc/config/rs6000/sysv4.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/sysv4.h,v
retrieving revision 1.48
diff -p -r1.48 sysv4.h
*** sysv4.h 2001/05/15 19:50:49 1.48
--- sysv4.h 2001/07/09 13:57:06
*************** do {
\
*** 1040,1046 ****
%{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
%{mcall-solaris: -mlittle -msolaris} \
%{mcall-i960-old: -mlittle} \
! %{mcall-linux: -mbig} }}}}"
#define CC1_ENDIAN_BIG_SPEC ""
--- 1040,1047 ----
%{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
%{mcall-solaris: -mlittle -msolaris} \
%{mcall-i960-old: -mlittle} \
! %{mcall-linux: -mbig} \
! %{mcall-netbsd: -mbig} }}}}"
#define CC1_ENDIAN_BIG_SPEC ""
*************** do {
\
*** 1062,1070 ****
%{mcall-solaris: -mlittle %(cc1_endian_little) } \
%{mcall-i960-old: -mlittle %(cc1_endian_little) } \
%{mcall-linux: -mbig %(cc1_endian_big) } \
! %{!mcall-aixdesc: %{!mcall-solaris: %{!mcall-i960-old: %{!mcall-linux: \
%(cc1_endian_default) \
! }}}} \
}}}} \
%{mcall-solaris: -mregnames } \
%{mno-sdata: -msdata=none } \
--- 1063,1072 ----
%{mcall-solaris: -mlittle %(cc1_endian_little) } \
%{mcall-i960-old: -mlittle %(cc1_endian_little) } \
%{mcall-linux: -mbig %(cc1_endian_big) } \
! %{mcall-netbsd: -mbig %(cc1_endian_big) } \
! %{!mcall-aixdesc: %{!mcall-solaris: %{!mcall-i960-old: %{!mcall-linux:
%{!mcall-netbsd: \
%(cc1_endian_default) \
! }}}}} \
}}}} \
%{mcall-solaris: -mregnames } \
%{mno-sdata: -msdata=none } \
*************** do {
\
*** 1073,1079 ****
%{mrelocatable: -meabi } \
%{mcall-solaris: -mno-eabi } \
%{mcall-i960-old: -meabi } \
! %{mcall-linux: -mno-eabi }}} \
%{msdata: -msdata=default} \
%{mno-sdata: -msdata=none} \
%{profile: -p}"
--- 1075,1082 ----
%{mrelocatable: -meabi } \
%{mcall-solaris: -mno-eabi } \
%{mcall-i960-old: -meabi } \
! %{mcall-linux: -mno-eabi } \
! %{mcall-netbsd: -mno-eabi }}} \
%{msdata: -msdata=default} \
%{mno-sdata: -msdata=none} \
%{profile: -p}"
*************** do {
\
*** 1102,1109 ****
%{mmvme: %(link_start_mvme) } \
%{msim: %(link_start_sim) } \
%{mcall-linux: %(link_start_linux) } \
%{mcall-solaris: %(link_start_solaris) } \
! %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-linux:
%{!mcall-solaris: %(link_start_default) }}}}}}"
#define LINK_START_DEFAULT_SPEC ""
--- 1105,1113 ----
%{mmvme: %(link_start_mvme) } \
%{msim: %(link_start_sim) } \
%{mcall-linux: %(link_start_linux) } \
+ %{mcall-netbsd: %(link_start_netbsd) } \
%{mcall-solaris: %(link_start_solaris) } \
! %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-netbsd:
%{!mcall-solaris: %(link_start_default) }}}}}}}"
#define LINK_START_DEFAULT_SPEC ""
*************** do {
\
*** 1157,1164 ****
%{mmvme: %(link_os_mvme) } \
%{msim: %(link_os_sim) } \
%{mcall-linux: %(link_os_linux) } \
%{mcall-solaris: %(link_os_solaris) } \
! %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-linux:
%{!mcall-solaris: %(link_os_default) }}}}}}"
#define LINK_OS_DEFAULT_SPEC ""
--- 1161,1169 ----
%{mmvme: %(link_os_mvme) } \
%{msim: %(link_os_sim) } \
%{mcall-linux: %(link_os_linux) } \
+ %{mcall-netbsd: %(link_os_netbsd) } \
%{mcall-solaris: %(link_os_solaris) } \
! %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-netbsd:
%{!mcall-solaris: %(link_os_default) }}}}}}}"
#define LINK_OS_DEFAULT_SPEC ""
*************** do {
\
*** 1205,1213 ****
%{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
%{mcall-solaris: %(cpp_endian_solaris) } \
%{mcall-linux: %(cpp_endian_big) } \
%{mcall-i960-old: %(cpp_endian_little) } \
%{mcall-aixdesc: %(cpp_endian_big) } \
! %{!mcall-solaris: %{!mcall-linux: %{!mcall-aixdesc: %(cpp_endian_default)
}}}}}}}"
#define CPP_ENDIAN_DEFAULT_SPEC "%(cpp_endian_big)"
--- 1210,1219 ----
%{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
%{mcall-solaris: %(cpp_endian_solaris) } \
%{mcall-linux: %(cpp_endian_big) } \
+ %{mcall-netbsd: %(cpp_endian_big) } \
%{mcall-i960-old: %(cpp_endian_little) } \
%{mcall-aixdesc: %(cpp_endian_big) } \
! %{!mcall-solaris: %{!mcall-linux: %{!mcall-netbsd: %{!mcall-aixdesc:
%(cpp_endian_default) }}}}}}}}"
#define CPP_ENDIAN_DEFAULT_SPEC "%(cpp_endian_big)"
*************** do {
\
*** 1219,1226 ****
%{mmvme: %(cpp_os_mvme) } \
%{msim: %(cpp_os_sim) } \
%{mcall-linux: %(cpp_os_linux) } \
%{mcall-solaris: %(cpp_os_solaris) } \
! %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-linux:
%{!mcall-solaris: %(cpp_os_default) }}}}}}"
#define CPP_OS_DEFAULT_SPEC ""
--- 1225,1233 ----
%{mmvme: %(cpp_os_mvme) } \
%{msim: %(cpp_os_sim) } \
%{mcall-linux: %(cpp_os_linux) } \
+ %{mcall-netbsd: %(cpp_os_netbsd) } \
%{mcall-solaris: %(cpp_os_solaris) } \
! %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-netbsd:
%{!mcall-solaris: %(cpp_os_default) }}}}}}}"
#define CPP_OS_DEFAULT_SPEC ""
*************** do {
\
*** 1232,1239 ****
%{mmvme: %(startfile_mvme) } \
%{msim: %(startfile_sim) } \
%{mcall-linux: %(startfile_linux) } \
%{mcall-solaris: %(startfile_solaris) } \
! %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-linux:
%{!mcall-solaris: %(startfile_default) }}}}}}"
#define STARTFILE_DEFAULT_SPEC ""
--- 1239,1247 ----
%{mmvme: %(startfile_mvme) } \
%{msim: %(startfile_sim) } \
%{mcall-linux: %(startfile_linux) } \
+ %{mcall-netbsd: %(startfile_netbsd) } \
%{mcall-solaris: %(startfile_solaris) } \
! %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-netbsd:
%{!mcall-solaris: %(startfile_default) }}}}}}}"
#define STARTFILE_DEFAULT_SPEC ""
*************** do {
\
*** 1245,1252 ****
%{mmvme: %(lib_mvme) } \
%{msim: %(lib_sim) } \
%{mcall-linux: %(lib_linux) } \
%{mcall-solaris: %(lib_solaris) } \
! %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-linux:
%{!mcall-solaris: %(lib_default) }}}}}}"
#define LIB_DEFAULT_SPEC ""
--- 1253,1261 ----
%{mmvme: %(lib_mvme) } \
%{msim: %(lib_sim) } \
%{mcall-linux: %(lib_linux) } \
+ %{mcall-netbsd: %(lib_netbsd) } \
%{mcall-solaris: %(lib_solaris) } \
! %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-netbsd:
%{!mcall-solaris: %(lib_default) }}}}}}}"
#define LIB_DEFAULT_SPEC ""
*************** do {
\
*** 1258,1266 ****
%{mmvme: %(endfile_mvme)} \
%{msim: %(endfile_sim)} \
%{mcall-linux: %(endfile_linux) } \
%{mcall-solaris: %(endfile_solaris)} \
%{mvxworks: %(endfile_vxworks) } \
! %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-linux:
%{!mcall-solaris: %{!mvxworks: %(endfile_default) }}}}}}}"
#define ENDFILE_DEFAULT_SPEC ""
--- 1267,1276 ----
%{mmvme: %(endfile_mvme)} \
%{msim: %(endfile_sim)} \
%{mcall-linux: %(endfile_linux) } \
+ %{mcall-netbsd: %(endfile_netbsd) } \
%{mcall-solaris: %(endfile_solaris)} \
%{mvxworks: %(endfile_vxworks) } \
! %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-netbsd:
%{!mcall-solaris: %{!mvxworks: %(endfile_default) }}}}}}}}"
#define ENDFILE_DEFAULT_SPEC ""
*************** do {
\
*** 1356,1361 ****
--- 1366,1394 ----
-Asystem=unix -Asystem=posix %{pthread:-D_REENTRANT}"
#endif
+ /* NetBSD support. */
+ #define LIB_NETBSD_SPEC "\
+ %{profile:-lgmon -lc_p} %{!profile:-lc}"
+
+ #define STARTFILE_NETBSD_SPEC "\
+ ncrti.o%s crt0.o%s \
+ %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
+
+ #define ENDFILE_NETBSD_SPEC "\
+ %{!shared:crtend.o%s} %{shared:crtendS.o%s} \
+ ncrtn.o%s"
+
+ #define LINK_START_NETBSD_SPEC "\
+ "
+
+ #define LINK_OS_NETBSD_SPEC "\
+ %{!shared: %{!static: \
+ %{rdynamic:-export-dynamic} \
+ %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}}}"
+
+ #define CPP_OS_NETBSD_SPEC "\
+ -D__powerpc__ -D__NetBSD__ -D__ELF__ -D__KPRINTF_ATTRIBUTE__"
+
/* Solaris support. */
/* For Solaris, Gcc automatically adds in one of the files
/usr/ccs/lib/values-Xc.o, /usr/ccs/lib/values-Xa.o, or
*************** do {
\
*** 1451,1456 ****
--- 1484,1490 ----
{ "lib_mvme", LIB_MVME_SPEC },
\
{ "lib_sim", LIB_SIM_SPEC },
\
{ "lib_linux", LIB_LINUX_SPEC }, \
+ { "lib_netbsd", LIB_NETBSD_SPEC }, \
{ "lib_solaris", LIB_SOLARIS_SPEC }, \
{ "lib_vxworks", LIB_VXWORKS_SPEC }, \
{ "lib_default", LIB_DEFAULT_SPEC }, \
*************** do {
\
*** 1459,1464 ****
--- 1493,1499 ----
{ "startfile_mvme", STARTFILE_MVME_SPEC }, \
{ "startfile_sim", STARTFILE_SIM_SPEC }, \
{ "startfile_linux", STARTFILE_LINUX_SPEC },
\
+ { "startfile_netbsd", STARTFILE_NETBSD_SPEC },
\
{ "startfile_solaris", STARTFILE_SOLARIS_SPEC }, \
{ "startfile_vxworks", STARTFILE_VXWORKS_SPEC }, \
{ "startfile_default", STARTFILE_DEFAULT_SPEC }, \
*************** do {
\
*** 1467,1472 ****
--- 1502,1508 ----
{ "endfile_mvme", ENDFILE_MVME_SPEC }, \
{ "endfile_sim", ENDFILE_SIM_SPEC }, \
{ "endfile_linux", ENDFILE_LINUX_SPEC }, \
+ { "endfile_netbsd", ENDFILE_NETBSD_SPEC }, \
{ "endfile_solaris", ENDFILE_SOLARIS_SPEC },
\
{ "endfile_vxworks", ENDFILE_VXWORKS_SPEC },
\
{ "endfile_default", ENDFILE_DEFAULT_SPEC },
\
*************** do {
\
*** 1479,1484 ****
--- 1515,1521 ----
{ "link_start_mvme", LINK_START_MVME_SPEC },
\
{ "link_start_sim", LINK_START_SIM_SPEC }, \
{ "link_start_linux", LINK_START_LINUX_SPEC },
\
+ { "link_start_netbsd", LINK_START_NETBSD_SPEC }, \
{ "link_start_solaris", LINK_START_SOLARIS_SPEC }, \
{ "link_start_vxworks", LINK_START_VXWORKS_SPEC }, \
{ "link_start_default", LINK_START_DEFAULT_SPEC }, \
*************** do {
\
*** 1488,1493 ****
--- 1525,1531 ----
{ "link_os_mvme", LINK_OS_MVME_SPEC }, \
{ "link_os_sim", LINK_OS_SIM_SPEC }, \
{ "link_os_linux", LINK_OS_LINUX_SPEC }, \
+ { "link_os_netbsd", LINK_OS_NETBSD_SPEC }, \
{ "link_os_solaris", LINK_OS_SOLARIS_SPEC },
\
{ "link_os_vxworks", LINK_OS_VXWORKS_SPEC },
\
{ "link_os_default", LINK_OS_DEFAULT_SPEC },
\
*************** do {
\
*** 1504,1509 ****
--- 1542,1548 ----
{ "cpp_os_mvme", CPP_OS_MVME_SPEC }, \
{ "cpp_os_sim", CPP_OS_SIM_SPEC }, \
{ "cpp_os_linux", CPP_OS_LINUX_SPEC }, \
+ { "cpp_os_netbsd", CPP_OS_NETBSD_SPEC }, \
{ "cpp_os_solaris", CPP_OS_SOLARIS_SPEC }, \
{ "cpp_os_vxworks", CPP_OS_VXWORKS_SPEC }, \
{ "cpp_os_default", CPP_OS_DEFAULT_SPEC },
Index: gcc/config/rs6000/t-ppccomm
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/t-ppccomm,v
retrieving revision 1.10
diff -p -r1.10 t-ppccomm
*** t-ppccomm 2001/05/17 03:16:11 1.10
--- t-ppccomm 2001/07/09 13:57:06
*************** MULTILIB_MATCHES_FLOAT = msoft-float=mcp
*** 33,49 ****
msoft-float=mcpu?823 \
msoft-float=mcpu?860
MULTILIB_MATCHES_ENDIAN = mlittle=mlittle-endian mbig=mbig-endian
! MULTILIB_MATCHES_SYSV = mcall-sysv=mcall-sysv-eabi
mcall-sysv=mcall-sysv-noeabi mcall-sysv=mcall-linux
LIBGCC = stmp-multilib
INSTALL_LIBGCC = install-multilib
EXTRA_MULTILIB_PARTS = crtbegin$(objext) crtend$(objext) \
crtbeginS$(objext) crtendS$(objext) \
! ecrti$(objext) ecrtn$(objext) scrt0$(objext) scrti$(objext) scrtn$(objext)
- # We build {e,s}crti.o, {e,s}crtn.o, and scrt0.o which serve to add begin and
- # end labels to all of the special sections used when we link using gcc.
-
# Assemble startup files.
ecrti.S: $(srcdir)/config/rs6000/eabi-ci.asm
cat $(srcdir)/config/rs6000/eabi-ci.asm >ecrti.S
--- 33,52 ----
msoft-float=mcpu?823 \
msoft-float=mcpu?860
MULTILIB_MATCHES_ENDIAN = mlittle=mlittle-endian mbig=mbig-endian
! MULTILIB_MATCHES_SYSV = mcall-sysv=mcall-sysv-eabi
mcall-sysv=mcall-sysv-noeabi mcall-sysv=mcall-linux mcall-sysv=mcall-netbsd
LIBGCC = stmp-multilib
INSTALL_LIBGCC = install-multilib
EXTRA_MULTILIB_PARTS = crtbegin$(objext) crtend$(objext) \
crtbeginS$(objext) crtendS$(objext) \
! ecrti$(objext) ecrtn$(objext) \
! scrt0$(objext) scrti$(objext) scrtn$(objext) \
! ncrti$(objext) ncrtn$(objext)
!
! # We build {e,s}crti.o, {e,s}crtn.o, and {s,n}crt0.o which serve to
! # add begin and end labels to all of the special sections used when we
! # link using gcc.
# Assemble startup files.
ecrti.S: $(srcdir)/config/rs6000/eabi-ci.asm
cat $(srcdir)/config/rs6000/eabi-ci.asm >ecrti.S
*************** ecrti.S: $(srcdir)/config/rs6000/eabi-ci
*** 51,56 ****
--- 54,67 ----
ecrtn.S: $(srcdir)/config/rs6000/eabi-cn.asm
cat $(srcdir)/config/rs6000/eabi-cn.asm >ecrtn.S
+ ncrti.S: $(srcdir)/config/rs6000/sol-ci.asm
+ sed -e 's/__init/_init/' -e 's/__fini/_fini/' \
+ $(srcdir)/config/rs6000/sol-ci.asm >ncrti.S
+
+ ncrtn.S: $(srcdir)/config/rs6000/sol-cn.asm
+ sed -e 's/__init/_init/' -e 's/__fini/_fini/' \
+ $(srcdir)/config/rs6000/sol-cn.asm >ncrtn.S
+
scrti.S: $(srcdir)/config/rs6000/sol-ci.asm
cat $(srcdir)/config/rs6000/sol-ci.asm >scrti.S
*************** $(T)ecrti$(objext): ecrti.S
*** 66,71 ****
--- 77,88 ----
$(T)ecrtn$(objext): ecrtn.S
$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c
ecrtn.S -o $(T)ecrtn$(objext)
+
+ $(T)ncrti$(objext): ncrti.S
+ $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c
ncrti.S -o $(T)ncrti$(objext)
+
+ $(T)ncrtn$(objext): ncrtn.S
+ $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c
ncrtn.S -o $(T)ncrtn$(objext)
$(T)scrti$(objext): scrti.S
$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c
scrti.S -o $(T)scrti$(objext)
Home |
Main Index |
Thread Index |
Old Index