diff options
author | Per Fogelstrom <pefo@cvs.openbsd.org> | 1996-05-15 14:00:21 +0000 |
---|---|---|
committer | Per Fogelstrom <pefo@cvs.openbsd.org> | 1996-05-15 14:00:21 +0000 |
commit | ce1d3b10f86b2ea904d4cd28262ffd46f2ee3781 (patch) | |
tree | e1be4e964893dbf043d3180710175066f177a869 /gnu/usr.bin/gcc/config | |
parent | a9fc1918f1d166c30ca216d07c4d2d057726a85d (diff) |
Additions for Mips ELF shlib support
Diffstat (limited to 'gnu/usr.bin/gcc/config')
-rw-r--r-- | gnu/usr.bin/gcc/config/mips/openbsd-be.h | 284 | ||||
-rw-r--r-- | gnu/usr.bin/gcc/config/mips/openbsd-le.h | 284 | ||||
-rw-r--r-- | gnu/usr.bin/gcc/config/mips/openbsd.h | 85 |
3 files changed, 637 insertions, 16 deletions
diff --git a/gnu/usr.bin/gcc/config/mips/openbsd-be.h b/gnu/usr.bin/gcc/config/mips/openbsd-be.h new file mode 100644 index 00000000000..46ff2eb614e --- /dev/null +++ b/gnu/usr.bin/gcc/config/mips/openbsd-be.h @@ -0,0 +1,284 @@ +/* Definitions for MIPS systems running BSD as target machine for GNU compiler. + Copyright (C) 1993, 1995 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. */ + +/* We settle for big endian for now */ + +#define TARGET_ENDIAN_DEFAULT MASK_BIG_ENDIAN + +/* Look for the include files in the system-defined places. */ + +#ifndef CROSS_COMPILE +#undef GPLUSPLUS_INCLUDE_DIR +#define GPLUSPLUS_INCLUDE_DIR "/usr/include/g++" + +#undef GCC_INCLUDE_DIR +#define GCC_INCLUDE_DIR "/usr/include" + +#undef INCLUDE_DEFAULTS +#define INCLUDE_DEFAULTS \ + { \ + { GPLUSPLUS_INCLUDE_DIR, 1, 1 }, \ + { GCC_INCLUDE_DIR, 0, 0 }, \ + { 0, 0, 0 } \ + } + +/* 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 + +/* Provide a LINK_SPEC appropriate for OpenBSD. Here we provide support + for the special GCC options -static, -assert, and -nostdlib. */ + +#undef LINK_SPEC +#define LINK_SPEC \ + "%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} \ + %{bestGnum} %{shared} %{non_shared} \ + %{call_shared} %{no_archive} %{exact_version} \ + %{!shared: %{!non_shared: %{!call_shared: -non_shared}}} \ + %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.so} \ + %{!nostdlib:%{!r*:%{!e*:-e __start}}} -dc -dp \ + %{static:-Bstatic} %{!static:-Bdynamic} %{assert*}" + +/* We have atexit(3). */ + +#define HAVE_ATEXIT + +/* Implicit library calls should use memcpy, not bcopy, etc. */ + +#define TARGET_MEM_FUNCTIONS + +/* Define mips-specific OpenBSD predefines... */ +#ifndef CPP_PREDEFINES +#define CPP_PREDEFINES "-D__ANSI_COMPAT \ +-DMIPSEL -DR3000 -DSYSTYPE_BSD -D_SYSTYPE_BSD -D__OpenBSD__ -D__NetBSD__ -Dmips \ +-D__NO_LEADING_UNDERSCORES__ -D__GP_SUPPORT__ \ +-Dunix -D_R3000 \ +-Asystem(unix) -Asystem(OpenBSD) -Amachine(mips)" +#endif + +#ifndef CC1_SPEC +#define CC1_SPEC "\ +%{gline:%{!g:%{!g0:%{!g1:%{!g2: -g1}}}}} \ +%{mips1:-mfp32 -mgp32}%{mips2:-mfp32 -mgp32}\ +%{mips3:%{!msingle-float:%{!m4650:-mfp64}} -mgp64} \ +%{mips4:%{!msingle-float:%{!m4650:-mfp64}} -mgp64} \ +%{mfp64:%{msingle-float:%emay not use both -mfp64 and -msingle-float}} \ +%{mfp64:%{m4650:%emay not use both -mfp64 and -m4650}} \ +%{m4650:-mcpu=r4650} \ +%{G*} %{EB:-meb} %{EL:-mel} %{EB:%{EL:%emay not use both -EB and -EL}} \ +%{pic-none: -mno-half-pic} \ +%{pic-lib: -mhalf-pic} \ +%{pic-extern: -mhalf-pic} \ +%{pic-calls: -mhalf-pic} \ +%{save-temps: } \ +%{!mno-abicalls: -mabicalls}" +#endif + +/* Always uses gas. */ +#ifndef ASM_SPEC +#define ASM_SPEC "\ +%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} %{v} \ +%{noasmopt:-O0} \ +%{!noasmopt:%{O:-O2} %{O1:-O2} %{O2:-O2} %{O3:-O3}} \ +%{g} %{g0} %{g1} %{g2} %{g3} \ +%{ggdb:-g} %{ggdb0:-g0} %{ggdb1:-g1} %{ggdb2:-g2} %{ggdb3:-g3} \ +%{gstabs:-g} %{gstabs0:-g0} %{gstabs1:-g1} %{gstabs2:-g2} %{gstabs3:-g3} \ +%{gstabs+:-g} %{gstabs+0:-g0} %{gstabs+1:-g1} %{gstabs+2:-g2} %{gstabs+3:-g3} \ +%{gcoff:-g} %{gcoff0:-g0} %{gcoff1:-g1} %{gcoff2:-g2} %{gcoff3:-g3} \ +%{membedded-pic} %{fPIC:-KPIC}" +#endif + +#ifndef CPP_SPEC +#define CPP_SPEC "\ +%{posix:-D_POSIX_SOURCE} \ +%{mlong64:-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int} \ +%{!mlong64:-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int} \ +%{mips3:-U__mips -D__mips=3 -D__mips64} \ +%{mgp32:-U__mips64} %{mgp64:-D__mips64}" +#endif + +#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}" + +#undef LIB_SPEC +#define LIB_SPEC "%{p:-lprof1} %{pg:-lprof1} -lc crtn.o%s" +#define STARTFILE_SPEC \ + "%{!shared:%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s libprof1.a%s}%{!p:crt1.o%s}}}" + +#ifndef MACHINE_TYPE +#define MACHINE_TYPE "OpenBSD/mips" +#endif + +#define TARGET_DEFAULT MASK_GAS +#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG + +#define LOCAL_LABEL_PREFIX "." + +/* -G is incompatible with -KPIC which is the default, so only allow objects + in the small data section if the user explicitly asks for it. */ +#undef MIPS_DEFAULT_GVALUE +#define MIPS_DEFAULT_GVALUE 0 + +#include "mips/mips.h" + +/* + * Some imports from svr4.h in support of shared libraries. + * Currently, we need the DECLARE_OBJECT_SIZE stuff. + */ + +/* Define the strings used for the special svr4 .type and .size directives. + These strings generally do not vary from one system running svr4 to + another, but if a given system (e.g. m88k running svr) needs to use + different pseudo-op names for these, they may be overridden in the + file which includes this one. */ + +#undef TYPE_ASM_OP +#undef SIZE_ASM_OP +#undef WEAK_ASM_OP +#define TYPE_ASM_OP ".type" +#define SIZE_ASM_OP ".size" +#define WEAK_ASM_OP ".weak" + +/* The following macro defines the format used to output the second + operand of the .type assembler directive. Different svr4 assemblers + expect various different forms for this operand. The one given here + is just a default. You may need to override it in your machine- + specific tm.h file (depending upon the particulars of your assembler). */ + +#undef TYPE_OPERAND_FMT +#define TYPE_OPERAND_FMT "@%s" + +/* 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. */ + +#ifndef ASM_DECLARE_RESULT +#define ASM_DECLARE_RESULT(FILE, RESULT) +#endif + +/* These macros generate the special .type and .size directives which + are used to set the corresponding fields of the linker symbol table + entries in an ELF object file under SVR4. These macros also output + the starting labels for the relevant functions/objects. */ + +/* Write the extra assembler code needed to declare a function properly. + Some svr4 assemblers need to also have something extra said about the + function's return value. We allow for that here. */ + +#undef ASM_DECLARE_FUNCTION_NAME +#define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \ + do { \ + extern FILE *asm_out_text_file; \ + \ + if (TARGET_GP_OPT) \ + { \ + int align; \ + STREAM = asm_out_text_file; \ + /* Output ALIGN again to the new stream. XXX */ \ + align = floor_log2 (FUNCTION_BOUNDARY / BITS_PER_UNIT); \ + if (align > 0) \ + { \ + if (output_bytecode) \ + BC_OUTPUT_ALIGN (STREAM, align); \ + else \ + ASM_OUTPUT_ALIGN (STREAM, align); \ + } \ + } \ + fprintf (STREAM, "\t%s\t ", TYPE_ASM_OP); \ + assemble_name (STREAM, NAME); \ + putc (',', STREAM); \ + fprintf (STREAM, TYPE_OPERAND_FMT, "function"); \ + putc ('\n', STREAM); \ + ASM_DECLARE_RESULT (STREAM, DECL_RESULT (DECL)); \ + HALF_PIC_DECLARE (NAME); \ + } while (0) + +/* Assemble generic sections. +/* Write the extra assembler code needed to declare an object properly. */ + +#undef ASM_DECLARE_OBJECT_NAME +#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \ + do { \ + fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \ + assemble_name (FILE, NAME); \ + putc (',', FILE); \ + fprintf (FILE, TYPE_OPERAND_FMT, "object"); \ + putc ('\n', FILE); \ + size_directive_output = 0; \ + if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \ + { \ + size_directive_output = 1; \ + fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ + assemble_name (FILE, NAME); \ + fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \ + } \ + ASM_OUTPUT_LABEL(FILE, NAME); \ + } while (0) + +/* Output the size directive for a decl in rest_of_decl_compilation + in the case where we did not do so before the initializer. + Once we find the error_mark_node, we know that the value of + size_directive_output was set + by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */ + +#undef ASM_FINISH_DECLARE_OBJECT +#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ +do { \ + char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ + if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \ + && ! AT_END && TOP_LEVEL \ + && DECL_INITIAL (DECL) == error_mark_node \ + && !size_directive_output) \ + { \ + size_directive_output = 1; \ + fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ + assemble_name (FILE, name); \ + fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \ + } \ + } while (0) + +/* This is how to 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) \ + { \ + char label[256]; \ + static int labelno; \ + labelno++; \ + ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \ + ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \ + fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ + assemble_name (FILE, (FNAME)); \ + fprintf (FILE, ","); \ + assemble_name (FILE, label); \ + fprintf (FILE, "-"); \ + assemble_name (FILE, (FNAME)); \ + putc ('\n', FILE); \ + } \ + } while (0) + +/* Since gas and gld are standard on NetBSD, we don't need these */ +#undef ASM_FINAL_SPEC +#undef STARTFILE_SPEC + diff --git a/gnu/usr.bin/gcc/config/mips/openbsd-le.h b/gnu/usr.bin/gcc/config/mips/openbsd-le.h new file mode 100644 index 00000000000..883e10aef6e --- /dev/null +++ b/gnu/usr.bin/gcc/config/mips/openbsd-le.h @@ -0,0 +1,284 @@ +/* Definitions for MIPS systems running BSD as target machine for GNU compiler. + Copyright (C) 1993, 1995 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. */ + +/* We settle for little endian for now */ + +#define TARGET_ENDIAN_DEFAULT 0 + +/* Look for the include files in the system-defined places. */ + +#ifndef CROSS_COMPILE +#undef GPLUSPLUS_INCLUDE_DIR +#define GPLUSPLUS_INCLUDE_DIR "/usr/include/g++" + +#undef GCC_INCLUDE_DIR +#define GCC_INCLUDE_DIR "/usr/include" + +#undef INCLUDE_DEFAULTS +#define INCLUDE_DEFAULTS \ + { \ + { GPLUSPLUS_INCLUDE_DIR, 1, 1 }, \ + { GCC_INCLUDE_DIR, 0, 0 }, \ + { 0, 0, 0 } \ + } + +/* 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 + +/* Provide a LINK_SPEC appropriate for OpenBSD. Here we provide support + for the special GCC options -static, -assert, and -nostdlib. */ + +#undef LINK_SPEC +#define LINK_SPEC \ + "%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} \ + %{bestGnum} %{shared} %{non_shared} \ + %{call_shared} %{no_archive} %{exact_version} \ + %{!shared: %{!non_shared: %{!call_shared: -non_shared}}} \ + %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.so} \ + %{!nostdlib:%{!r*:%{!e*:-e __start}}} -dc -dp \ + %{static:-Bstatic} %{!static:-Bdynamic} %{assert*}" + +/* We have atexit(3). */ + +#define HAVE_ATEXIT + +/* Implicit library calls should use memcpy, not bcopy, etc. */ + +#define TARGET_MEM_FUNCTIONS + +/* Define mips-specific OpenBSD predefines... */ +#ifndef CPP_PREDEFINES +#define CPP_PREDEFINES "-D__ANSI_COMPAT \ +-DMIPSEL -DR3000 -DSYSTYPE_BSD -D_SYSTYPE_BSD -D__OpenBSD__ -D__NetBSD__ -Dmips \ +-D__NO_LEADING_UNDERSCORES__ -D__GP_SUPPORT__ \ +-Dunix -D_R3000 \ +-Asystem(unix) -Asystem(OpenBSD) -Amachine(mips)" +#endif + +#ifndef CC1_SPEC +#define CC1_SPEC "\ +%{gline:%{!g:%{!g0:%{!g1:%{!g2: -g1}}}}} \ +%{mips1:-mfp32 -mgp32}%{mips2:-mfp32 -mgp32}\ +%{mips3:%{!msingle-float:%{!m4650:-mfp64}} -mgp64} \ +%{mips4:%{!msingle-float:%{!m4650:-mfp64}} -mgp64} \ +%{mfp64:%{msingle-float:%emay not use both -mfp64 and -msingle-float}} \ +%{mfp64:%{m4650:%emay not use both -mfp64 and -m4650}} \ +%{m4650:-mcpu=r4650} \ +%{G*} %{EB:-meb} %{EL:-mel} %{EB:%{EL:%emay not use both -EB and -EL}} \ +%{pic-none: -mno-half-pic} \ +%{pic-lib: -mhalf-pic} \ +%{pic-extern: -mhalf-pic} \ +%{pic-calls: -mhalf-pic} \ +%{save-temps: } \ +%{!mno-abicalls: -mabicalls}" +#endif + +/* Always uses gas. */ +#ifndef ASM_SPEC +#define ASM_SPEC "\ +%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} %{v} \ +%{noasmopt:-O0} \ +%{!noasmopt:%{O:-O2} %{O1:-O2} %{O2:-O2} %{O3:-O3}} \ +%{g} %{g0} %{g1} %{g2} %{g3} \ +%{ggdb:-g} %{ggdb0:-g0} %{ggdb1:-g1} %{ggdb2:-g2} %{ggdb3:-g3} \ +%{gstabs:-g} %{gstabs0:-g0} %{gstabs1:-g1} %{gstabs2:-g2} %{gstabs3:-g3} \ +%{gstabs+:-g} %{gstabs+0:-g0} %{gstabs+1:-g1} %{gstabs+2:-g2} %{gstabs+3:-g3} \ +%{gcoff:-g} %{gcoff0:-g0} %{gcoff1:-g1} %{gcoff2:-g2} %{gcoff3:-g3} \ +%{membedded-pic} %{fPIC:-KPIC}" +#endif + +#ifndef CPP_SPEC +#define CPP_SPEC "\ +%{posix:-D_POSIX_SOURCE} \ +%{mlong64:-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int} \ +%{!mlong64:-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int} \ +%{mips3:-U__mips -D__mips=3 -D__mips64} \ +%{mgp32:-U__mips64} %{mgp64:-D__mips64}" +#endif + +#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}" + +#undef LIB_SPEC +#define LIB_SPEC "%{p:-lprof1} %{pg:-lprof1} -lc crtn.o%s" +#define STARTFILE_SPEC \ + "%{!shared:%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s libprof1.a%s}%{!p:crt1.o%s}}}" + +#ifndef MACHINE_TYPE +#define MACHINE_TYPE "OpenBSD/mips" +#endif + +#define TARGET_DEFAULT MASK_GAS +#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG + +#define LOCAL_LABEL_PREFIX "." + +/* -G is incompatible with -KPIC which is the default, so only allow objects + in the small data section if the user explicitly asks for it. */ +#undef MIPS_DEFAULT_GVALUE +#define MIPS_DEFAULT_GVALUE 0 + +#include "mips/mips.h" + +/* + * Some imports from svr4.h in support of shared libraries. + * Currently, we need the DECLARE_OBJECT_SIZE stuff. + */ + +/* Define the strings used for the special svr4 .type and .size directives. + These strings generally do not vary from one system running svr4 to + another, but if a given system (e.g. m88k running svr) needs to use + different pseudo-op names for these, they may be overridden in the + file which includes this one. */ + +#undef TYPE_ASM_OP +#undef SIZE_ASM_OP +#undef WEAK_ASM_OP +#define TYPE_ASM_OP ".type" +#define SIZE_ASM_OP ".size" +#define WEAK_ASM_OP ".weak" + +/* The following macro defines the format used to output the second + operand of the .type assembler directive. Different svr4 assemblers + expect various different forms for this operand. The one given here + is just a default. You may need to override it in your machine- + specific tm.h file (depending upon the particulars of your assembler). */ + +#undef TYPE_OPERAND_FMT +#define TYPE_OPERAND_FMT "@%s" + +/* 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. */ + +#ifndef ASM_DECLARE_RESULT +#define ASM_DECLARE_RESULT(FILE, RESULT) +#endif + +/* These macros generate the special .type and .size directives which + are used to set the corresponding fields of the linker symbol table + entries in an ELF object file under SVR4. These macros also output + the starting labels for the relevant functions/objects. */ + +/* Write the extra assembler code needed to declare a function properly. + Some svr4 assemblers need to also have something extra said about the + function's return value. We allow for that here. */ + +#undef ASM_DECLARE_FUNCTION_NAME +#define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \ + do { \ + extern FILE *asm_out_text_file; \ + \ + if (TARGET_GP_OPT) \ + { \ + int align; \ + STREAM = asm_out_text_file; \ + /* Output ALIGN again to the new stream. XXX */ \ + align = floor_log2 (FUNCTION_BOUNDARY / BITS_PER_UNIT); \ + if (align > 0) \ + { \ + if (output_bytecode) \ + BC_OUTPUT_ALIGN (STREAM, align); \ + else \ + ASM_OUTPUT_ALIGN (STREAM, align); \ + } \ + } \ + fprintf (STREAM, "\t%s\t ", TYPE_ASM_OP); \ + assemble_name (STREAM, NAME); \ + putc (',', STREAM); \ + fprintf (STREAM, TYPE_OPERAND_FMT, "function"); \ + putc ('\n', STREAM); \ + ASM_DECLARE_RESULT (STREAM, DECL_RESULT (DECL)); \ + HALF_PIC_DECLARE (NAME); \ + } while (0) + +/* Assemble generic sections. +/* Write the extra assembler code needed to declare an object properly. */ + +#undef ASM_DECLARE_OBJECT_NAME +#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \ + do { \ + fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \ + assemble_name (FILE, NAME); \ + putc (',', FILE); \ + fprintf (FILE, TYPE_OPERAND_FMT, "object"); \ + putc ('\n', FILE); \ + size_directive_output = 0; \ + if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \ + { \ + size_directive_output = 1; \ + fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ + assemble_name (FILE, NAME); \ + fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \ + } \ + ASM_OUTPUT_LABEL(FILE, NAME); \ + } while (0) + +/* Output the size directive for a decl in rest_of_decl_compilation + in the case where we did not do so before the initializer. + Once we find the error_mark_node, we know that the value of + size_directive_output was set + by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */ + +#undef ASM_FINISH_DECLARE_OBJECT +#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ +do { \ + char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ + if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \ + && ! AT_END && TOP_LEVEL \ + && DECL_INITIAL (DECL) == error_mark_node \ + && !size_directive_output) \ + { \ + size_directive_output = 1; \ + fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ + assemble_name (FILE, name); \ + fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \ + } \ + } while (0) + +/* This is how to 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) \ + { \ + char label[256]; \ + static int labelno; \ + labelno++; \ + ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \ + ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \ + fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ + assemble_name (FILE, (FNAME)); \ + fprintf (FILE, ","); \ + assemble_name (FILE, label); \ + fprintf (FILE, "-"); \ + assemble_name (FILE, (FNAME)); \ + putc ('\n', FILE); \ + } \ + } while (0) + +/* Since gas and gld are standard on NetBSD, we don't need these */ +#undef ASM_FINAL_SPEC +#undef STARTFILE_SPEC + diff --git a/gnu/usr.bin/gcc/config/mips/openbsd.h b/gnu/usr.bin/gcc/config/mips/openbsd.h index d4e9f340423..883e10aef6e 100644 --- a/gnu/usr.bin/gcc/config/mips/openbsd.h +++ b/gnu/usr.bin/gcc/config/mips/openbsd.h @@ -1,4 +1,4 @@ -/* Definitions for DECstation running BSD as target machine for GNU compiler. +/* Definitions for MIPS systems running BSD as target machine for GNU compiler. Copyright (C) 1993, 1995 Free Software Foundation, Inc. This file is part of GNU CC. @@ -18,7 +18,9 @@ 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 DECSTATION +/* We settle for little endian for now */ + +#define TARGET_ENDIAN_DEFAULT 0 /* Look for the include files in the system-defined places. */ @@ -44,13 +46,18 @@ Boston, MA 02111-1307, USA. */ #define STANDARD_STARTFILE_PREFIX "/usr/lib/" #endif -/* Provide a LINK_SPEC appropriate for OpentBSD. Here we provide support +/* Provide a LINK_SPEC appropriate for OpenBSD. Here we provide support for the special GCC options -static, -assert, and -nostdlib. */ #undef LINK_SPEC #define LINK_SPEC \ "%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} \ - %{!nostdlib:%{!r*:%{!e*:-e __start}}} -dc -dp %{static:-Bstatic} %{assert*}" + %{bestGnum} %{shared} %{non_shared} \ + %{call_shared} %{no_archive} %{exact_version} \ + %{!shared: %{!non_shared: %{!call_shared: -non_shared}}} \ + %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.so} \ + %{!nostdlib:%{!r*:%{!e*:-e __start}}} -dc -dp \ + %{static:-Bstatic} %{!static:-Bdynamic} %{assert*}" /* We have atexit(3). */ @@ -60,7 +67,7 @@ Boston, MA 02111-1307, USA. */ #define TARGET_MEM_FUNCTIONS -/* Define mips-specific openbsd predefines... */ +/* Define mips-specific OpenBSD predefines... */ #ifndef CPP_PREDEFINES #define CPP_PREDEFINES "-D__ANSI_COMPAT \ -DMIPSEL -DR3000 -DSYSTYPE_BSD -D_SYSTYPE_BSD -D__OpenBSD__ -D__NetBSD__ -Dmips \ @@ -69,6 +76,24 @@ Boston, MA 02111-1307, USA. */ -Asystem(unix) -Asystem(OpenBSD) -Amachine(mips)" #endif +#ifndef CC1_SPEC +#define CC1_SPEC "\ +%{gline:%{!g:%{!g0:%{!g1:%{!g2: -g1}}}}} \ +%{mips1:-mfp32 -mgp32}%{mips2:-mfp32 -mgp32}\ +%{mips3:%{!msingle-float:%{!m4650:-mfp64}} -mgp64} \ +%{mips4:%{!msingle-float:%{!m4650:-mfp64}} -mgp64} \ +%{mfp64:%{msingle-float:%emay not use both -mfp64 and -msingle-float}} \ +%{mfp64:%{m4650:%emay not use both -mfp64 and -m4650}} \ +%{m4650:-mcpu=r4650} \ +%{G*} %{EB:-meb} %{EL:-mel} %{EB:%{EL:%emay not use both -EB and -EL}} \ +%{pic-none: -mno-half-pic} \ +%{pic-lib: -mhalf-pic} \ +%{pic-extern: -mhalf-pic} \ +%{pic-calls: -mhalf-pic} \ +%{save-temps: } \ +%{!mno-abicalls: -mabicalls}" +#endif + /* Always uses gas. */ #ifndef ASM_SPEC #define ASM_SPEC "\ @@ -79,7 +104,8 @@ Boston, MA 02111-1307, USA. */ %{ggdb:-g} %{ggdb0:-g0} %{ggdb1:-g1} %{ggdb2:-g2} %{ggdb3:-g3} \ %{gstabs:-g} %{gstabs0:-g0} %{gstabs1:-g1} %{gstabs2:-g2} %{gstabs3:-g3} \ %{gstabs+:-g} %{gstabs+0:-g0} %{gstabs+1:-g1} %{gstabs+2:-g2} %{gstabs+3:-g3} \ -%{gcoff:-g} %{gcoff0:-g0} %{gcoff1:-g1} %{gcoff2:-g2} %{gcoff3:-g3}" +%{gcoff:-g} %{gcoff0:-g0} %{gcoff1:-g1} %{gcoff2:-g2} %{gcoff3:-g3} \ +%{membedded-pic} %{fPIC:-KPIC}" #endif #ifndef CPP_SPEC @@ -92,10 +118,14 @@ Boston, MA 02111-1307, USA. */ #endif #define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}" -#define STARTFILE_SPEC "" + +#undef LIB_SPEC +#define LIB_SPEC "%{p:-lprof1} %{pg:-lprof1} -lc crtn.o%s" +#define STARTFILE_SPEC \ + "%{!shared:%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s libprof1.a%s}%{!p:crt1.o%s}}}" #ifndef MACHINE_TYPE -#define MACHINE_TYPE "OpenBSD/pmax" +#define MACHINE_TYPE "OpenBSD/mips" #endif #define TARGET_DEFAULT MASK_GAS @@ -103,6 +133,11 @@ Boston, MA 02111-1307, USA. */ #define LOCAL_LABEL_PREFIX "." +/* -G is incompatible with -KPIC which is the default, so only allow objects + in the small data section if the user explicitly asks for it. */ +#undef MIPS_DEFAULT_GVALUE +#define MIPS_DEFAULT_GVALUE 0 + #include "mips/mips.h" /* @@ -150,16 +185,34 @@ Boston, MA 02111-1307, USA. */ function's return value. We allow for that here. */ #undef ASM_DECLARE_FUNCTION_NAME -#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ +#define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \ do { \ - fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \ - assemble_name (FILE, NAME); \ - putc (',', FILE); \ - fprintf (FILE, TYPE_OPERAND_FMT, "function"); \ - putc ('\n', FILE); \ - ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \ + extern FILE *asm_out_text_file; \ + \ + if (TARGET_GP_OPT) \ + { \ + int align; \ + STREAM = asm_out_text_file; \ + /* Output ALIGN again to the new stream. XXX */ \ + align = floor_log2 (FUNCTION_BOUNDARY / BITS_PER_UNIT); \ + if (align > 0) \ + { \ + if (output_bytecode) \ + BC_OUTPUT_ALIGN (STREAM, align); \ + else \ + ASM_OUTPUT_ALIGN (STREAM, align); \ + } \ + } \ + fprintf (STREAM, "\t%s\t ", TYPE_ASM_OP); \ + assemble_name (STREAM, NAME); \ + putc (',', STREAM); \ + fprintf (STREAM, TYPE_OPERAND_FMT, "function"); \ + putc ('\n', STREAM); \ + ASM_DECLARE_RESULT (STREAM, DECL_RESULT (DECL)); \ + HALF_PIC_DECLARE (NAME); \ } while (0) +/* Assemble generic sections. /* Write the extra assembler code needed to declare an object properly. */ #undef ASM_DECLARE_OBJECT_NAME @@ -225,7 +278,7 @@ do { \ } \ } while (0) -/* Since gas and gld are standard on OpenBSD, we don't need these */ +/* Since gas and gld are standard on NetBSD, we don't need these */ #undef ASM_FINAL_SPEC #undef STARTFILE_SPEC |