summaryrefslogtreecommitdiff
path: root/gcc/config/mips/netbsd.h
diff options
context:
space:
mode:
authorthorpej <thorpej@138bc75d-0d04-0410-961f-82ee72b054a4>2002-01-22 04:23:07 +0000
committerthorpej <thorpej@138bc75d-0d04-0410-961f-82ee72b054a4>2002-01-22 04:23:07 +0000
commit4ace673e3b9d75d56f280c3b1a2bd90e09a64da4 (patch)
treefb881f08fa95811a9605ea29489c77d5ff5aa601 /gcc/config/mips/netbsd.h
parent9f843b44bac3396565c52f67f877d1025483cc19 (diff)
downloadgcc-4ace673e3b9d75d56f280c3b1a2bd90e09a64da4.tar.gz
* config/netbsd.h (TARGET_HAS_F_SETLKW): define.
Split a.out-specific bits into... * config/netbsd-aout.h: ...this. * config/netbsd-elf.h: New file. * config/alpha/netbsd-elf.h: Remove. * config/alpha/netbsd.h: Rewrite for a NetBSD/alpha ELF target. * config/i386/netbsd-elf.h (LIB_SPEC): Remove. (STARTFILE_SPEC): Remove redundant definition. (ENDFILE_SPEC): Likewise. (LINK_SPEC): Likewise. (CPP_SPEC): Likewise. (ASM_SPEC): Likewise. (LIB_SPEC): Likewise. (SWITCH_TAKES_ARG): Likewise. (TARGET_MEM_FUNCTIONS): Likewise. (CPP_PREDEFINES): Redefine. (ASM_FINAL_SPEC): Remove redefinition. (ASM_COMMENT_START): Redefine. (FUNCTION_PROFILER): Define. (TARGET_VERSION): Redefine. Comment and formatting cleanup. * config/i386/netbsd.h: Include <netbsd-aout.h>. * config/m68k/netbsd.h: Include <netbsd-aout.h>. * config/mips/netbsd.h: Rewrite for NetBSD/mips ELF target, big- or little-endian. * config/ns32k/netbsd.h: Include <netbsd-aout.h>. * config.gcc (*-*-netbsd*): Add definitions common to all NetBSD configs. (alpha*-*-netbsd*): Remove redundant xm_defines, gas, and gnu_ld definitions. Add netbsd-elf.h to and remove alpha/netbsd-elf.h from tm_file. Remove alpha/t-crtfm from tmake_file, and don't lose previous tmake_file contents. (arm*-*-netbsd*): Add netbsd-aout.h to tm_file. (i[34567]86-*-netbsdelf*): Remove redundant xm_defines, gas, and gnu_ld definitions. Add netbsd-elf.h to tm_file. (mips-dec-netbsd*): Remove as alias for mipsel-*-netbsd*. (mipsel-*-netbsd*): Rename this to... (mips*-*-netbsd*): ...this. Add elfos.h to tm_file. Add mips/little.h to tm_file for mips*el-*. (powerpc-*-netbsd*): Remove redundant xm_defines definition. (sparc-*-netbsd*): Add netbsd-aout.h to tm_file. (vax-*-netbsd*): Add netbsd-aout.h to tm_file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@49064 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/mips/netbsd.h')
-rw-r--r--gcc/config/mips/netbsd.h348
1 files changed, 157 insertions, 191 deletions
diff --git a/gcc/config/mips/netbsd.h b/gcc/config/mips/netbsd.h
index 09229f149b3..95d3901df94 100644
--- a/gcc/config/mips/netbsd.h
+++ b/gcc/config/mips/netbsd.h
@@ -1,5 +1,6 @@
-/* Definitions for DECstation running BSD as target machine for GNU compiler.
- Copyright (C) 1993, 1995, 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
+/* Definitions of target machine for GNU compiler, for MIPS NetBSD systems.
+ Copyright (C) 1993, 1995, 1996, 1997, 1999, 2000, 2001, 2002
+ Free Software Foundation, Inc.
This file is part of GNU CC.
@@ -18,212 +19,177 @@ 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
-/* Look for the include files in the system-defined places. */
+/* Define default target values. */
-#ifndef CROSS_COMPILE
-#undef GPLUSPLUS_INCLUDE_DIR
-#define GPLUSPLUS_INCLUDE_DIR "/usr/include/g++"
+#ifndef TARGET_ENDIAN_DEFAULT
+#define TARGET_ENDIAN_DEFAULT MASK_BIG_ENDIAN
+#endif
-#undef GCC_INCLUDE_DIR
-#define GCC_INCLUDE_DIR "/usr/include"
+#ifndef MACHINE_TYPE
+#if TARGET_ENDIAN_DEFAULT != 0
+#define MACHINE_TYPE "NetBSD/mipseb ELF"
+#else
+#define MACHINE_TYPE "NetBSD/mipsel ELF"
+#endif
+#endif
-#undef INCLUDE_DEFAULTS
-#define INCLUDE_DEFAULTS \
- { \
- { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 }, \
- { GCC_INCLUDE_DIR, "GCC", 0, 0 }, \
- { 0, 0, 0, 0 } \
- }
+#define TARGET_DEFAULT (MASK_GAS|MASK_ABICALLS)
-/* Under NetBSD, 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
+/* XXX Don't use DWARF-2 debugging info, for now. */
+#undef DBX_DEBUGGING_INFO
+#define DBX_DEBUGGING_INFO
+#undef PREFERRED_DEBUGGING_TYPE
+#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-/* Provide a LINK_SPEC appropriate for NetBSD. 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} \
- %{!nostartfiles:%{!r*:%{!e*:-e __start}}} -dc -dp %{static:-Bstatic} %{assert*}"
+/* Include the generic MIPS ELF configuration. */
+#include <mips/elf.h>
+
+/* Now clean up after it. */
+#undef OBJECT_FORMAT_COFF
+#undef MD_EXEC_PREFIX
+#undef MD_STARTFILE_PREFIX
+#undef US_SOFTWARE_GOFAST
+#undef INIT_SUBTARGET_OPTABS
+#define INIT_SUBTARGET_OPTABS
+
-/* Implicit library calls should use memcpy, not bcopy, etc. */
+/* Get generic NetBSD definitions. */
+#include <netbsd.h>
-#define TARGET_MEM_FUNCTIONS
-/* Define mips-specific netbsd predefines... */
-#ifndef CPP_PREDEFINES
-#define CPP_PREDEFINES "-D__ANSI_COMPAT \
--DMIPSEL -DR3000 -DSYSTYPE_BSD -D_SYSTYPE_BSD -D__NetBSD__ -Dmips \
--D__NO_LEADING_UNDERSCORES__ -D__GP_SUPPORT__ \
--Dunix -D_R3000 \
--Asystem=unix -Asystem=NetBSD -Amachine=mips"
+/* Get generic NetBSD ELF definitions. */
+#include <netbsd-elf.h>
+
+
+/* Provide CPP predefines appropriate for NetBSD. We default to
+ MIPS-I. */
+
+#undef CPP_PREDEFINES
+#if TARGET_ENDIAN_DEFAULT != 0
+#define CPP_PREDEFINES \
+ "-D__NetBSD__ -D__ELF__ -D__mips__ -D__mips=1 -D__MIPSEB__ \
+ -D__NO_LEADING_UNDERSCORES__ -D__GP_SUPPORT__ \
+ -Asystem=unix -Asystem=NetBSD -Amachine=mips"
+#else
+#define CPP_PREDEFINES \
+ "-D__NetBSD__ -D__ELF__ -D__mips__ -D__mips=1 -D__MIPSEL__ \
+ -D__NO_LEADING_UNDERSCORES__ -D__GP_SUPPORT__ \
+ -Asystem=unix -Asystem=NetBSD -Amachine=mips"
#endif
-#ifndef SUBTARGET_CPP_SPEC
+
+/* Provide a CPP_SPEC appropriate for NetBSD. This is a simplified
+ CPP_SPEC from <mips/mips.h>. We use the SUBTARGET_CPP_SPEC to
+ deal with NetBSD-specific CPP options. */
+
+#undef CPP_SPEC
+#define CPP_SPEC \
+ "%(subtarget_cpp_size_spec) \
+ %{mips3:-U__mips -D__mips=3 -D__mips64} \
+ %{mips4:-U__mips -D__mips=4 -D__mips64} \
+ %{mips32:-U__mips -D__mips=32} \
+ %{mips64:-U__mips -D__mips=64 -D__mips64} \
+ %{mgp32:-U__mips64} %{mgp64:-D__mips64} \
+ %{mfp32:-D__mips_fpr=32} %{mfp64:-D__mips_fpr=64} \
+ %{!mfp32: \
+ %{!mfp64: \
+ %{mgp32:-D__mips_fpr=32} \
+ %{!mgp32: %(cpp_fpr_spec)}}} \
+ %{msingle-float: \
+ %{!msoft-float:-D__mips_single_float}} \
+ %{m4650: \
+ %{!msoft-float:-D__mips_single_float}} \
+ %{msoft-float:-D__mips_soft_float} \
+ %{mabi=eabi:-D__mips_eabi} \
+ %{mips16:%{!mno-mips16:-D__mips16}} \
+ %{EB:-U__MIPSEL__ -D__MIPSEB__} \
+ %{EL:-U__MIPSEB__ -D__MIPSEL__} \
+ %(subtarget_cpp_spec) "
+
+
+/* Provide a SUBTARGET_CPP_SIZE_SPEC appropriate for NetBSD. In
+ addition to the normal work done by this spec, we also define
+ __LONG64 or not (so that <machine/ansi.h> can tell). */
+
+#undef SUBTARGET_CPP_SIZE_SPEC
+#define SUBTARGET_CPP_SIZE_SPEC \
+ "%{mlong64: \
+ %{!mips1: \
+ %{!mips2: \
+ %{!mips32:-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int -D__LONG64}}}} \
+ %{!mlong64:-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int -U__LONG64}"
+
+
+/* Provide a SUBTARGET_CPP_SPEC appropriate for NetBSD. Currently,
+ we just deal with the GCC option '-posix'. */
+
+#undef SUBTARGET_CPP_SPEC
#define SUBTARGET_CPP_SPEC "%{posix:-D_POSIX_SOURCE}"
-#endif
-#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
-#define STARTFILE_SPEC ""
-#ifndef MACHINE_TYPE
-#define MACHINE_TYPE "NetBSD/pmax"
-#endif
+/* Provide a LINK_SPEC appropriate for a NetBSD/mips target.
+ This is a copy of LINK_SPEC from <netbsd-elf.h> tweaked for
+ the MIPS target. */
-#define TARGET_DEFAULT MASK_GAS
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
+#undef LINK_SPEC
+#define LINK_SPEC \
+ "%{assert*} %{R*} %{rpath*} \
+ %{EL:-m elf32lmip} \
+ %{EB:-m elf32bmip} \
+ %(endian_spec) \
+ %{G*} %{mips1} %{mips2} %{mips3} %{mips4} %{mips32} %{mips64} \
+ %{bestGnum} %{call_shared} %{no_archive} %{exact_version} \
+ %{shared:-shared} \
+ %{!shared: \
+ -dc -dp \
+ %{!nostdlib: \
+ %{!r*: \
+ %{!e*:-e __start}}} \
+ %{!static: \
+ %{rdynamic:-export-dynamic} \
+ %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}} \
+ %{static:-static}}"
+
+
+#undef SUBTARGET_ASM_SPEC
+#define SUBTARGET_ASM_SPEC \
+ "%{fpic:-KPIC} %{fPIC:-KPIC}"
+
+
+/* -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
+
+
+/* This defines which switch letters take arguments. -G is a MIPS
+ special. */
+
+#undef SWITCH_TAKES_ARG
+#define SWITCH_TAKES_ARG(CHAR) \
+ (DEFAULT_SWITCH_TAKES_ARG (CHAR) \
+ || (CHAR) == 'R' \
+ || (CHAR) == 'G')
-#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 "\t.type\t"
-#define SIZE_ASM_OP "\t.size\t"
-#define WEAK_ASM_OP "\t.weak\t"
-
-/* 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(FILE, NAME, DECL) \
- do { \
- fprintf (FILE, "%s", 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)); \
- } while (0)
-
-/* 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, "%s", 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, "%s", SIZE_ASM_OP); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, ","); \
- fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, \
- int_size_in_bytes (TREE_TYPE (DECL))); \
- fprintf (FILE, "\n"); \
- } \
- 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 { \
- const 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, "%s", SIZE_ASM_OP); \
- assemble_name (FILE, name); \
- fprintf (FILE, ","); \
- fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, \
- int_size_in_bytes (TREE_TYPE (DECL))); \
- fprintf (FILE, "\n"); \
- } \
- } 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, "%s", SIZE_ASM_OP); \
- assemble_name (FILE, (FNAME)); \
- fprintf (FILE, ","); \
- assemble_name (FILE, label); \
- fprintf (FILE, "-"); \
- assemble_name (FILE, (FNAME)); \
- putc ('\n', FILE); \
- } \
- } while (0)
-
-/* Switch into a generic section. */
-#undef TARGET_ASM_NAMED_SECTION
-#define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
-
-/* Not having TARGET_GAS here seems a mistake. If we actually need to
- be prepared for file switching, then we need a custom
- TARGET_ASM_NAMED_SECTION too. */
-
-#undef TEXT_SECTION
-#define TEXT_SECTION() \
-do { \
- if (TARGET_FILE_SWITCHING) \
- abort (); \
- fputs (TEXT_SECTION_ASM_OP, asm_out_file); \
- fputc ('\n', asm_out_file); \
-} while (0)
-
-/* Since gas and gld are standard on NetBSD, we don't need these */
#undef ASM_FINAL_SPEC
-#undef STARTFILE_SPEC
+#undef SET_ASM_OP
+
+
+/* Make gcc agree with <machine/ansi.h> */
+
+#undef WCHAR_TYPE
+#define WCHAR_TYPE "int"
+
+#undef WCHAR_UNSIGNED
+#define WCHAR_UNSIGNED 0
+
+#undef WCHAR_TYPE_SIZE
+#define WCHAR_TYPE_SIZE 32
+
+#undef WINT_TYPE
+#define WINT_TYPE "int"