summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrobert <robert@openbsd.org>2009-10-15 21:16:33 +0000
committerrobert <robert@openbsd.org>2009-10-15 21:16:33 +0000
commit48a9be13bb6bd15d53ffafb613c536206bf691a3 (patch)
tree6fd1c1222b186d2041bb7118e69dc70f69577963
parentWe need to include Makefile.inc here (diff)
downloadwireguard-openbsd-48a9be13bb6bd15d53ffafb613c536206bf691a3.tar.xz
wireguard-openbsd-48a9be13bb6bd15d53ffafb613c536206bf691a3.zip
add target configuration for openbsd
-rw-r--r--gnu/gcc/gcc/config/i386/openbsd64.h121
-rw-r--r--gnu/gcc/gcc/config/i386/openbsdelf.h7
-rw-r--r--gnu/gcc/gcc/config/openbsd-libpthread.h22
-rw-r--r--gnu/gcc/gcc/config/openbsd.h58
-rw-r--r--gnu/gcc/libcpp/include/cpp-id-data.h2
5 files changed, 186 insertions, 24 deletions
diff --git a/gnu/gcc/gcc/config/i386/openbsd64.h b/gnu/gcc/gcc/config/i386/openbsd64.h
new file mode 100644
index 00000000000..abd62084f45
--- /dev/null
+++ b/gnu/gcc/gcc/config/i386/openbsd64.h
@@ -0,0 +1,121 @@
+/* Configuration for an OpenBSD x86-64 target.
+
+ Copyright (C) 2003 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. */
+
+#undef TARGET_VERSION
+#define TARGET_VERSION fprintf (stderr, " (OpenBSD/x86-64 ELF)")
+
+/* This gets defined in tm.h->linux.h->svr4.h, and keeps us from using
+ libraries compiled with the native cc, so undef it. */
+#undef NO_DOLLAR_IN_LABEL
+
+/* Override the default comment-starter of "/". */
+#undef ASM_COMMENT_START
+#define ASM_COMMENT_START "#"
+
+/* Run-time target specifications */
+
+#define TARGET_OS_CPP_BUILTINS() \
+ do \
+ { \
+ OPENBSD_OS_CPP_BUILTINS_ELF(); \
+ if (TARGET_64BIT) \
+ OPENBSD_OS_CPP_BUILTINS_LP64(); \
+ } \
+ while (0)
+
+/* As an elf system, we need crtbegin/crtend stuff. */
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC "\
+ %{!shared: %{pg:gcrt0%O%s} %{!pg:%{p:gcrt0%O%s} %{!p:crt0%O%s}} \
+ crtbegin%O%s} %{shared:crtbeginS%O%s}"
+#undef ENDFILE_SPEC
+#define ENDFILE_SPEC "%{!shared:crtend%O%s} %{shared:crtendS%O%s}"
+
+/* Layout of source language data types. */
+
+/* This must agree with <machine/_types.h> */
+#undef SIZE_TYPE
+#define SIZE_TYPE "long unsigned int"
+
+#undef PTRDIFF_TYPE
+#define PTRDIFF_TYPE "long int"
+
+#undef WCHAR_TYPE
+#define WCHAR_TYPE "int"
+
+#undef WCHAR_TYPE_SIZE
+#define WCHAR_TYPE_SIZE 32
+
+/* Assembler format: overall framework. */
+
+#undef ASM_APP_ON
+#define ASM_APP_ON "#APP\n"
+
+#undef ASM_APP_OFF
+#define ASM_APP_OFF "#NO_APP\n"
+
+#undef SET_ASM_OP
+#define SET_ASM_OP "\t.set\t"
+
+/* The following macros were originally stolen from i386v4.h.
+ These have to be defined to get PIC code correct. */
+
+/* Assembler format: dispatch tables. */
+
+/* Assembler format: sections. */
+
+/* Stack & calling: aggregate returns. */
+
+/* Don't default to pcc-struct-return, because gcc is the only compiler, and
+ we want to retain compatibility with older gcc versions. */
+#define DEFAULT_PCC_STRUCT_RETURN 0
+
+/* Assembler format: alignment output. */
+
+/* Stack & calling: profiling. */
+
+/* OpenBSD's profiler recovers all information from the stack pointer.
+ The icky part is not here, but in machine/profile.h. */
+#undef FUNCTION_PROFILER
+#define FUNCTION_PROFILER(FILE, LABELNO) \
+ fputs (flag_pic ? "\tcall __mcount@PLT\n": "\tcall __mcount\n", FILE);
+
+/* Assembler format: exception region output. */
+
+/* Assembler format: alignment output. */
+
+/* Note that we pick up ASM_OUTPUT_MAX_SKIP_ALIGN from i386/gas.h */
+
+/* Note that we pick up ASM_OUTPUT_MI_THUNK from unix.h. */
+
+#undef LINK_SPEC
+#define LINK_SPEC \
+ "%{!shared:%{!nostdlib:%{!r*:%{!e*:-e __start}}}} \
+ %{shared:-shared} %{R*} \
+ %{static:-Bstatic} \
+ %{!static:-Bdynamic} \
+ %{assert*} \
+ %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.so}"
+
+#define OBSD_HAS_CORRECT_SPECS
+
+#undef JUMP_TABLES_IN_TEXT_SECTION
+#define JUMP_TABLES_IN_TEXT_SECTION (flag_pic)
diff --git a/gnu/gcc/gcc/config/i386/openbsdelf.h b/gnu/gcc/gcc/config/i386/openbsdelf.h
index 9323121118d..c8ddd95d4c2 100644
--- a/gnu/gcc/gcc/config/i386/openbsdelf.h
+++ b/gnu/gcc/gcc/config/i386/openbsdelf.h
@@ -56,10 +56,10 @@ Boston, MA 02110-1301, USA. */
/* This must agree with <machine/ansi.h> */
#undef SIZE_TYPE
-#define SIZE_TYPE "unsigned int"
+#define SIZE_TYPE "long unsigned int"
#undef PTRDIFF_TYPE
-#define PTRDIFF_TYPE "int"
+#define PTRDIFF_TYPE "long int"
#undef WCHAR_TYPE
#define WCHAR_TYPE "int"
@@ -111,9 +111,6 @@ Boston, MA 02110-1301, USA. */
/* Assembler format: exception region output. */
-/* our configuration still doesn't handle dwarf2 correctly */
-#define DWARF2_UNWIND_INFO 0
-
/* Assembler format: alignment output. */
/* Note that we pick up ASM_OUTPUT_MAX_SKIP_ALIGN from i386/gas.h */
diff --git a/gnu/gcc/gcc/config/openbsd-libpthread.h b/gnu/gcc/gcc/config/openbsd-libpthread.h
new file mode 100644
index 00000000000..6503a44897e
--- /dev/null
+++ b/gnu/gcc/gcc/config/openbsd-libpthread.h
@@ -0,0 +1,22 @@
+/* LIB_SPEC appropriate for OpenBSD. Include -lpthread if -pthread is
+ specified on the command line. */
+/* Copyright (C) 2004 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. */
+
+#define OBSD_LIB_SPEC "%{!shared:%{pthread:-lpthread} -lc}"
diff --git a/gnu/gcc/gcc/config/openbsd.h b/gnu/gcc/gcc/config/openbsd.h
index 68eb948772b..c46e7fb5ea5 100644
--- a/gnu/gcc/gcc/config/openbsd.h
+++ b/gnu/gcc/gcc/config/openbsd.h
@@ -1,5 +1,5 @@
/* Base configuration file for all OpenBSD targets.
- Copyright (C) 1999, 2000, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2004, 2005, 2007 Free Software Foundation, Inc.
This file is part of GCC.
@@ -14,9 +14,8 @@ 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, USA. */
+along with GCC; see the file COPYING. If not see
+<http://www.gnu.org/licenses/>. */
/* Common OpenBSD configuration.
All OpenBSD architectures include this file, which is intended as
@@ -70,9 +69,39 @@ Boston, MA 02110-1301, USA. */
#endif
-
/* Controlling the compilation driver. */
/* TARGET_OS_CPP_BUILTINS() common to all OpenBSD targets. */
+#define OPENBSD_OS_CPP_BUILTINS_COMMON() \
+ 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_COMMON(); \
+ 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)
+
+/* XXX old stuff TARGET_OS_CPP_BUILTINS() common to all OpenBSD targets. */
#define OPENBSD_OS_CPP_BUILTINS() \
do \
{ \
@@ -96,15 +125,8 @@ Boston, MA 02110-1301, USA. */
#define OBSD_CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_POSIX_THREADS}"
#endif
-/* LIB_SPEC appropriate for OpenBSD. */
-#ifdef HAS_LIBC_R
-/* -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}}}"
-#else
-/* Include -lpthread if -pthread is specified on the command line. */
-# define OBSD_LIB_SPEC "%{!shared:%{pthread:-lpthread%{p:_p}%{!p:%{pg:_p}}}} %{!shared:-lc%{p:_p}%{!p:%{pg:_p}}}"
-#endif
-
+#undef LIB_SPEC
+#define LIB_SPEC OBSD_LIB_SPEC
#ifndef OBSD_HAS_CORRECT_SPECS
@@ -140,6 +162,10 @@ Boston, MA 02110-1301, USA. */
"%{g:%{!nostdlib:-L/usr/lib/debug}} %{!shared:%{!nostdlib:%{!r*:%{!e*:-e start}}}} %{shared:-Bshareable -x} -dc -dp %{R*} %{static:-Bstatic} %{assert*}"
#endif
+#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
@@ -282,10 +308,6 @@ do { \
/* Storage layout. */
-/* 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,
diff --git a/gnu/gcc/libcpp/include/cpp-id-data.h b/gnu/gcc/libcpp/include/cpp-id-data.h
index 2445186c228..8a12d0d6098 100644
--- a/gnu/gcc/libcpp/include/cpp-id-data.h
+++ b/gnu/gcc/libcpp/include/cpp-id-data.h
@@ -18,7 +18,7 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#include "cpplib.h"
-#if !defined (HAVE_UCHAR) && !defined (IN_GCC)
+#if !defined (HAVE_UCHAR)
typedef unsigned char uchar;
#endif