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]

configure patches for FreeBSD to support >1 architecture


Here is a set of patches against the 1999-04-18 snapshot.  The primary
goal of these patches is to move/add common stuff to files that can be
shared by all FreeBSD architectures.  Common soon will be patches for
FreeBSD/Alpha support.

Enjoy!
-- 
-- David    (obrien@NUXI.com  -or-  obrien@FreeBSD.org)


GCC
~~~
David O'Brien <obrien@FreeBSD.org>

	* config/freebsd.h (FreeBSD): add new FreeBSD-wide configuration.
	Contents mostly taken from i386/freebsd-elf.h.

	* i386/freebsd-elf.h (FreeBSD): trim out content moved to FreeBSD-wide
	configuration file.  Don't depend on linux.h being included for
	FreeBSD i386 ELF targets.

	* i386/freebsd.h (FreeBSD): trim out content moved to FreeBSD-wide
	configuration file.  

	* configure.in (i[34567]86-*-freebsdelf): don't include linux.h,
	i386/freebsd-elf.h no longer requires it.  Add additional FreeBSD
	targets that trigger off the the OS version number.


	* config/t-freebsd: moved from config/i386/ so it can used for all
	FreeBSD targets


EGCS
~~~~
David O'Brien <obrien@FreeBSD.org>

	* config.guess (*:FreeBSD:*:*):  Improve detection of i386 FreeBSD
	targets by forming the target string with the OS version and letting
	other configure scripts act appropriately to the version number.


--- gcc/config/freebsd.h.orig	Wed Apr 21 03:01:30 1999
+++ gcc/config/freebsd.h	Wed Apr 21 02:43:06 1999
@@ -0,0 +1,146 @@
+/* $Id: freebsd.h,v 1.2 1999/04/21 07:48:58 obrien Exp $ */
+/* Base configuration file for all FreeBSD targets.
+   Copyright (C) 1999 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.  */
+
+/* Common FreeBSD configuration. 
+   All FreeBSD architectures should include this file, which will specify
+   their commonalities.
+   Adapted from /usr/src/contrib/gcc/config/i386/freebsd.h & 
+   egcs/gcc/config/i386/freebsd-elf.h version by David O'Brien  */
+
+
+/* Don't assume anything about the header files. */
+#undef NO_IMPLICIT_EXTERN_C
+#define NO_IMPLICIT_EXTERN_C
+
+/* This defines which switch letters take arguments.  On svr4, most of
+   the normal cases (defined in gcc.c) apply, and we also have -h* and
+   -z* options (for the linker).  We have a slightly different mix.  We
+   have -R (alias --rpath), no -z, --soname (-h), --assert etc. */
+
+#undef SWITCH_TAKES_ARG
+#define SWITCH_TAKES_ARG(CHAR) \
+  (   (CHAR) == 'D' \
+   || (CHAR) == 'U' \
+   || (CHAR) == 'o' \
+   || (CHAR) == 'e' \
+   || (CHAR) == 'T' \
+   || (CHAR) == 'u' \
+   || (CHAR) == 'I' \
+   || (CHAR) == 'm' \
+   || (CHAR) == 'x' \
+   || (CHAR) == 'L' \
+   || (CHAR) == 'A' \
+   || (CHAR) == 'V' \
+   || (CHAR) == 'B' \
+   || (CHAR) == 'b' \
+   || (CHAR) == 'h' \
+   || (CHAR) == 'z' /* ignored by ld */ \
+   || (CHAR) == 'R')
+
+#undef WORD_SWITCH_TAKES_ARG
+#define 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"))
+
+/* Place spaces around this string.  We depend on string splicing to produce
+   the final CPP_PREDEFINES value.  */
+#define CPP_FBSD_PREDEFINES " -Dunix -D__FreeBSD__ -Asystem(unix) -Asystem(FreeBSD) "
+
+/* Provide a LIB_SPEC appropriate for FreeBSD.  Just select the appropriate
+   libc, depending on whether we're doing profiling. 
+   (like the default, except no -lg, and no -p.  */
+#undef LIB_SPEC
+#define LIB_SPEC "%{!shared:%{!pg:%{!pthread:%{!kthread:-lc}%{kthread:-lpthread -lc}}%{pthread:-lc_r}}%{pg:%{!pthread:%{!kthread:-lc_p}%{kthread:-lpthread_p -lc_p}}%{pthread:-lc_r_p}}}"
+
+/* Let gcc locate this for us according to the -m rules */
+#undef LIBGCC_SPEC
+#define LIBGCC_SPEC \
+ "%{!shared:%{!pthread:%{!kthread:libgcc.a%s}}%{pthread|kthread:libgcc_r.a%s}}"
+
+
+/* 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
+#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. */
+#undef NO_DOLLAR_IN_LABEL
+
+/* Use more efficient ``thunks'' to implement C++ vtables. */
+#undef DEFAULT_VTABLE_THUNKS
+#define DEFAULT_VTABLE_THUNKS 1
+
+
+/* Miscellaneous parameters.  */
+
+/* Tell libgcc2.c that FreeBSD targets support atexit(3).  */
+#define HAVE_ATEXIT
+
+
+/* FREEBSD_NATIVE is defined when gcc is integrated into the FreeBSD
+   source tree so it can be configured appropriately without using
+   the GNU configure/build mechanism. */
+
+#ifdef FREEBSD_NATIVE
+
+/* Look for the include files in the system-defined places.  */
+
+#define GPLUSPLUS_INCLUDE_DIR		"/usr/include/g++"
+#define GCC_INCLUDE_DIR			"/usr/include"
+
+/* Now that GCC knows what the include path applies to, put the G++ one first.
+   C++ can now have include files that override the default C ones.  */
+#undef INCLUDE_DEFAULTS
+#define INCLUDE_DEFAULTS			\
+  {						\
+    { GPLUSPLUS_INCLUDE_DIR, "C++", 1, 1 },	\
+    { GCC_INCLUDE_DIR, "GCC", 0, 0 },		\
+    { 0, 0, 0, 0 }				\
+  }
+
+/* Under FreeBSD, the normal location of the compiler back ends is the
+   /usr/libexec directory.  */
+
+#undef STANDARD_EXEC_PREFIX
+#undef TOOLDIR_BASE_PREFIX
+#undef MD_EXEC_PREFIX
+
+#define STANDARD_EXEC_PREFIX		"/usr/libexec/"
+#define TOOLDIR_BASE_PREFIX		"/usr/libexec/"
+#define MD_EXEC_PREFIX			"/usr/libexec/"
+
+/* Under FreeBSD, the normal location of the various *crt*.o files is the
+   /usr/lib directory.  */
+
+#undef STANDARD_STARTFILE_PREFIX
+#define STANDARD_STARTFILE_PREFIX	"/usr/lib/"
+
+/* FreeBSD is 4.4BSD derived */
+#define bsd4_4
+
+#endif /* FREEBSD_NATIVE */


--- gcc/config/i386/freebsd-elf.h.orig	Fri Apr  9 13:31:31 1999
+++ gcc/config/i386/freebsd-elf.h	Wed Apr 21 14:32:03 1999
@@ -21,6 +21,15 @@
 the Free Software Foundation, 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.  */
 
+
+/* Use stabs instead of DWARF debug format.  */
+#undef PREFERRED_DEBUGGING_TYPE
+#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
+#include "svr4.h"
+
+/* Get generic FreeBSD definitions.  */
+#include <freebsd.h>
+
 #undef TARGET_VERSION
 #define TARGET_VERSION fprintf (stderr, " (i386 FreeBSD/ELF)");
 
@@ -145,27 +154,11 @@
 #define WCHAR_TYPE_SIZE BITS_PER_WORD
     
 #undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Di386 -Dunix -D__ELF__ -D__FreeBSD__ -Asystem(unix) -Asystem(FreeBSD) -Acpu(i386) -Amachine(i386)"
+#define CPP_PREDEFINES "-Di386 -Acpu(i386) -Amachine(i386)" CPP_FBSD_PREDEFINES
 
 #undef CPP_SPEC
 #define CPP_SPEC "%(cpp_cpu) %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE}"
 
-#undef	LIB_SPEC
-#if 1
-/* We no longer link with libc_p.a or libg.a by default. If you
- * want to profile or debug the C library, please add
- * -lc_p or -ggdb to LDFLAGS at the link time, respectively.
- */
-#define LIB_SPEC \
-  "%{!shared: %{mieee-fp:-lieee} %{p:-lgmon} %{pg:-lgmon} \
-     %{!ggdb:-lc} %{ggdb:-lg}}"
-#else
-#define LIB_SPEC \
-  "%{!shared: \
-     %{mieee-fp:-lieee} %{p:-lgmon -lc_p} %{pg:-lgmon -lc_p} \
-       %{!p:%{!pg:%{!g*:-lc} %{g*:-lg}}}}"
-#endif
-
 /* Provide a LINK_SPEC appropriate for FreeBSD.  Here we provide support
    for the special GCC options -static and -shared, which allow us to
    link things in one of these three modes by applying the appropriate
@@ -187,7 +180,7 @@
       %{!static: \
 	%{rdynamic:-export-dynamic} \
 	%{!dynamic-linker:-dynamic-linker /usr/libexec/ld-elf.so.1}} \
-	%{static:-static}}}"
+	%{static:-Bstatic}}}"
 
 /* Get perform_* macros to build libgcc.a.  */
 

--- gcc/config/i386/freebsd.h.orig	Tue Mar 23 13:34:48 1999
+++ gcc/config/i386/freebsd.h	Wed Apr 21 03:19:19 1999
@@ -20,6 +20,10 @@
 the Free Software Foundation, 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.  */
 
+
+/* Get generic FreeBSD definitions.  */
+#include <freebsd.h>
+
 /* This is tested by i386gas.h.  */
 #define YES_UNDERSCORES
 
@@ -37,9 +41,10 @@
   (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_NO_FANCY_MATH_387)
 
 #undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dunix -Di386 -D__FreeBSD__ -Asystem(unix) -Asystem(FreeBSD) -Acpu(i386) -Amachine(i386)"
+#define CPP_PREDEFINES "-Di386 -Acpu(i386) -Amachine(i386)" CPP_FBSD_PREDEFINES
 
 /* Like the default, except no -lg.  */
+#undef LIB_SPEC
 #define LIB_SPEC "%{!shared:%{!pg:-lc}%{pg:-lc_p}}"
 
 #undef SIZE_TYPE
@@ -87,14 +92,6 @@
    necessary when compiling PIC code.  */
 
 #define JUMP_TABLES_IN_TEXT_SECTION 1
-
-/* Don't default to pcc-struct-return, because in FreeBSD we prefer the
-   superior nature of the older gcc way.  */
-#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. */
-#undef NO_DOLLAR_IN_LABEL
 
 /* i386 freebsd still uses old binutils that don't insert nops by default
    when the .align directive demands to insert extra space in the text
@@ -135,6 +132,7 @@
 
 #define TYPE_ASM_OP	".type"
 #define SIZE_ASM_OP	".size"
+#define SET_ASM_OP	".set"
 
 /* The following macro defines the format used to output the second
    operand of the .type assembler directive.  Different svr4 assemblers
@@ -144,6 +142,12 @@
 
 #define TYPE_OPERAND_FMT	"@%s"
 
+#define HANDLE_SYSV_PRAGMA	1
+
+#define ASM_WEAKEN_LABEL(FILE,NAME) \
+  do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
+  fputc ('\n', FILE); } while (0)
+
 /* Write the extra assembler code needed to declare a function's result.
    Most svr4 assemblers don't require any special declaration of the
    result value, but there are exceptions.  */
@@ -245,30 +249,3 @@
 #define STARTFILE_SPEC  \
   "%{shared:c++rt0.o%s} \
    %{!shared:%{pg:gcrt0.o%s}%{!pg:%{static:scrt0.o%s}%{!static:crt0.o%s}}}"
-
-/* This is defined when gcc is compiled in the BSD-directory-tree, and must
- * make up for the gap to all the stuff done in the GNU-makefiles.
- */
-
-#ifdef FREEBSD_NATIVE
-
-#define INCLUDE_DEFAULTS { \
-	{ "/usr/include", 0, 0, 0 }, \
-	{ "/usr/include/g++", "G++", 1, 1 }, \
-	{ 0, 0, 0, 0} \
-	}
-
-#undef MD_EXEC_PREFIX
-#define MD_EXEC_PREFIX "/usr/libexec/"
-
-#undef STANDARD_STARTFILE_PREFIX
-#define STANDARD_STARTFILE_PREFIX "/usr/lib"
-
-#if 0 /* This is very wrong!!! */
-#define DEFAULT_TARGET_MACHINE "i386-unknown-freebsd_1.0"
-#define GPLUSPLUS_INCLUDE_DIR "/usr/local/lib/gcc-lib/i386-unknown-freebsd_1.0/2.5.8/include"
-#define TOOL_INCLUDE_DIR "/usr/local/i386-unknown-freebsd_1.0/include"
-#define GCC_INCLUDE_DIR "/usr/local/lib/gcc-lib/i386-unknown-freebsd_1.0/2.5.8/include"
-#endif
-
-#endif /* FREEBSD_NATIVE */


--- gcc/configure.in.orig	Wed Apr 14 18:50:50 1999
+++ gcc/configure.in	Wed Apr 21 16:33:14 1999
@@ -1117,13 +1117,19 @@
 #		use_collect2=yes
 		;;
 changequote(,)dnl
-	i[34567]86-*-freebsdelf*)
+	i[34567]86-*-freebsd[12].* | i[34567]86-*-freebsd[12])
 changequote([,])dnl
-		tm_file="i386/i386.h i386/att.h linux.h i386/freebsd-elf.h i386/perform.h"
+		tm_file=i386/freebsd.h
+		tmake_file=t-freebsd
+		;;
+changequote(,)dnl
+	i[34567]86-*-freebsd[3-9].* | i[34567]86-*-freebsd[3-9] | i[34567]86-*-freebsdelf*)
+changequote([,])dnl
+		tm_file="i386/i386.h i386/att.h i386/freebsd-elf.h i386/perform.h"
 		# On FreeBSD, the headers are already ok, except for math.h.
 		fixincludes=fixinc.wrap
 		extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
-		tmake_file=i386/t-freebsd
+		tmake_file=t-freebsd
 		gas=yes
 		gnu_ld=yes
 		stabs=yes
@@ -1132,7 +1138,7 @@
 	i[34567]86-*-freebsd*)
 changequote([,])dnl
 		tm_file=i386/freebsd.h
-		tmake_file=i386/t-freebsd
+		tmake_file=t-freebsd
 		;;
 changequote(,)dnl
 	i[34567]86-*-netbsd*)


--- config.guess.orig	Tue Apr 13 14:55:39 1999
+++ config.guess	Wed Apr 21 14:47:40 1999
@@ -520,11 +520,7 @@
 	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
 	exit 0 ;;
     *:FreeBSD:*:*)
-        if test -x /usr/bin/objformat -a "elf" = "`/usr/bin/objformat`"; then
-          echo ${UNAME_MACHINE}-unknown-freebsdelf
-        else
-	  echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'`
-      fi
+	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
 	exit 0 ;;
     *:NetBSD:*:*)
 	echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`


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