OSDN Git Service

Disallow negative constant address for x32
[pf3gnuchains/gcc-fork.git] / gcc / config / openbsd.h
index e9a4ea4..fad2915 100644 (file)
@@ -1,22 +1,22 @@
 /* Base configuration file for all OpenBSD targets.
-   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2004, 2005, 2007, 2009, 2010, 2011
+   Free Software Foundation, Inc.
 
-This file is part of GNU CC.
+This file is part of GCC.
 
-GNU CC is free software; you can redistribute it and/or modify
+GCC 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)
+the Free Software Foundation; either version 3, or (at your option)
 any later version.
 
-GNU CC is distributed in the hope that it will be useful,
+GCC 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.  */
+along with GCC; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
 
 /* Common OpenBSD configuration. 
    All OpenBSD architectures include this file, which is intended as
@@ -52,29 +52,59 @@ Boston, MA 02111-1307, USA.  */
 
 #ifdef OPENBSD_NATIVE
 
-#undef GCC_INCLUDE_DIR
-#define GCC_INCLUDE_DIR "/usr/include"
-
 /* The compiler is configured with ONLY the gcc/g++ standard headers.  */
 #undef INCLUDE_DEFAULTS
 #define INCLUDE_DEFAULTS                       \
   {                                            \
     { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 },    \
-    { GCC_INCLUDE_DIR, "GCC", 0, 0 },          \
+    { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1 }, \
+    { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1 }, \
+    { NATIVE_SYSTEM_HEADER_DIR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0 }, \
     { 0, 0, 0, 0 }                             \
   }
 
 /* Under OpenBSD, the normal location of the various *crt*.o files is the
    /usr/lib directory.  */
-#define STANDARD_STARTFILE_PREFIX      "/usr/lib/"
+#undef STANDARD_STARTFILE_PREFIX
+#define STANDARD_STARTFILE_PREFIX      "/usr/local/lib/"
 
 #endif
 
 \f
 /* Controlling the compilation driver.  */
+/* TARGET_OS_CPP_BUILTINS() common to all OpenBSD targets.  */
+#define OPENBSD_OS_CPP_BUILTINS()              \
+  do                                           \
+    {                                          \
+      builtin_define ("__OpenBSD__");          \
+      builtin_define ("__unix__");             \
+      builtin_define ("__ANSI_COMPAT");                \
+      builtin_assert ("system=unix");          \
+      builtin_assert ("system=bsd");           \
+      builtin_assert ("system=OpenBSD");       \
+    }                                          \
+  while (0)
+
+/* TARGET_OS_CPP_BUILTINS() common to all OpenBSD ELF targets.  */
+#define OPENBSD_OS_CPP_BUILTINS_ELF()          \
+  do                                           \
+    {                                          \
+      OPENBSD_OS_CPP_BUILTINS();               \
+      builtin_define ("__ELF__");              \
+    }                                          \
+while (0)
+
+/* TARGET_OS_CPP_BUILTINS() common to all LP64 OpenBSD targets.  */
+#define OPENBSD_OS_CPP_BUILTINS_LP64()         \
+  do                                           \
+    {                                          \
+      builtin_define ("_LP64");                        \
+      builtin_define ("__LP64__");             \
+    }                                          \
+  while (0)
 
 /* CPP_SPEC appropriate for OpenBSD. We deal with -posix and -pthread.
-   XXX the way threads are handling currently is not very satisfying,
+   XXX the way threads are handled currently is not very satisfying,
    since all code must be compiled with -pthread to work. 
    This two-stage defines makes it easy to pick that for targets that
    have subspecs.  */
@@ -84,20 +114,11 @@ Boston, MA 02111-1307, USA.  */
 #define OBSD_CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_POSIX_THREADS}"
 #endif
 
-/* LIB_SPEC appropriate for OpenBSD.  Select the appropriate libc, 
-   depending on profiling and threads.  Basically, 
-   -lc(_r)?(_p)?, select _r for threads, and _p for p or pg.  */
-#define OBSD_LIB_SPEC "%{!shared:-lc%{pthread:_r}%{p:_p}%{!p:%{pg:_p}}}"
+#undef LIB_SPEC
+#define LIB_SPEC OBSD_LIB_SPEC
 
 #ifndef OBSD_HAS_CORRECT_SPECS
 
-#ifndef OBSD_NO_DYNAMIC_LIBRARIES
-#undef SWITCH_TAKES_ARG
-#define SWITCH_TAKES_ARG(CHAR) \
-  (DEFAULT_SWITCH_TAKES_ARG (CHAR) \
-   || (CHAR) == 'R')
-#endif
-
 #undef CPP_SPEC
 #define CPP_SPEC OBSD_CPP_SPEC
 
@@ -106,44 +127,27 @@ Boston, MA 02111-1307, USA.  */
    still uses a special flavor of gas that needs to be told when generating 
    pic code.  */
 #undef ASM_SPEC
-#define ASM_SPEC "%{fpic:-k} %{fPIC:-k -K} %|"
-
-#else
-/* Since we use gas, stdin -> - is a good idea, but we don't want to
-   override native specs just for that.  */
-#ifndef ASM_SPEC
-#define ASM_SPEC "%|"
-#endif
+#define ASM_SPEC "%{fpic|fpie:-k} %{fPIC|fPIE:-k -K}"
 #endif
 
-/* LINK_SPEC appropriate for OpenBSD.  Support for GCC options 
-   -static, -assert, and -nostdlib.  */
-#undef LINK_SPEC
-#ifdef OBSD_NO_DYNAMIC_LIBRARIES
-#define LINK_SPEC \
-  "%{g:%{!nostdlib:-L/usr/lib/debug}} %{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{assert*}"
-#else
-#define LINK_SPEC \
-  "%{g:%{!nostdlib:-L/usr/lib/debug}} %{!shared:%{!nostdlib:%{!r*:%{!e*:-e start}}}} %{shared:-Bshareable -x} -dc -dp %{R*} %{static:-Bstatic} %{assert*}"
+/* Since we use gas, stdin -> - is a good idea.  */
+#define AS_NEEDS_DASH_FOR_PIPED_INPUT
+
+#undef LIB_SPEC
+#define LIB_SPEC OBSD_LIB_SPEC
+
+#if defined(HAVE_LD_EH_FRAME_HDR)
+#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
 #endif
 
 #undef LIB_SPEC
 #define LIB_SPEC OBSD_LIB_SPEC
 #endif
 
+#define TARGET_POSIX_IO
 \f
 /* Runtime target specification.  */
 
-/* You must redefine CPP_PREDEFINES in any arch specific file.  */
-#undef CPP_PREDEFINES
-
-/* Implicit calls to library routines.  */
-
-/* Use memcpy and memset instead of bcopy and bzero.  */
-#ifndef TARGET_MEM_FUNCTIONS
-#define TARGET_MEM_FUNCTIONS
-#endif
-
 /* Miscellaneous parameters.  */
 
 /* Controlling debugging info: dbx options.  */
@@ -153,9 +157,7 @@ Boston, MA 02111-1307, USA.  */
 #define DBX_NO_XREFS
 
 \f
-/* Support of shared libraries, mostly imported from svr4.h through netbsd.  */
-/* Two differences from svr4.h:
-   - we use . - _func instead of a local label,
+/* - we use . - _func instead of a local label,
    - we put extra spaces in expressions such as 
      .type _func , @function
      This is more readable for a human being and confuses c++filt less.  */
@@ -175,10 +177,12 @@ Boston, MA 02111-1307, USA.  */
 #undef TYPE_ASM_OP
 #undef SIZE_ASM_OP
 #undef SET_ASM_OP
+#undef GLOBAL_ASM_OP
 
 #define TYPE_ASM_OP    "\t.type\t"
 #define SIZE_ASM_OP    "\t.size\t"
 #define SET_ASM_OP     "\t.set\t"
+#define GLOBAL_ASM_OP  "\t.globl\t"
 
 /* The following macro defines the format used to output the second
    operand of the .type assembler directive.  */
@@ -205,17 +209,17 @@ Boston, MA 02111-1307, USA.  */
   do {                                                                 \
     ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function");                        \
     ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL));                     \
-    ASM_OUTPUT_LABEL(FILE, NAME);                                      \
+    ASM_OUTPUT_FUNCTION_LABEL (FILE, NAME, DECL);                      \
   } while (0)
 #endif
 
 #ifndef OBSD_HAS_DECLARE_FUNCTION_SIZE
 /* Declare the size of a function.  */
 #undef ASM_DECLARE_FUNCTION_SIZE
-#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL)                   \
-  do {                                                                 \
-    if (!flag_inhibit_size_directive)                                  \
-      ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME, ".");                     \
+#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL)           \
+  do {                                                         \
+    if (!flag_inhibit_size_directive)                          \
+      ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME);                  \
   } while (0)
 #endif
 
@@ -273,25 +277,8 @@ do {                                                                        \
   do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
        fputc ('\n', FILE); } while (0)
 #endif
-
-/* Tell the assembler that a symbol is global.  */
-#ifndef ASM_GLOBALIZE_LABEL
-#define ASM_GLOBALIZE_LABEL(FILE,NAME) \
-  do { fputs ("\t.globl\t", FILE); assemble_name (FILE, NAME); \
-       fputc ('\n', FILE); } while(0)
-#endif
-
 \f
 /* Storage layout.  */
 
 \f
-/* Otherwise, since we support weak, gthr.h erroneously tries to use
-   #pragma weak.  */
-#define GTHREAD_USE_WEAK 0
-
-/* bug work around: we don't want to support #pragma weak, but the current
-   code layout needs HANDLE_PRAGMA_WEAK asserted for __attribute((weak)) to
-   work.  On the other hand, we don't define HANDLE_PRAGMA_WEAK directly,
-   as this depends on a few other details as well...  */
-#define HANDLE_SYSV_PRAGMA
-
+#define HAVE_ENABLE_EXECUTE_STACK