This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH 3.0] add FreeBSD PowerPC target
- To: gcc-patches at gcc dot gnu dot org
- Subject: [PATCH 3.0] add FreeBSD PowerPC target
- From: "David O'Brien" <obrien at FreeBSD dot org>
- Date: Sat, 12 May 2001 03:44:44 -0700
- Organization: The NUXI BSD group
- Reply-To: obrien at FreeBSD dot org
This patch adds FreeBSD/PowerPC suport. It touches as little non-FreeBSD
bits as possible.
Index: config.gcc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config.gcc,v
retrieving revision 1.27.2.6
diff -u -r1.27.2.6 config.gcc
--- config.gcc 2001/04/26 16:04:12 1.27.2.6
+++ config.gcc 2001/05/12 10:29:29
@@ -257,6 +257,13 @@
# Common parts for GNU/Linux, GNU/Hurd and OpenBSD systems.
case $machine in
+i[34567]86-*-freebsd[12] | i[34567]86-*-freebsd[12].* | i[34567]86-*-freebsd*aout*)
+ # FreeBSD a.out hosts are a different beast...
+ ;;
+*-*-freebsd*)
+ gas=yes gnu_ld=yes
+ stabs=yes
+ ;;
*-*-linux*)
xm_defines="POSIX"
;;
@@ -400,8 +407,6 @@
tmake_file="t-freebsd alpha/t-crtbe alpha/t-alpha alpha/t-ieee"
extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o"
xmake_file=none
- gas=yes gnu_ld=yes
- stabs=yes
case x${enable_threads} in
xyes | xpthreads | xposix)
thread_file='posix'
@@ -1087,12 +1104,9 @@
tmake_file=t-freebsd
;;
i[34567]86-*-freebsd*)
- tm_file="i386/i386.h i386/att.h svr4.h freebsd.h i386/freebsd.h i386/perform.h"
+ tm_file="i386/i386.h i386/att.h elfos.h freebsd.h i386/freebsd.h i386/perform.h"
extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
tmake_file=t-freebsd
- gas=yes
- gnu_ld=yes
- stabs=yes
case x${enable_threads} in
xyes | xpthreads | xposix)
thread_file='posix'
@@ -2783,6 +2810,19 @@
thread_file='rtems'
fi
;;
+powerpc*-*-freebsd*)
+ tm_file="${tm_file} elfos.h freebsd.h rs6000/sysv4.h rs6000/freebsd.h"
+ xm_file=rs6000/xm-sysv4.h
+ out_file=rs6000/rs6000.c
+ tmake_file="rs6000/t-ppcos t-freebsd rs6000/t-ppccomm"
+ extra_headers=ppc-asm.h
+ case x${enable_threads} in
+ xyes | xpthreads | xposix)
+ thread_file='posix'
+ tmake_file="${tmake_file} t-freebsd-thread"
+ ;;
+ esac
+ ;;
powerpc-*-linux*libc1)
tm_file="${tm_file} svr4.h rs6000/sysv4.h rs6000/linux.h"
xm_file=rs6000/xm-sysv4.h
Index: config/elfos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/elfos.h,v
retrieving revision 1.25.2.1
diff -u -r1.25.2.1 elfos.h
--- elfos.h 2001/04/16 18:25:40 1.25.2.1
+++ elfos.h 2001/05/12 10:29:29
@@ -21,6 +21,10 @@
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+
+/* Define a symbol indicating that we are using elfos.h. */
+#define USING_ELFOS_H
+
/* The prefix to add to user-visible assembler symbols.
For ELF systems the convention is *not* to prepend a leading
Index: config/freebsd.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/freebsd.h,v
retrieving revision 1.5.4.1
diff -u -r1.5.4.1 freebsd.h
--- freebsd.h 2001/04/16 18:25:40 1.5.4.1
+++ freebsd.h 2001/05/12 10:29:29
@@ -36,26 +36,40 @@
|| (CHAR) == 'z' /* ignored by ld */ \
|| (CHAR) == 'R')
-#undef SWITCH_TAKES_ARG
+#undef SWITCH_TAKES_ARG
#define SWITCH_TAKES_ARG(CHAR) (FBSD_SWITCH_TAKES_ARG(CHAR))
+/* This defines which multi-letter switches take arguments. */
+
#define FBSD_WORD_SWITCH_TAKES_ARG(STR) \
(DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \
|| !strcmp ((STR), "rpath") || !strcmp ((STR), "rpath-link") \
|| !strcmp ((STR), "soname") || !strcmp ((STR), "defsym") \
|| !strcmp ((STR), "assert") || !strcmp ((STR), "dynamic-linker"))
-#undef WORD_SWITCH_TAKES_ARG
+#undef WORD_SWITCH_TAKES_ARG
#define WORD_SWITCH_TAKES_ARG(STR) (FBSD_WORD_SWITCH_TAKES_ARG(STR))
+/* This is used in the native FreeBSD Gcc to produce
+ the final CPP_PREDEFINES value. */
+
+#define FBSD_CPP_PREDEFINES \
+ "-D__ELF__ -D__FreeBSD__ -Dunix -Asystem(unix) -Asystem(bsd) -Asystem(FreeBSD)"
+
+#undef CPP_PREDEFINES
+#define CPP_PREDEFINES FBSD_CPP_PREDEFINES
+
/* Provide a CPP_SPEC appropriate for FreeBSD. We just deal with the GCC
option `-posix', and PIC issues. */
-#undef CPP_SPEC
-#define CPP_SPEC "%(cpp_cpu) \
+#define FBSD_CPP_SPEC " \
+ %(cpp_cpu) \
%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} \
%{posix:-D_POSIX_SOURCE}"
+#undef CPP_SPEC
+#define CPP_SPEC FBSD_CPP_SPEC
+
/* Provide a LIB_SPEC appropriate for FreeBSD. Just select the appropriate
libc, depending on whether we're doing profiling or need threads support.
(simular to the default, except no -lg, and no -p). */
@@ -72,51 +86,72 @@
}"
-/* Code generation parameters. */
+/************************[ Target stuff ]***********************************/
-/* Make gcc agree with <machine/ansi.h>. */
+/* Don't assume anything about the header files. */
+#undef NO_IMPLICIT_EXTERN_C
+#define NO_IMPLICIT_EXTERN_C
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "int"
+/* Allow #sccs in preprocessor. */
+#undef SCCS_DIRECTIVE
+#define SCCS_DIRECTIVE
-#undef WCHAR_UNSIGNED
-#define WCHAR_UNSIGNED 0
+/* Code generation parameters. */
/* Don't default to pcc-struct-return, because gcc is the only compiler, and
we want to retain compatibility with older gcc versions
(even though the SVR4 ABI for the i386 says that records and unions are
returned in memory). */
-#undef DEFAULT_PCC_STRUCT_RETURN
+#undef DEFAULT_PCC_STRUCT_RETURN
#define DEFAULT_PCC_STRUCT_RETURN 0
-/* Ensure we the configuration knows our system correctly so we can link with
- libraries compiled with the native cc. */
+/* Writing `int' for a bitfield forces int alignment for the structure. */
+#undef PCC_BITFIELD_TYPE_MATTERS
+#define PCC_BITFIELD_TYPE_MATTERS 1
+
+/* Use periods rather than dollar signs in special g++ assembler names.
+ This ensures the configuration knows our system correctly so we can link
+ with libraries compiled with the native cc. */
#undef NO_DOLLAR_IN_LABEL
+/* The prefix to add to user-visible assembler symbols.
+ For System V Release 4 & ELF the convention is *not* to prepend a leading
+ underscore onto user-level symbol names. */
+
+#undef USER_LABEL_PREFIX
+#define USER_LABEL_PREFIX ""
+
+/* Handle #pragma weak and #pragma pack. */
+#undef HANDLE_SYSV_PRAGMA
+#define HANDLE_SYSV_PRAGMA
+
/* Use more efficient ``thunks'' to implement C++ vtables. */
#undef DEFAULT_VTABLE_THUNKS
#define DEFAULT_VTABLE_THUNKS 1
-/* This is BSD, so use stabs instead of DWARF debug format. */
-#undef PREFERRED_DEBUGGING_TYPE
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
+/************************[ Assembler stuff ]********************************/
-#undef IDENT_ASM_OP
+/* Attach a special .ident directive to the end of the file to identify
+ the version of GCC which compiled this code. The format of the .ident
+ string is patterned after the ones produced by native SVR4 C compilers. */
+
+#undef IDENT_ASM_OP
#define IDENT_ASM_OP "\t.ident\t"
/* Output #ident as a .ident. */
-#undef ASM_OUTPUT_IDENT
+
+#undef ASM_OUTPUT_IDENT
#define ASM_OUTPUT_IDENT(FILE, NAME) \
fprintf ((FILE), "%s\"%s\"\n", IDENT_ASM_OP, (NAME));
-/* Miscellaneous parameters. */
-
-/* Don't assume anything about the header files. */
-#undef NO_IMPLICIT_EXTERN_C
-#define NO_IMPLICIT_EXTERN_C
-
-/* Allow #sccs in preprocessor. */
-#define SCCS_DIRECTIVE
-
-/* Handle #pragma weak and #pragma pack. */
-#define HANDLE_SYSV_PRAGMA
+/* All ELF targets can support DWARF-2. */
+#undef DWARF2_DEBUGGING_INFO
+#define DWARF2_DEBUGGING_INFO
+
+/* This is BSD, so we want the DBX format. */
+#undef DBX_DEBUGGING_INFO
+#define DBX_DEBUGGING_INFO
+
+/* Even though this is BSD, ELF operates better with DWARF2. */
+#undef PREFERRED_DEBUGGING_TYPE
+#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
Index: config/alpha/freebsd.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/alpha/freebsd.h,v
retrieving revision 1.1
diff -u -r1.1 freebsd.h
--- freebsd.h 2000/11/07 08:44:40 1.1
+++ freebsd.h 2001/05/12 10:29:29
@@ -19,10 +19,6 @@
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES \
- "-D__ELF__ -Dunix -D__FreeBSD__ -Asystem(unix) -Asystem(bsd) -Asystem(FreeBSD)"
-
/* Provide a CPP_SPEC appropriate for FreeBSD/alpha. Besides the dealing with
the GCC option `-posix', and PIC issues as on all FreeBSD platforms, we must
deal with the Alpha's FP issues. */
@@ -47,15 +43,11 @@
%{!dynamic-linker:-dynamic-linker /usr/libexec/ld-elf.so.1}} \
%{static:-Bstatic}}"
-/* Provide an ASM_SPEC appropriate for a FreeBSD/Alpha target. This differs
- from the generic FreeBSD ASM_SPEC in that no special handling of PIC is
- necessary on the Alpha. */
-/* Per Richard Henderson <rth@cygnus.com>, it is better to use the `.arch'
- directive in the assembly file. alpha/elf.h gives us this in
- "ASM_FILE_START".
-#undef ASM_SPEC
-#define ASM_SPEC " %| %{mcpu=*:-m%*}"
-*/
+/* Note that we FreeBSD/Alpha needs a different ASM_SPEC than the generic
+ FreeBSD ASM_SPEC in that no special handling of PIC is necessary on the
+ Alpha. Per Richard Henderson <rth@cygnus.com>, it is better to use the
+ `.arch' directive in the assembly file, which alpha/elf.h gives us this
+ in "ASM_FILE_START". */
/************************[ Target stuff ]***********************************/
Index: config/i386/freebsd.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/freebsd.h,v
retrieving revision 1.25
diff -u -r1.25 freebsd.h
--- freebsd.h 2000/11/02 23:29:09 1.25
+++ freebsd.h 2001/05/12 10:29:29
@@ -77,10 +77,6 @@
#undef WCHAR_TYPE_SIZE
#define WCHAR_TYPE_SIZE BITS_PER_WORD
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dunix -D__ELF__ -D__FreeBSD__\
- -Asystem=unix -Asystem=bsd -Asystem=FreeBSD"
-
/* Provide a STARTFILE_SPEC appropriate for FreeBSD. Here we add
the magical crtbegin.o file (see crtstuff.c) which provides part
of the support for getting C++ file-scope static object constructed
Index: config/rs6000/freebsd.h
===================================================================
RCS file: freebsd.h
diff -N freebsd.h
--- /dev/null Tue May 5 13:32:27 1998
+++ freebsd.h Sat May 12 03:29:30 2001
@@ -0,0 +1,103 @@
+/* Definitions for PowerPC running FreeBSD using the ELF format
+ Copyright (C) 2001 Free Software Foundation, Inc.
+ Contributed by David E. O'Brien <obrien@FreeBSD.org> and BSDi.
+
+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, 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+/* Default ABI to compile code for. */
+#define DEFAULT_ABI rs6000_current_abi
+
+/* Default ABI to use. */
+#define RS6000_ABI_NAME "sysv"
+
+/* Override rs6000.h definition. */
+#undef ASM_DEFAULT_SPEC
+#define ASM_DEFAULT_SPEC "-mppc"
+
+/* Override rs6000.h definition. */
+#undef CPP_DEFAULT_SPEC
+#define CPP_DEFAULT_SPEC "-D_ARCH_PPC"
+
+#undef CPP_OS_DEFAULT_SPEC
+#define CPP_OS_DEFAULT_SPEC "%(cpp_os_freebsd)"
+
+#undef CPP_PREDEFINES
+#define CPP_PREDEFINES \
+ "-D__ELF__ -D__FreeBSD__ -Dunix -Asystem(unix) -Asystem(bsd) -Asystem(FreeBSD) -D__powerpc__ -D__PowerPC__ -D__ppc__ -D__PPC__ --Acpu=powerpc -Amachine=powerpc"
+
+#undef STARTFILE_DEFAULT_SPEC
+#define STARTFILE_DEFAULT_SPEC "%(startfile_freebsd)"
+
+#undef ENDFILE_DEFAULT_SPEC
+#define ENDFILE_DEFAULT_SPEC "%(endfile_freebsd)"
+
+#undef LIB_DEFAULT_SPEC
+#define LIB_DEFAULT_SPEC "%(lib_freebsd)"
+
+#undef LINK_START_DEFAULT_SPEC
+#define LINK_START_DEFAULT_SPEC "%(link_start_freebsd)"
+
+#undef LINK_OS_DEFAULT_SPEC
+#define LINK_OS_DEFAULT_SPEC "%(link_os_freebsd)"
+
+#undef LINK_SPEC
+#define LINK_SPEC "-m elf32ppc %{G*} %{relax:-relax} \
+ %{p:%e`-p' not supported; use `-pg' and gprof(1)} \
+ %{Wl,*:%*} \
+ %{assert*} %{R*} %{rpath*} %{defsym*} \
+ %{shared:-Bshareable %{h*} %{soname*}} \
+ %{symbolic:-Bsymbolic} \
+ %{!shared: \
+ %{!static: \
+ %{rdynamic:-export-dynamic} \
+ %{!dynamic-linker:-dynamic-linker /usr/libexec/ld-elf.so.1}} \
+ %{static:-Bstatic}}"
+
+
+/************************[ Target stuff ]***********************************/
+
+/* Define the actual types of some ANSI-mandated types.
+ Needs to agree with <machine/ansi.h>. GCC defaults come from c-decl.c,
+ c-common.c, and config/<arch>/<arch>.h. */
+
+/* rs6000.h gets this wrong for FreeBSD. We use the GCC defaults instead. */
+#undef WCHAR_TYPE
+
+#undef WCHAR_UNSIGNED
+#define WCHAR_UNSIGNED 0
+
+#undef WCHAR_TYPE_SIZE
+#define WCHAR_TYPE_SIZE 32
+
+#undef TARGET_VERSION
+#define TARGET_VERSION fprintf (stderr, " (FreeBSD/PowerPC ELF)");
+
+/* Override rs6000.h definition. */
+#undef TARGET_DEFAULT
+#define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS)
+
+/* Override rs6000.h definition. */
+#undef PROCESSOR_DEFAULT
+#define PROCESSOR_DEFAULT PROCESSOR_PPC750
+
+/* Override rs6000.h definition. */
+#undef ASM_APP_ON
+#define ASM_APP_ON "#APP\n"
+
+/* Override rs6000.h definition. */
+#undef ASM_APP_OFF
+#define ASM_APP_OFF "#NO_APP\n"
Index: config/rs6000/rs6000.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.167.2.2
diff -u -r1.167.2.2 rs6000.c
--- rs6000.c 2001/05/02 21:34:15 1.167.2.2
+++ rs6000.c 2001/05/12 10:29:32
@@ -75,7 +75,7 @@
get the address of the GOT section */
int rs6000_pic_labelno;
-#ifdef USING_SVR4_H
+#ifdef USING_ELFOS_H
/* Which abi to adhere to */
const char *rs6000_abi_name = RS6000_ABI_NAME;
@@ -442,7 +442,7 @@
}
}
-#ifdef USING_SVR4_H
+#ifdef USING_ELFOS_H
switch (rs6000_sdata)
{
case SDATA_NONE: fprintf (file, "%s -msdata=none", start); start = ""; break;
@@ -7497,7 +7497,7 @@
Do not define this macro if you put all constants in the read-only
data section. */
-#ifdef USING_SVR4_H
+#ifdef USING_ELFOS_H
void
rs6000_select_rtx_section (mode, x)
Index: config/rs6000/sysv4.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/sysv4.h,v
retrieving revision 1.43
diff -u -r1.43 sysv4.h
--- sysv4.h 2001/02/10 11:37:58 1.43
+++ sysv4.h 2001/05/12 10:29:32
@@ -1047,6 +1047,7 @@
#undef TARGET_VERSION
#define TARGET_VERSION fprintf (stderr, " (PowerPC System V.4)");
+#undef CPP_PREDEFINES
#define CPP_PREDEFINES \
"-DPPC -Dunix -D__svr4__ -Asystem=unix -Asystem=svr4 -Acpu=powerpc -Amachine=powerpc"
Index: po/ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/po/ChangeLog,v
retrieving revision 1.41
diff -u -r1.41 ChangeLog
--- ChangeLog 2001/01/31 01:30:40 1.41
+++ ChangeLog 2001/05/12 10:42:16
@@ -1,3 +1,7 @@
+2001-05-12 David O'Brien <obrien@FreeBSD.org>
+
+ * POTFILES.in: Add config/rs6000/freebsd.h.
+
2001-01-30 Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
* Makefile.in.in (distclean): Also remove *.gmo during `make
Index: po/POTFILES.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/po/POTFILES.in,v
retrieving revision 1.39
diff -u -r1.39 POTFILES.in
--- POTFILES.in 2000/12/17 06:30:40 1.39
+++ POTFILES.in 2001/05/12 10:42:16
@@ -448,6 +448,7 @@
config/rs6000/eabi.h
config/rs6000/eabiaix.h
config/rs6000/eabisim.h
+config/rs6000/freebsd.h
config/rs6000/linux.h
config/rs6000/lynx.h
config/rs6000/mach.h