diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2003-11-29 13:20:59 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2003-11-29 13:20:59 +0000 |
commit | 6d213de949fd071fe6846ec492c49e368e7aa48c (patch) | |
tree | fa6c576e63eb004924919f4edddd2910d29b7f23 /gnu/usr.bin | |
parent | 00c543d4bc94ba42c08148a482abed06fd5b3217 (diff) |
Add OpenBSD specific configurations.
Diffstat (limited to 'gnu/usr.bin')
-rw-r--r-- | gnu/usr.bin/gcc/gcc/config.gcc | 27 | ||||
-rw-r--r-- | gnu/usr.bin/gcc/gcc/config/alpha/openbsd.h | 103 | ||||
-rw-r--r-- | gnu/usr.bin/gcc/gcc/config/alpha/openbsd1.h | 23 | ||||
-rw-r--r-- | gnu/usr.bin/gcc/gcc/config/exec-stack.h | 40 | ||||
-rw-r--r-- | gnu/usr.bin/gcc/gcc/config/i386/openbsd.h | 17 | ||||
-rw-r--r-- | gnu/usr.bin/gcc/gcc/config/i386/openbsdelf.h | 138 | ||||
-rw-r--r-- | gnu/usr.bin/gcc/gcc/config/openbsd.h | 38 | ||||
-rw-r--r-- | gnu/usr.bin/gcc/gcc/config/rs6000/crtsavres.asm | 2 | ||||
-rw-r--r-- | gnu/usr.bin/gcc/gcc/config/rs6000/eabi.asm | 2 | ||||
-rw-r--r-- | gnu/usr.bin/gcc/gcc/config/rs6000/openbsd.h | 91 | ||||
-rw-r--r-- | gnu/usr.bin/gcc/gcc/config/rs6000/openbsd1.h | 24 | ||||
-rw-r--r-- | gnu/usr.bin/gcc/gcc/config/rs6000/sysv4.h | 87 | ||||
-rw-r--r-- | gnu/usr.bin/gcc/gcc/config/rs6000/t-openbsd | 55 | ||||
-rw-r--r-- | gnu/usr.bin/gcc/gcc/config/rs6000/tramp.asm | 2 | ||||
-rw-r--r-- | gnu/usr.bin/gcc/gcc/config/sparc/openbsd.h | 9 | ||||
-rw-r--r-- | gnu/usr.bin/gcc/gcc/config/sparc/openbsd1-64.h | 24 | ||||
-rw-r--r-- | gnu/usr.bin/gcc/gcc/config/sparc/openbsd64.h | 235 | ||||
-rw-r--r-- | gnu/usr.bin/gcc/gcc/config/x-openbsd | 11 |
18 files changed, 824 insertions, 104 deletions
diff --git a/gnu/usr.bin/gcc/gcc/config.gcc b/gnu/usr.bin/gcc/gcc/config.gcc index 25b3be417a4..3fd26841743 100644 --- a/gnu/usr.bin/gcc/gcc/config.gcc +++ b/gnu/usr.bin/gcc/gcc/config.gcc @@ -405,6 +405,8 @@ case $machine in tm_file=${cpu_type}/openbsd.h tmake_file="t-libc-ok t-openbsd t-libgcc-pic" xm_defines=POSIX + # for gcc in tree, we use our own fragment + xmake_file=x-openbsd if test x$enable_threads = xyes; then thread_file='posix' tmake_file="${tmake_file} t-openbsd-thread" @@ -578,10 +580,11 @@ alpha*-*-netbsd*) ;; alpha*-*-openbsd*) - tm_file="${cpu_type}/${cpu_type}.h ${tm_file}" + tm_file="alpha/alpha.h alpha/elf.h alpha/openbsd1.h openbsd.h ${tm_file}" # default x-alpha is only appropriate for dec-osf. target_cpu_default="MASK_GAS" tmake_file="alpha/t-alpha alpha/t-ieee" + gas=yes gnu_ld=yes ;; alpha*-dec-osf[45]*) @@ -1142,13 +1145,23 @@ i[34567]86-*-netbsd*) x86_64-*-netbsd*) tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-elf.h i386/x86-64.h i386/netbsd64.h" ;; -i[34567]86-*-openbsd*) +i[34567]86-*-openbsd2* | i[34567]86-*-openbsd3.[0123]) tm_file="${cpu_type}/${cpu_type}.h i386/unix.h i386/bsd.h i386/gas.h i386/gstabs.h openbsd-oldgas.h openbsd.h ${tm_file}" # needed to unconfuse gdb tmake_file="t-libc-ok t-openbsd i386/t-openbsd" # we need collect2 until our bug is fixed... use_collect2=yes ;; +i[34567]86-*-openbsd*) + # needed to unconfuse gdb + tmake_file="t-libc-ok t-openbsd i386/t-openbsd" + tm_file="${cpu_type}/${cpu_type}.h i386/unix.h i386/att.h dbxelf.h elfos.h i386/i386elf.h" + tm_file="${tm_file} exec-stack.h" + tm_file="${tm_file} openbsd.h i386/openbsdelf.h" + gas=yes + gnu_ld=yes + stabs=yes + ;; i[34567]86-*-coff*) tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h dbxcoff.h i386/i386-coff.h" ;; @@ -2016,8 +2029,8 @@ romp-*-openbsd*) # Nothing special ;; powerpc-*-openbsd*) - tmake_file="${tmake_file} rs6000/t-rs6000 rs6000/t-openbsd" - extra_headers= + tm_file="rs6000/rs6000.h rs6000/openbsd1.h dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h openbsd.h ${tm_file}" + tmake_file="${tmake_file} rs6000/t-ppcos rs6000/t-openbsd" ;; powerpc64-*-linux*) tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/linux64.h" @@ -2397,17 +2410,19 @@ sparc-*-netbsd*) use_collect2=yes ;; sparc-*-openbsd*) - tm_file="sparc/sparc.h ${tm_file}" + tm_file="sparc/sparc.h elfos.h svr4.h sparc/sysv4.h ${tm_file}" # needed to unconfuse gdb tmake_file="t-libc-ok t-openbsd sparc/t-openbsd" # we need collect2 until our bug is fixed... + gas=yes gnu_ld=yes use_collect2=yes ;; sparc64-*-openbsd*) - tm_file="sparc/openbsd1-64.h sparc/sparc.h elfos.h svr4.h sparc/sysv4.h sparc/sol2.h sparc/sp64-elf.h openbsd.h sparc/openbsd64.h" + tm_file="sparc/openbsd1-64.h sparc/sparc.h elfos.h svr4.h sparc/sysv4.h sparc/sp64-elf.h openbsd.h sparc/openbsd64.h" xm_file=sparc/xm-sp64.h gas=yes gnu_ld=yes with_cpu=ultrasparc + float_format=i128 ;; sparc-*-bsd*) tm_file="${tm_file} sparc/bsd.h" diff --git a/gnu/usr.bin/gcc/gcc/config/alpha/openbsd.h b/gnu/usr.bin/gcc/gcc/config/alpha/openbsd.h index b82b66df3c8..ea93053a354 100644 --- a/gnu/usr.bin/gcc/gcc/config/alpha/openbsd.h +++ b/gnu/usr.bin/gcc/gcc/config/alpha/openbsd.h @@ -21,22 +21,25 @@ Boston, MA 02111-1307, USA. */ /* We settle for little endian for now. */ #define TARGET_ENDIAN_DEFAULT 0 -#define OBSD_NO_DYNAMIC_LIBRARIES -#define OBSD_HAS_DECLARE_FUNCTION_NAME -#define OBSD_HAS_DECLARE_FUNCTION_SIZE -#define OBSD_HAS_DECLARE_OBJECT - -/* alpha ecoff supports only weak aliases, see below. */ -#define ASM_WEAKEN_LABEL(FILE,NAME) ASM_OUTPUT_WEAK_ALIAS (FILE,NAME,0) - -#include <openbsd.h> - /* Controlling the compilation driver. */ /* alpha needs __start. */ #undef LINK_SPEC #define LINK_SPEC \ - "%{!nostdlib:%{!r*:%{!e*:-e __start}}} -dc -dp %{assert*}" + "%{!shared:%{!nostdlib:%{!r*:%{!e*:-e __start}}}} \ + %{shared:-shared} %{R*} \ + %{static:-Bstatic} \ + %{!static:-Bdynamic} \ + %{assert*} \ + %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.so}" + +/* 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}" /* run-time target specifications */ #define TARGET_OS_CPP_BUILTINS() \ @@ -44,6 +47,7 @@ Boston, MA 02111-1307, USA. */ builtin_define ("__OpenBSD__"); \ builtin_define ("__ANSI_COMPAT"); \ builtin_define ("__unix__"); \ + builtin_define ("__ELF__"); \ builtin_assert ("system=unix"); \ } while (0) @@ -63,67 +67,22 @@ Boston, MA 02111-1307, USA. */ #define WCHAR_TYPE_SIZE 32 -#undef PREFERRED_DEBUGGING_TYPE -#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG +/* #undef PREFERRED_DEBUGGING_TYPE */ +/* #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG */ +/* Output and generation of labels. */ #define LOCAL_LABEL_PREFIX "." -/* We don't have an init section yet. */ -#undef HAS_INIT_SECTION - -/* collect2 support (assembler format: macros for initialization). */ - -/* Don't tell collect2 we use COFF as we don't have (yet ?) a dynamic ld - library with the proper functions to handle this -> collect2 will - default to using nm. */ -#undef OBJECT_FORMAT_COFF -#undef EXTENDED_COFF - -/* Assembler format: exception region output. */ - -/* All configurations that don't use elf must be explicit about not using - dwarf unwind information. egcs doesn't try too hard to check internal - configuration files... */ -#ifdef INCOMING_RETURN_ADDR_RTX -#undef DWARF2_UNWIND_INFO -#define DWARF2_UNWIND_INFO 0 -#endif - -/* Assembler format: file framework. */ - -/* Taken from alpha/osf.h. This used to be common to all alpha - configurations, but elf has departed from it. - Check alpha/alpha.h, alpha/osf.h for it when egcs is upgraded. */ -#ifndef ASM_FILE_START -#define ASM_FILE_START(FILE) \ -{ \ - alpha_write_verstamp (FILE); \ - fprintf (FILE, "\t.set noreorder\n"); \ - fprintf (FILE, "\t.set volatile\n"); \ - fprintf (FILE, "\t.set noat\n"); \ - if (TARGET_SUPPORT_ARCH) \ - fprintf (FILE, "\t.arch %s\n", \ - TARGET_CPU_EV6 ? "ev6" \ - : (TARGET_CPU_EV5 \ - ? (TARGET_MAX ? "pca56" : TARGET_BWX ? "ev56" : "ev5") \ - : "ev4")); \ - \ - ASM_OUTPUT_SOURCE_FILENAME (FILE, main_input_filename); \ -} -#endif - -/* Assembler format: label output. */ - -#define ASM_OUTPUT_WEAK_ALIAS(FILE,NAME,VALUE) \ - do { \ - fputs ("\t.weakext\t", FILE); \ - assemble_name (FILE, NAME); \ - if (VALUE) \ - { \ - fputs (" , ", FILE); \ - assemble_name (FILE, VALUE); \ - } \ - fputc ('\n', FILE); \ - } while (0) - - +/* .set on alpha is not used to output labels. */ +#undef SET_ASM_OP + +/* So, provide corresponding default, without the .set. */ +#undef ASM_OUTPUT_DEFINE_LABEL_DIFFERENCE_SYMBOL +#define ASM_OUTPUT_DEFINE_LABEL_DIFFERENCE_SYMBOL(FILE, SY, HI, LO) \ + do { \ + assemble_name (FILE, SY); \ + fputc ('=', FILE); \ + assemble_name (FILE, HI); \ + fputc ('-', FILE); \ + assemble_name (FILE, LO); \ + } while (0) diff --git a/gnu/usr.bin/gcc/gcc/config/alpha/openbsd1.h b/gnu/usr.bin/gcc/gcc/config/alpha/openbsd1.h new file mode 100644 index 00000000000..1e1a2f62784 --- /dev/null +++ b/gnu/usr.bin/gcc/gcc/config/alpha/openbsd1.h @@ -0,0 +1,23 @@ +/* Configuration fragment for an alpha OpenBSD target. + 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. */ + +#define OBSD_HAS_DECLARE_FUNCTION_NAME +#define OBSD_HAS_DECLARE_FUNCTION_SIZE +#define OBSD_HAS_DECLARE_OBJECT diff --git a/gnu/usr.bin/gcc/gcc/config/exec-stack.h b/gnu/usr.bin/gcc/gcc/config/exec-stack.h new file mode 100644 index 00000000000..23cc611fde8 --- /dev/null +++ b/gnu/usr.bin/gcc/gcc/config/exec-stack.h @@ -0,0 +1,40 @@ +/* Enable stack execute around trampoline address. + Copyright (C) 2002 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 FINALIZE_TRAMPOLINE +#define FINALIZE_TRAMPOLINE(TRAMP) \ + emit_library_call(gen_rtx_SYMBOL_REF (Pmode, "__enable_execute_stack"), \ + 0, VOIDmode, 1, memory_address (SImode, (TRAMP)), Pmode) + +#undef TRANSFER_FROM_TRAMPOLINE +#define TRANSFER_FROM_TRAMPOLINE \ +extern void __enable_execute_stack (void *); \ +void \ +__enable_execute_stack (addr) \ + void *addr; \ +{ \ + long size = getpagesize (); \ + long mask = ~(size-1); \ + char *page = (char *) (((long) addr) & mask); \ + char *end = (char *) ((((long) (addr + TRAMPOLINE_SIZE)) & mask) + size); \ + \ + if (mprotect (page, end - page, PROT_READ | PROT_WRITE | PROT_EXEC) < 0) \ + perror ("mprotect of trampoline code"); \ +} diff --git a/gnu/usr.bin/gcc/gcc/config/i386/openbsd.h b/gnu/usr.bin/gcc/gcc/config/i386/openbsd.h index 60f16575e21..95bab6ceb8f 100644 --- a/gnu/usr.bin/gcc/gcc/config/i386/openbsd.h +++ b/gnu/usr.bin/gcc/gcc/config/i386/openbsd.h @@ -29,6 +29,7 @@ Boston, MA 02111-1307, USA. */ #define TARGET_OS_CPP_BUILTINS() \ do \ { \ + OPENBSD_OS_CPP_BUILTINS_COMMON(); \ builtin_define ("__unix__"); \ builtin_define ("__OpenBSD__"); \ builtin_assert ("system=unix"); \ @@ -101,3 +102,19 @@ Boston, MA 02111-1307, USA. */ /* OpenBSD gas currently does not support quad, so do not use it. */ #undef ASM_QUAD + +#define TRANSFER_FROM_TRAMPOLINE \ +extern void __enable_execute_stack (void *); \ +void \ +__enable_execute_stack (addr) \ + void *addr; \ +{ \ + long size = getpagesize (); \ + long mask = ~(size-1); \ + char *page = (char *) (((long) addr) & mask); \ + char *end = (char *) ((((long) (addr + TRAMPOLINE_SIZE)) & mask) + size); \ + \ + /* 7 is PROT_READ | PROT_WRITE | PROT_EXEC */ \ + if (mprotect (page, end - page, 7) < 0) \ + perror ("mprotect of trampoline code"); \ +} diff --git a/gnu/usr.bin/gcc/gcc/config/i386/openbsdelf.h b/gnu/usr.bin/gcc/gcc/config/i386/openbsdelf.h new file mode 100644 index 00000000000..7e97f0daee5 --- /dev/null +++ b/gnu/usr.bin/gcc/gcc/config/i386/openbsdelf.h @@ -0,0 +1,138 @@ +/* Configuration for an OpenBSD i386 target. + + 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. */ + +/* 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 "#" + + +/* This goes away when the math-emulator is fixed */ +#undef TARGET_DEFAULT +#define TARGET_DEFAULT \ + (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_NO_FANCY_MATH_387) + +/* Run-time target specifications */ + +#define TARGET_OS_CPP_BUILTINS() \ + do \ + { \ + OPENBSD_OS_CPP_BUILTINS_ELF(); \ + builtin_define ("__unix__"); \ + builtin_assert ("system=bsd"); \ + } \ + 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/ansi.h> */ +#undef SIZE_TYPE +#define SIZE_TYPE "unsigned int" + +#undef PTRDIFF_TYPE +#define PTRDIFF_TYPE "int" + +#undef WCHAR_TYPE +#define WCHAR_TYPE "int" + +#undef WCHAR_TYPE_SIZE +#define WCHAR_TYPE_SIZE BITS_PER_WORD + +/* 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. */ + +#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN +#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \ + if ((LOG) != 0) {\ + if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \ + else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \ + } +#endif + +/* 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. */ + +/* All configurations that don't use elf must be explicit about not using + dwarf unwind information. egcs doesn't try too hard to check internal + configuration files... */ +#define DWARF2_UNWIND_INFO 0 + +/* 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 + +/* pick up defines for mprotect (used in TRANSFER_FROM_TRANPOLINE) */ +#include <sys/types.h> +#include <sys/mman.h> diff --git a/gnu/usr.bin/gcc/gcc/config/openbsd.h b/gnu/usr.bin/gcc/gcc/config/openbsd.h index 1c215ebbf2d..de599cc6b90 100644 --- a/gnu/usr.bin/gcc/gcc/config/openbsd.h +++ b/gnu/usr.bin/gcc/gcc/config/openbsd.h @@ -66,6 +66,7 @@ Boston, MA 02111-1307, USA. */ /* Under OpenBSD, the normal location of the various *crt*.o files is the /usr/lib directory. */ +#undef STANDARD_STARTFILE_PREFIX #define STANDARD_STARTFILE_PREFIX "/usr/lib/" #endif @@ -73,8 +74,35 @@ Boston, MA 02111-1307, USA. */ /* Controlling the compilation driver. */ +/* TARGET_OS_CPP_BUILTINS() common to all OpenBSD targets. */ +#define OPENBSD_OS_CPP_BUILTINS_COMMON() \ + do \ + { \ + builtin_define ("__OpenBSD__"); \ + builtin_assert ("system=unix"); \ + 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"); \ + } \ + 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,10 +112,9 @@ 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}}}" +/* LIB_SPEC appropriate for OpenBSD. 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}}}" #ifndef OBSD_HAS_CORRECT_SPECS @@ -288,4 +315,3 @@ do { \ 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 1 - diff --git a/gnu/usr.bin/gcc/gcc/config/rs6000/crtsavres.asm b/gnu/usr.bin/gcc/gcc/config/rs6000/crtsavres.asm index 0c65182584d..fc73ba1e10e 100644 --- a/gnu/usr.bin/gcc/gcc/config/rs6000/crtsavres.asm +++ b/gnu/usr.bin/gcc/gcc/config/rs6000/crtsavres.asm @@ -39,7 +39,7 @@ .file "crtsavres.asm" .section ".text" - #include "ppc-asm.h" + #include "rs6000/ppc-asm.h" #ifndef __powerpc64__ diff --git a/gnu/usr.bin/gcc/gcc/config/rs6000/eabi.asm b/gnu/usr.bin/gcc/gcc/config/rs6000/eabi.asm index 058f9b9d5e7..f567fa9fcf4 100644 --- a/gnu/usr.bin/gcc/gcc/config/rs6000/eabi.asm +++ b/gnu/usr.bin/gcc/gcc/config/rs6000/eabi.asm @@ -38,7 +38,7 @@ .file "eabi.asm" .section ".text" - #include "ppc-asm.h" + #include "rs6000/ppc-asm.h" #ifndef __powerpc64__ diff --git a/gnu/usr.bin/gcc/gcc/config/rs6000/openbsd.h b/gnu/usr.bin/gcc/gcc/config/rs6000/openbsd.h new file mode 100644 index 00000000000..1eb1739523c --- /dev/null +++ b/gnu/usr.bin/gcc/gcc/config/rs6000/openbsd.h @@ -0,0 +1,91 @@ +/* Configuration file for an rs6000 OpenBSD target. + 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. */ + +/* XXX need to check ASM_WEAKEN_LABEL/ASM_GLOBALIZE_LABEL. */ + +/* Run-time target specifications. */ +#undef TARGET_OS_CPP_BUILTINS /* FIXME: sysv4.h should not define this! */ +#define TARGET_OS_CPP_BUILTINS() \ + do \ + { \ + OPENBSD_OS_CPP_BUILTINS_ELF(); \ + builtin_define ("__powerpc__"); \ + builtin_assert ("cpu=powerpc"); \ + builtin_assert ("machine=powerpc"); \ + } \ + while (0) + +#undef CPP_OS_DEFAULT_SPEC +#define CPP_OS_DEFAULT_SPEC "%(cpp_os_openbsd)" + +#undef LINKER_NAME +#define LINKER_NAME "ld" + +#undef LINK_SPEC +#define LINK_SPEC "%{shared:-shared} \ + %{!shared: \ + %{!static: \ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.so}} \ + %{static:-static}}" + +#undef LIB_DEFAULT_SPEC +#define LIB_DEFAULT_SPEC "%(lib_openbsd)" + +#undef STARTFILE_DEFAULT_SPEC +#define STARTFILE_DEFAULT_SPEC "%(startfile_openbsd)" + +#undef ENDFILE_DEFAULT_SPEC +#define ENDFILE_DEFAULT_SPEC "%(endfile_openbsd)" + +#undef LINK_START_DEFAULT_SPEC +#define LINK_START_DEFAULT_SPEC "%(link_start_openbsd)" + +#undef LINK_OS_DEFAULT_SPEC +#define LINK_OS_DEFAULT_SPEC "%(link_os_openbsd)" + +#undef TARGET_VERSION +#define TARGET_VERSION fprintf (stderr, " (PowerPC OpenBSD)"); + +/* Default ABI to use */ +#undef RS6000_ABI_NAME +#define RS6000_ABI_NAME "openbsd" + +/* Define this macro as a C expression for the initializer of an + array of string to tell the driver program which options are + defaults for this target and thus do not need to be handled + specially when using `MULTILIB_OPTIONS'. + + Do not define this macro if `MULTILIB_OPTIONS' is not defined in + the target makefile fragment or if none of the options listed in + `MULTILIB_OPTIONS' are set by default. *Note Target Fragment::. */ + +#undef MULTILIB_DEFAULTS +#define MULTILIB_DEFAULTS { "mbig", "mcall-openbsd" } + +/* collect2 support (Macros for initialization). */ + + +/* Don't tell collect2 we use COFF as we don't have (yet ?) a dynamic ld + library with the proper functions to handle this -> collect2 will + default to using nm. */ +#undef OBJECT_FORMAT_COFF + + diff --git a/gnu/usr.bin/gcc/gcc/config/rs6000/openbsd1.h b/gnu/usr.bin/gcc/gcc/config/rs6000/openbsd1.h new file mode 100644 index 00000000000..bc6ead08122 --- /dev/null +++ b/gnu/usr.bin/gcc/gcc/config/rs6000/openbsd1.h @@ -0,0 +1,24 @@ +/* Configuration file for an rs6000 OpenBSD target. + 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. */ + +#define OBSD_HAS_CORRECT_SPECS +#define OBSD_HAS_DECLARE_FUNCTION_NAME +#define OBSD_HAS_DECLARE_FUNCTION_SIZE +#define OBSD_HAS_DECLARE_OBJECT diff --git a/gnu/usr.bin/gcc/gcc/config/rs6000/sysv4.h b/gnu/usr.bin/gcc/gcc/config/rs6000/sysv4.h index 3da996fbd54..c40e5af28f4 100644 --- a/gnu/usr.bin/gcc/gcc/config/rs6000/sysv4.h +++ b/gnu/usr.bin/gcc/gcc/config/rs6000/sysv4.h @@ -197,6 +197,8 @@ do { \ rs6000_current_abi = ABI_V4; \ else if (!strcmp (rs6000_abi_name, "linux")) \ rs6000_current_abi = ABI_V4; \ + else if (!strcmp (rs6000_abi_name, "openbsd")) \ + rs6000_current_abi = ABI_V4; \ else if (!strcmp (rs6000_abi_name, "gnu")) \ rs6000_current_abi = ABI_V4; \ else if (!strcmp (rs6000_abi_name, "netbsd")) \ @@ -823,6 +825,7 @@ do { \ %{mcall-freebsd: -mbig} \ %{mcall-i960-old: -mlittle} \ %{mcall-linux: -mbig} \ + %{mcall-openbsd: -mbig} \ %{mcall-gnu: -mbig} \ %{mcall-netbsd: -mbig} \ }}}}" @@ -847,11 +850,13 @@ do { \ %{mcall-freebsd: -mbig %(cc1_endian_big) } \ %{mcall-i960-old: -mlittle %(cc1_endian_little) } \ %{mcall-linux: -mbig %(cc1_endian_big) } \ + %{mcall-openbsd: -mbig %(cc1_endian_big) } \ %{mcall-gnu: -mbig %(cc1_endian_big) } \ %{mcall-netbsd: -mbig %(cc1_endian_big) } \ - %{!mcall-aixdesc: %{!mcall-freebsd: %{!mcall-i960-old: %{!mcall-linux: %{!mcall-gnu: %{!mcall-netbsd: \ + %{!mcall-aixdesc: %{!mcall-freebsd: %{!mcall-i960-old: %{!mcall-linux: \ + %{!mcall-openbsd: %{!mcall-gnu: %{!mcall-netbsd: \ %(cc1_endian_default) \ - }}}}}} \ + }}}}}}} \ }}}} \ %{mno-sdata: -msdata=none } \ %{meabi: %{!mcall-*: -mcall-sysv }} \ @@ -860,6 +865,7 @@ do { \ %{mcall-freebsd: -mno-eabi } \ %{mcall-i960-old: -meabi } \ %{mcall-linux: -mno-eabi } \ + %{mcall-openbsd: -mno-eabi } \ %{mcall-gnu: -mno-eabi } \ %{mcall-netbsd: -mno-eabi }}} \ %{msdata: -msdata=default} \ @@ -892,11 +898,12 @@ do { \ %{mwindiss: %(link_start_windiss) } \ %{mcall-freebsd: %(link_start_freebsd) } \ %{mcall-linux: %(link_start_linux) } \ +%{mcall-openbsd: %(link_start_openbsd) } \ %{mcall-gnu: %(link_start_gnu) } \ %{mcall-netbsd: %(link_start_netbsd) } \ %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mwindiss: \ - %{!mcall-linux: %{!mcall-gnu: %{!mcall-netbsd: \ - %{!mcall-freebsd: %(link_start_default) }}}}}}}}}" + %{!mcall-linux: %{!mcall-openbsd: %{!mcall-gnu: %{!mcall-netbsd: \ + %{!mcall-freebsd: %(link_start_default) }}}}}}}}}}" #define LINK_START_DEFAULT_SPEC "" @@ -951,11 +958,12 @@ do { \ %{mwindiss: %(link_os_windiss) } \ %{mcall-freebsd: %(link_os_freebsd) } \ %{mcall-linux: %(link_os_linux) } \ +%{mcall-openbsd: %(link_os_openbsd) } \ %{mcall-gnu: %(link_os_gnu) } \ %{mcall-netbsd: %(link_os_netbsd) } \ %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mwindiss: \ - %{!mcall-freebsd: %{!mcall-linux: %{!mcall-gnu: \ - %{!mcall-netbsd: %(link_os_default) }}}}}}}}}" + %{!mcall-freebsd: %{!mcall-linux: %{!mcall-openbsd: %{!mcall-gnu: \ + %{!mcall-netbsd: %(link_os_default) }}}}}}}}}}" #define LINK_OS_DEFAULT_SPEC "" @@ -973,12 +981,13 @@ do { \ %{msim: %(cpp_os_sim) } \ %{mwindiss: %(cpp_os_windiss) } \ %{mcall-freebsd: %(cpp_os_freebsd) } \ +%{mcall-openbsd: %(cpp_os_openbsd) } \ %{mcall-linux: %(cpp_os_linux) } \ %{mcall-gnu: %(cpp_os_gnu) } \ %{mcall-netbsd: %(cpp_os_netbsd) } \ %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mwindiss: \ - %{!mcall-freebsd: %{!mcall-linux: %{!mcall-gnu: \ - %{!mcall-netbsd: %(cpp_os_default) }}}}}}}}}" + %{!mcall-freebsd: %{!mcall-linux: %{!mcall-openbsd: %{!mcall-gnu: \ + %{!mcall-netbsd: %(cpp_os_default) }}}}}}}}}}" #define CPP_OS_DEFAULT_SPEC "" @@ -992,11 +1001,12 @@ do { \ %{mwindiss: %(startfile_windiss) } \ %{mcall-freebsd: %(startfile_freebsd) } \ %{mcall-linux: %(startfile_linux) } \ +%{mcall-openbsd: %(startfile_openbsd) } \ %{mcall-gnu: %(startfile_gnu) } \ %{mcall-netbsd: %(startfile_netbsd) } \ %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mwindiss: \ - %{!mcall-freebsd: %{!mcall-linux: %{!mcall-gnu: \ - %{!mcall-netbsd: %(startfile_default) }}}}}}}}}" + %{!mcall-freebsd: %{!mcall-linux: %{!mcall-openbsd: %{!mcall-gnu: \ + %{!mcall-netbsd: %(startfile_default) }}}}}}}}}}" #define STARTFILE_DEFAULT_SPEC "" @@ -1010,11 +1020,12 @@ do { \ %{mwindiss: %(lib_windiss) } \ %{mcall-freebsd: %(lib_freebsd) } \ %{mcall-linux: %(lib_linux) } \ +%{mcall-openbsd: %(lib_openbsd) } \ %{mcall-gnu: %(lib_gnu) } \ %{mcall-netbsd: %(lib_netbsd) } \ %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mwindiss: \ - %{!mcall-freebsd: %{!mcall-linux: %{!mcall-gnu: \ - %{!mcall-netbsd: %(lib_default) }}}}}}}}}" + %{!mcall-freebsd: %{!mcall-linux: %{!mcall-openbsd: %{!mcall-gnu: \ + %{!mcall-netbsd: %(lib_default) }}}}}}}}}}" #define LIB_DEFAULT_SPEC "" @@ -1028,13 +1039,14 @@ do { \ %{mwindiss: %(endfile_windiss)} \ %{mcall-freebsd: crtsavres.o%s %(endfile_freebsd) } \ %{mcall-linux: crtsavres.o%s %(endfile_linux) } \ +%{mcall-openbsd: crtsavres.o%s %(endfile_openbsd) } \ %{mcall-gnu: crtsavres.o%s %(endfile_gnu) } \ %{mcall-netbsd: crtsavres.o%s %(endfile_netbsd) } \ %{mvxworks: crtsavres.o%s %(endfile_vxworks) } \ %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mwindiss: \ - %{!mcall-freebsd: %{!mcall-linux: %{!mcall-gnu: \ + %{!mcall-freebsd: %{!mcall-linux: %{!mcall-openbsd: %{!mcall-gnu: \ %{!mcall-netbsd: %{!mvxworks: %(crtsavres_default) \ - %(endfile_default) }}}}}}}}}}" + %(endfile_default) }}}}}}}}}}}" #define CRTSAVRES_DEFAULT_SPEC "crtsavres.o%s" @@ -1231,6 +1243,46 @@ ncrtn.o%s" %{mcpu=821: %{!Dppc*: %{!Dmpc*: -Dmpc821} } } \ %{mcpu=860: %{!Dppc*: %{!Dmpc*: -Dmpc860} } }" +/* OpenBSD support. */ +#ifndef LIB_OPENBSD_SPEC +#define LIB_OPENBSD_SPEC "%{mnewlib: --start-group %(libc_openbsd) --end-group } %{!mnewlib: %(libc_openbsd) }" +#endif + +#ifndef LIBC_OPENBSD_SPEC +#define LIBC_OPENBSD_SPEC "%{!shared:%{pthread:-lpthread%{p:_p}%{!p:%{pg:_p}}}} %{!shared:-lc%{p:_p}%{!p:%{pg:_p}}}" +#endif + +#ifndef STARTFILE_OPENBSD_SPEC +#define STARTFILE_OPENBSD_SPEC "\ +%{!shared: %{pg:gcrt0.o%s} %{!pg:%{p:gcrt0.o%s} %{!p:crt0.o%s}}} \ +%{mnewlib: ecrti.o%s} \ +%{!mnewlib: %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}}" +#endif +/* +%{!mnewlib: crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}}" +*/ + +#ifndef ENDFILE_OPENBSD_SPEC +#define ENDFILE_OPENBSD_SPEC "\ +%{mnewlib: ecrtn.o%s} \ +%{!mnewlib: %{!shared:crtend.o%s} %{shared:crtendS.o%s}}" +#endif +/* +%{!mnewlib: %{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s}" +*/ + +#ifndef LINK_START_OPENBSD_SPEC +#define LINK_START_OPENBSD_SPEC "-Ttext 0x400074" +#endif + +#ifndef LINK_OS_OPENBSD_SPEC +#define LINK_OS_OPENBSD_SPEC "" +#endif + +#ifndef CPP_OS_OPENBSD_SPEC +#define CPP_OS_OPENBSD_SPEC OBSD_CPP_SPEC +#endif + /* VxWorks support. */ /* VxWorks does all the library stuff itself. */ #define LIB_VXWORKS_SPEC "" @@ -1306,6 +1358,8 @@ ncrtn.o%s" { "lib_gnu", LIB_GNU_SPEC }, \ { "lib_linux", LIB_LINUX_SPEC }, \ { "lib_netbsd", LIB_NETBSD_SPEC }, \ + { "lib_openbsd", LIB_OPENBSD_SPEC }, \ + { "libc_openbsd", LIBC_OPENBSD_SPEC }, \ { "lib_vxworks", LIB_VXWORKS_SPEC }, \ { "lib_windiss", LIB_WINDISS_SPEC }, \ { "lib_default", LIB_DEFAULT_SPEC }, \ @@ -1317,6 +1371,7 @@ ncrtn.o%s" { "startfile_gnu", STARTFILE_GNU_SPEC }, \ { "startfile_linux", STARTFILE_LINUX_SPEC }, \ { "startfile_netbsd", STARTFILE_NETBSD_SPEC }, \ + { "startfile_openbsd", STARTFILE_OPENBSD_SPEC }, \ { "startfile_vxworks", STARTFILE_VXWORKS_SPEC }, \ { "startfile_windiss", STARTFILE_WINDISS_SPEC }, \ { "startfile_default", STARTFILE_DEFAULT_SPEC }, \ @@ -1328,6 +1383,7 @@ ncrtn.o%s" { "endfile_gnu", ENDFILE_GNU_SPEC }, \ { "endfile_linux", ENDFILE_LINUX_SPEC }, \ { "endfile_netbsd", ENDFILE_NETBSD_SPEC }, \ + { "endfile_openbsd", ENDFILE_OPENBSD_SPEC }, \ { "endfile_vxworks", ENDFILE_VXWORKS_SPEC }, \ { "endfile_windiss", ENDFILE_WINDISS_SPEC }, \ { "endfile_default", ENDFILE_DEFAULT_SPEC }, \ @@ -1343,6 +1399,7 @@ ncrtn.o%s" { "link_start_gnu", LINK_START_GNU_SPEC }, \ { "link_start_linux", LINK_START_LINUX_SPEC }, \ { "link_start_netbsd", LINK_START_NETBSD_SPEC }, \ + { "link_start_openbsd", LINK_START_OPENBSD_SPEC }, \ { "link_start_vxworks", LINK_START_VXWORKS_SPEC }, \ { "link_start_windiss", LINK_START_WINDISS_SPEC }, \ { "link_start_default", LINK_START_DEFAULT_SPEC }, \ @@ -1355,6 +1412,7 @@ ncrtn.o%s" { "link_os_linux", LINK_OS_LINUX_SPEC }, \ { "link_os_gnu", LINK_OS_GNU_SPEC }, \ { "link_os_netbsd", LINK_OS_NETBSD_SPEC }, \ + { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \ { "link_os_vxworks", LINK_OS_VXWORKS_SPEC }, \ { "link_os_windiss", LINK_OS_WINDISS_SPEC }, \ { "link_os_default", LINK_OS_DEFAULT_SPEC }, \ @@ -1368,6 +1426,7 @@ ncrtn.o%s" { "cpp_os_freebsd", CPP_OS_FREEBSD_SPEC }, \ { "cpp_os_gnu", CPP_OS_GNU_SPEC }, \ { "cpp_os_linux", CPP_OS_LINUX_SPEC }, \ + { "cpp_os_openbsd", CPP_OS_OPENBSD_SPEC }, \ { "cpp_os_netbsd", CPP_OS_NETBSD_SPEC }, \ { "cpp_os_rtems", CPP_OS_RTEMS_SPEC }, \ { "cpp_os_vxworks", CPP_OS_VXWORKS_SPEC }, \ diff --git a/gnu/usr.bin/gcc/gcc/config/rs6000/t-openbsd b/gnu/usr.bin/gcc/gcc/config/rs6000/t-openbsd new file mode 100644 index 00000000000..66e403e5d20 --- /dev/null +++ b/gnu/usr.bin/gcc/gcc/config/rs6000/t-openbsd @@ -0,0 +1,55 @@ +# include t-rs6000 too +# this is taken from t-ppccomm +# but crt* removed. + + +LIB2FUNCS_EXTRA = tramp.S + +# This one can't end up in shared libgcc +LIB2FUNCS_STATIC_EXTRA = eabi.S + +# We want fine grained libraries, so use the new code to build the +# floating point emulation libraries. +FPBIT = fp-bit.c +DPBIT = dp-bit.c + + +dp-bit.c: $(srcdir)/config/fp-bit.c + cat $(srcdir)/config/fp-bit.c > dp-bit.c + +fp-bit.c: $(srcdir)/config/fp-bit.c + echo '#define FLOAT' > fp-bit.c + cat $(srcdir)/config/fp-bit.c >> fp-bit.c + +eabi.S: $(srcdir)/config/rs6000/eabi.asm + cat $(srcdir)/config/rs6000/eabi.asm > eabi.S + +tramp.S: $(srcdir)/config/rs6000/tramp.asm + cat $(srcdir)/config/rs6000/tramp.asm > tramp.S + +# Switch synonyms +MULTILIB_MATCHES_FLOAT = msoft-float=mcpu?401 \ + msoft-float=mcpu?403 \ + msoft-float=mcpu?ec603e \ + msoft-float=mcpu?801 \ + msoft-float=mcpu?821 \ + msoft-float=mcpu?823 \ + msoft-float=mcpu?860 +MULTILIB_MATCHES_ENDIAN = mlittle=mlittle-endian mbig=mbig-endian +MULTILIB_MATCHES_SYSV = mcall-sysv=mcall-sysv-eabi mcall-sysv=mcall-sysv-noeabi mcall-sysv=mcall-linux mcall-sysv=mcall-netbsd + +LIBGCC = stmp-multilib +INSTALL_LIBGCC = install-multilib +EXTRA_MULTILIB_PARTS = crtsavres$(objext) + +crtsavres.S: $(srcdir)/config/rs6000/crtsavres.asm + cat $(srcdir)/config/rs6000/crtsavres.asm >crtsavres.S + +$(T)crtsavres$(objext): crtsavres.S + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c crtsavres.S -o $(T)crtsavres$(objext) + +# It is important that crtbegin.o, etc., aren't surprised by stuff in .sdata. +CRTSTUFF_T_CFLAGS = -msdata=none +# Make sure crt*.o are built with -fPIC even if configured with +# --enable-shared --disable-multilib +CRTSTUFF_T_CFLAGS_S = -fPIC -msdata=none diff --git a/gnu/usr.bin/gcc/gcc/config/rs6000/tramp.asm b/gnu/usr.bin/gcc/gcc/config/rs6000/tramp.asm index c2a38d10f5c..f34dcf359be 100644 --- a/gnu/usr.bin/gcc/gcc/config/rs6000/tramp.asm +++ b/gnu/usr.bin/gcc/gcc/config/rs6000/tramp.asm @@ -37,7 +37,7 @@ .file "tramp.asm" .section ".text" - #include "ppc-asm.h" + #include "rs6000/ppc-asm.h" .type trampoline_initial,@object .align 2 diff --git a/gnu/usr.bin/gcc/gcc/config/sparc/openbsd.h b/gnu/usr.bin/gcc/gcc/config/sparc/openbsd.h index a4333df79ab..6c76257a2c0 100644 --- a/gnu/usr.bin/gcc/gcc/config/sparc/openbsd.h +++ b/gnu/usr.bin/gcc/gcc/config/sparc/openbsd.h @@ -23,7 +23,14 @@ Boston, MA 02111-1307, USA. */ #include <openbsd.h> /* Run-time target specifications. */ -#define CPP_PREDEFINES "-D__unix__ -D__sparc__ -D__OpenBSD__ -Asystem=unix -Asystem=OpenBSD -Acpu=sparc -Amachine=sparc" +#define TARGET_OS_CPP_BUILTINS() \ + do \ + { \ + OPENBSD_OS_CPP_BUILTINS_ELF(); \ + builtin_define ("__sparc"); \ + builtin_define ("__sparc__"); \ + } \ + while (0) /* Layout of source language data types */ diff --git a/gnu/usr.bin/gcc/gcc/config/sparc/openbsd1-64.h b/gnu/usr.bin/gcc/gcc/config/sparc/openbsd1-64.h index 1310538d728..fd00c8ddef5 100644 --- a/gnu/usr.bin/gcc/gcc/config/sparc/openbsd1-64.h +++ b/gnu/usr.bin/gcc/gcc/config/sparc/openbsd1-64.h @@ -22,3 +22,27 @@ Boston, MA 02111-1307, USA. */ #define OBSD_HAS_DECLARE_FUNCTION_SIZE #define OBSD_HAS_DECLARE_OBJECT +/* Configuration file for sparc64 OpenBSD target. + Copyright (C) 1999 Free Software Foundation, Inc. + +This file is part of GCC. + +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) +any later version. + +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 GCC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#define OBSD_HAS_DECLARE_FUNCTION_NAME +#define OBSD_HAS_DECLARE_FUNCTION_SIZE +#define OBSD_HAS_DECLARE_OBJECT + diff --git a/gnu/usr.bin/gcc/gcc/config/sparc/openbsd64.h b/gnu/usr.bin/gcc/gcc/config/sparc/openbsd64.h index 4dfe3819c33..8b1d8618eb7 100644 --- a/gnu/usr.bin/gcc/gcc/config/sparc/openbsd64.h +++ b/gnu/usr.bin/gcc/gcc/config/sparc/openbsd64.h @@ -31,8 +31,239 @@ Boston, MA 02111-1307, USA. */ #define SPARC_DEFAULT_CMODEL CM_MEDMID /* Run-time target specifications. */ -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-D__unix__ -D__sparc__ -D__sparc64__ -D__sparcv9__ -D__sparc_v9__ -D__arch64__ -D__ELF__ -D__OpenBSD__ -Asystem(unix) -Asystem(OpenBSD) -Acpu(sparc) -Amachine(sparc)" +#define TARGET_OS_CPP_BUILTINS() \ + do \ + { \ + OPENBSD_OS_CPP_BUILTINS_ELF(); \ + OPENBSD_OS_CPP_BUILTINS_LP64(); \ + builtin_define ("__sparc64__"); \ + builtin_define ("__sparc_v9__"); \ + builtin_define ("__arch64__"); \ + builtin_define ("__sparc__"); \ + } \ + while (0) + +#undef CPP_SUBTARGET_SPEC +#define CPP_SUBTARGET_SPEC "" + +#undef MD_EXEC_PREFIX +#undef MD_STARTFILE_PREFIX + +#undef ASM_SPEC +#define ASM_SPEC "\ +%{v:-V} -s %{fpic:-K PIC} %{fPIC:-K PIC} \ +%{mlittle-endian:-EL} \ +%(asm_cpu) %(asm_arch) \ +" + +/* Layout of source language data types. */ +#undef WCHAR_TYPE +#define WCHAR_TYPE "int" + +#undef WCHAR_TYPE_SIZE +#define WCHAR_TYPE_SIZE 32 + +#undef LONG_DOUBLE_TYPE_SIZE +#define LONG_DOUBLE_TYPE_SIZE 128 + +#undef WINT_TYPE +#define WINT_TYPE "long int" + +#undef WINT_TYPE_SIZE +#define WINT_TYPE_SIZE 32 + +#define HANDLE_PRAGMA_REDEFINE_EXTNAME 1 + +#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}" + +/* 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}" + +#undef ASM_CPU_DEFAULT_SPEC +#define ASM_CPU_DEFAULT_SPEC "-xarch=v8plusa" + +#undef ASM_CPU_SPEC +#define ASM_CPU_SPEC "\ +%{mcpu=v8plus:-xarch=v8plus} \ +%{mcpu=ultrasparc:-xarch=v8plusa} \ +%{!mcpu*:%(asm_cpu_default)} \ +" + +/* Same as sparc.h */ +#undef DBX_REGISTER_NUMBER +#define DBX_REGISTER_NUMBER(REGNO) \ + (TARGET_FLAT && (REGNO) == HARD_FRAME_POINTER_REGNUM ? 31 : REGNO) + +/* We use stabs-in-elf by default, because that is what the native + toolchain uses. */ +#undef PREFERRED_DEBUGGING_TYPE +#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG + +/* The Solaris 2 assembler uses .skip, not .zero, so put this back. */ +#undef ASM_OUTPUT_SKIP +#define ASM_OUTPUT_SKIP(FILE,SIZE) \ + fprintf (FILE, "\t.skip %u\n", (SIZE)) + +#undef LOCAL_LABEL_PREFIX +#define LOCAL_LABEL_PREFIX "." + +/* This is how to output a definition of an internal numbered label where + PREFIX is the class of label and NUM is the number within the class. */ + +#undef ASM_OUTPUT_INTERNAL_LABEL +#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \ + fprintf (FILE, ".L%s%d:\n", PREFIX, NUM) + +/* This is how to output a reference to an internal numbered label where + PREFIX is the class of label and NUM is the number within the class. */ + +#undef ASM_OUTPUT_INTERNAL_LABELREF +#define ASM_OUTPUT_INTERNAL_LABELREF(FILE,PREFIX,NUM) \ + fprintf (FILE, ".L%s%d", PREFIX, NUM) + +/* This is how to store into the string LABEL + the symbol_ref name of an internal numbered label where + PREFIX is the class of label and NUM is the number within the class. + This is suitable for output with `assemble_name'. */ + +#undef ASM_GENERATE_INTERNAL_LABEL +#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \ + sprintf ((LABEL), "*.L%s%ld", (PREFIX), (long)(NUM)) + +/* Select a format to encode pointers in exception handling data. CODE + is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is + true if the symbol may be affected by dynamic relocations. + + Some Solaris dynamic linkers don't handle unaligned section relative + relocs properly, so force them to be aligned. */ +#ifndef HAVE_AS_SPARC_UA_PCREL +#define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \ + ((flag_pic || GLOBAL) ? DW_EH_PE_aligned : DW_EH_PE_absptr) +#endif + +/* ??? This does not work in SunOS 4.x, so it is not enabled in sparc.h. + Instead, it is enabled here, because it does work under Solaris. */ +/* Define for support of TFmode long double and REAL_ARITHMETIC. + Sparc ABI says that long double is 4 words. */ +#define LONG_DOUBLE_TYPE_SIZE 128 + +/* But indicate that it isn't supported by the hardware. */ +#define WIDEST_HARDWARE_FP_SIZE 64 + +#define STDC_0_IN_SYSTEM_HEADERS 1 + +#define MULDI3_LIBCALL "__mul64" +#define DIVDI3_LIBCALL "__div64" +#define UDIVDI3_LIBCALL "__udiv64" +#define MODDI3_LIBCALL "__rem64" +#define UMODDI3_LIBCALL "__urem64" + +#undef INIT_SUBTARGET_OPTABS +#define INIT_SUBTARGET_OPTABS \ + fixsfdi_libfunc \ + = init_one_libfunc (TARGET_ARCH64 ? "__ftol" : "__ftoll"); \ + fixunssfdi_libfunc \ + = init_one_libfunc (TARGET_ARCH64 ? "__ftoul" : "__ftoull"); \ + fixdfdi_libfunc \ + = init_one_libfunc (TARGET_ARCH64 ? "__dtol" : "__dtoll"); \ + fixunsdfdi_libfunc \ + = init_one_libfunc (TARGET_ARCH64 ? "__dtoul" : "__dtoull") + + +/* + * Attempt to turn on access permissions for the stack. + * + * This code must be defined when compiling gcc but not when compiling + * libgcc2.a, unless we're generating code for 64 bits SPARC + * + * _SC_STACK_PROT is only defined for post 2.6, but we want this code + * to run always. 2.6 can change the stack protection but has no way to + * query it. + * + */ + +/* This declares mprotect (used in TRANSFER_FROM_TRAMPOLINE) for + libgcc2.c. */ +/* We don't want to include this because sys/mman.h is not present on + some non-Solaris configurations that use sol2.h. */ +#if 0 /* def L_trampoline */ +#include <sys/mman.h> +#endif + +#define TRANSFER_FROM_TRAMPOLINE \ +static int need_enable_exec_stack; \ + \ +static void check_enabling(void) __attribute__ ((constructor)); \ +static void check_enabling(void) \ +{ \ + extern long sysconf(int); \ + \ + int prot = (int) sysconf(515 /*_SC_STACK_PROT */); \ + if (prot != 7) \ + need_enable_exec_stack = 1; \ +} \ + \ +extern void __enable_execute_stack (void *); \ +void \ +__enable_execute_stack (addr) \ + void *addr; \ +{ \ + if (!need_enable_exec_stack) \ + return; \ + else { \ + long size = getpagesize (); \ + long mask = ~(size-1); \ + char *page = (char *) (((long) addr) & mask); \ + char *end = (char *) ((((long) (addr + TRAMPOLINE_SIZE)) & mask) + size); \ + \ + /* 7 is PROT_READ | PROT_WRITE | PROT_EXEC */ \ + if (mprotect (page, end - page, 7) < 0) \ + perror ("mprotect of trampoline code"); \ + } \ +} +/* Configuration file for sparc64 OpenBSD target. + Copyright (C) 1999 Free Software Foundation, Inc. + +This file is part of GCC. + +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) +any later version. + +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 GCC; 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, " (sparc64 OpenBSD ELF)") + +/* XXX - do we really want HARD_QUAD? */ +#undef TARGET_DEFAULT +#define TARGET_DEFAULT \ +(MASK_V9 + MASK_PTR64 + MASK_64BIT + MASK_HARD_QUAD \ + + MASK_APP_REGS + MASK_FPU + MASK_STACK_BIAS + MASK_LONG_DOUBLE_128) + +#undef SPARC_DEFAULT_CMODEL +#define SPARC_DEFAULT_CMODEL CM_MEDMID #undef CPP_SUBTARGET_SPEC #define CPP_SUBTARGET_SPEC "" diff --git a/gnu/usr.bin/gcc/gcc/config/x-openbsd b/gnu/usr.bin/gcc/gcc/config/x-openbsd new file mode 100644 index 00000000000..e08981bb540 --- /dev/null +++ b/gnu/usr.bin/gcc/gcc/config/x-openbsd @@ -0,0 +1,11 @@ +# enforce yacc... +BISON=yacc +# no built libiberty +LIBIBERTY= +BUILD_LIBIBERTY= +# because it's a `system lib' +CLIB=-liberty +# and so, we get obstack from there too +OBSTACK= +# don't build c++filt from there +DEMANGLER_PROG= |