OSDN Git Service

* config/m68hc11/m68hc11.c (m68hc11_initial_elimination_offset):
[pf3gnuchains/gcc-fork.git] / gcc / config / freebsd.h
index 461f69e..88e0226 100644 (file)
@@ -1,5 +1,5 @@
 /* Base configuration file for all FreeBSD targets.
-   Copyright (C) 1999 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -22,7 +22,9 @@ Boston, MA 02111-1307, USA.  */
    All FreeBSD architectures should include this file, which will specify
    their commonalities.
    Adapted from gcc/config/i386/freebsd-elf.h by 
-   David O'Brien <obrien@FreeBSD.org>.  */
+   David O'Brien <obrien@FreeBSD.org>.  
+   Further work by David O'Brien <obrien@FreeBSD.org> and
+   Loren J. Rittle <ljrittle@acm.org>.  */
 
 
 /* This defines which switch letters take arguments.  On FreeBSD, most of
@@ -48,6 +50,34 @@ Boston, MA 02111-1307, USA.  */
 #undef WORD_SWITCH_TAKES_ARG
 #define WORD_SWITCH_TAKES_ARG(STR) (FBSD_WORD_SWITCH_TAKES_ARG(STR))
 
+#if FBSD_MAJOR == 6
+#define FBSD_CPP_PREDEFINES \
+  "-D__FreeBSD__=6 -Dunix -D__ELF__ -Asystem=unix -Asystem=bsd -Asystem=FreeBSD"
+#endif
+
+#if FBSD_MAJOR == 5
+#define FBSD_CPP_PREDEFINES \
+  "-D__FreeBSD__=5 -Dunix -D__ELF__ -Asystem=unix -Asystem=bsd -Asystem=FreeBSD"
+#endif
+
+#if FBSD_MAJOR == 4
+#define FBSD_CPP_PREDEFINES \
+  "-D__FreeBSD__=4 -Dunix -D__ELF__ -Asystem=unix -Asystem=bsd -Asystem=FreeBSD"
+#endif
+
+#if FBSD_MAJOR == 3
+#define FBSD_CPP_PREDEFINES \
+  "-D__FreeBSD__=3 -Dunix -D__ELF__ -Asystem=unix -Asystem=bsd -Asystem=FreeBSD"
+#endif
+
+#ifndef FBSD_CPP_PREDEFINES
+#define FBSD_CPP_PREDEFINES \
+  "-D__FreeBSD__   -Dunix -D__ELF__ -Asystem=unix -Asystem=bsd -Asystem=FreeBSD"
+#endif
+
+#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.  */
 
@@ -56,20 +86,48 @@ Boston, MA 02111-1307, USA.  */
   %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__}              \
   %{posix:-D_POSIX_SOURCE}"
 
-/* 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).  */
-
-#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}}}"
-
+/* Provide a LIB_SPEC appropriate for FreeBSD as configured and as
+   required by the user-land thread model.  Before __FreeBSD_version
+   500016, select the appropriate libc, depending on whether we're
+   doing profiling or need threads support.  At __FreeBSD_version
+   500016 and later, when threads support is requested include both
+   -lc and -lc_r instead of only -lc_r.  To make matters interesting,
+   we can't actually use __FreeBSD_version provided by <osreldate.h>
+   directly since it breaks cross-compiling.  As a final twist, make
+   it a hard error if -pthread is provided on the command line and gcc
+   was configured with --disable-threads (this will help avoid bug
+   reports from users complaining about threading when they
+   misconfigured the gcc bootstrap but are later consulting FreeBSD
+   manual pages that refer to the mythical -pthread option).  */
+
+#undef  LIB_SPEC
+#ifdef FBSD_NO_THREADS
+#define LIB_SPEC "                                                     \
+  %{pthread: %eThe -pthread option is only supported on FreeBSD when gcc \
+is built with the --enable-threads configure-time option.}             \
+  %{!shared:                                                           \
+    %{!pg: -lc}                                                                \
+    %{pg:  -lc_p}                                                      \
+  }"
+#else
+#if FBSD_MAJOR >= 5
+#define LIB_SPEC "                                                     \
+  %{!shared:                                                           \
+    %{!pg: %{pthread:-lc_r} -lc}                                       \
+    %{pg:  %{pthread:-lc_r_p} -lc_p}                                   \
+  }"
+#else
+#define LIB_SPEC "                                                     \
+  %{!shared:                                                           \
+    %{!pg:                                                             \
+      %{!pthread:-lc}                                                  \
+      %{pthread:-lc_r}}                                                        \
+    %{pg:                                                              \
+      %{!pthread:-lc_p}                                                        \
+      %{pthread:-lc_r_p}}                                              \
+  }"
+#endif
+#endif
 
 /* Code generation parameters.  */
 
@@ -96,34 +154,19 @@ Boston, MA 02111-1307, USA.  */
 #undef DEFAULT_VTABLE_THUNKS
 #define DEFAULT_VTABLE_THUNKS 1
 
-/* This is BSD, so use stabs instead of DWARF debug format.  */
+/* The GNU tools operate better with dwarf2 than stabs.  Since we
+   don't have any native tools to be compatible with, default to
+   dwarf2.  */
 #undef PREFERRED_DEBUGGING_TYPE
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
+#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
 
-/* 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 ".ident"
+#define IDENT_ASM_OP "\t.ident\t"
 
 /* Output #ident as a .ident.  */
 #undef ASM_OUTPUT_IDENT
 #define ASM_OUTPUT_IDENT(FILE, NAME)                                   \
-  fprintf ((FILE), "\t%s\t\"%s\"\n", IDENT_ASM_OP, (NAME));
-
-#undef ASM_IDENTIFY_LANGUAGE
-#define ASM_IDENTIFY_LANGUAGE(FILE)                                    \
-  fprintf ((FILE), "\t%s \"GCC (%s) %s\"\n", IDENT_ASM_OP,             \
-          lang_identify (), version_string)
-
-#undef ASM_FILE_END
-#define ASM_FILE_END(FILE)                                             \
-do {                                                                   \
-     if (!flag_no_ident)                                               \
-       fprintf ((FILE), "\t%s\t\"GCC: (GNU) %s\"\n",                   \
-                IDENT_ASM_OP, version_string);                         \
-   } while (0)
-
+  fprintf ((FILE), "%s\"%s\"\n", IDENT_ASM_OP, (NAME));
 
 /* Miscellaneous parameters.  */
 
@@ -136,6 +179,3 @@ do {                                                                        \
 
 /* Handle #pragma weak and #pragma pack.  */
 #define HANDLE_SYSV_PRAGMA
-
-/* Tell libgcc2.c that FreeBSD targets support atexit(3).  */
-#define HAVE_ATEXIT