1 /* Configuration for a Mips ABI32 OpenBSD target. 2 Copyright (C) 1999 Free Software Foundation, Inc. 3 4 This file is part of GNU CC. 5 6 GNU CC is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 2, or (at your option) 9 any later version. 10 11 GNU CC is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with GNU CC; see the file COPYING. If not, write to 18 the Free Software Foundation, 59 Temple Place - Suite 330, 19 Boston, MA 02111-1307, USA. */ 20 21 /* Definitions needed for OpenBSD, to avoid picking mips 'defaults'. */ 22 23 /* GAS must know this. */ 24 #define SUBTARGET_ASM_SPEC "%{fPIC|fPIE:-KPIC} %|" 25 26 /* CPP specific OpenBSD specs. */ 27 #define SUBTARGET_CPP_SPEC OBSD_CPP_SPEC 28 29 /* Needed for ELF (inspired by netbsd-elf). */ 30 #undef PREFERRED_DEBUGGING_TYPE 31 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG 32 #define LOCAL_LABEL_PREFIX "." 33 34 #define ASM_FINAL_SPEC "" 35 #include <mips/mips.h> 36 37 #undef MDEBUG_ASM_SPEC 38 #define MDEBUG_ASM_SPEC "" 39 40 #include <mips/elf.h> 41 #undef STARTFILE_SPEC 42 #define STARTFILE_SPEC "\ 43 %{!shared: %{pg:gcrt0%O%s} %{!pg:%{p:gcrt0%O%s} %{!p:crt0%O%s}} \ 44 crtbegin%O%s} %{shared:crtbeginS%O%s}" 45 #undef ENDFILE_SPEC 46 #define ENDFILE_SPEC "%{!shared:crtend%O%s} %{shared:crtendS%O%s}" 47 #undef LIB_SPEC 48 #define LIB_SPEC OBSD_LIB_SPEC 49 50 /* Get generic OpenBSD definitions. */ 51 #define OBSD_HAS_DECLARE_FUNCTION_NAME 52 #define OBSD_HAS_DECLARE_OBJECT 53 #define OBSD_HAS_CORRECT_SPECS 54 #include <openbsd.h> 55 56 #if defined(HAVE_LD_EH_FRAME_HDR) 57 #define LINK_EH_SPEC "%{!static:--eh-frame-hdr} " 58 #endif 59 60 /* mips assembler uses .set for arcane purposes. __attribute__((alias)) 61 and friends won't work until we get recent binutils with .weakext 62 support. */ 63 #undef SET_ASM_OP 64 65 #undef TARGET_OS_CPP_BUILTINS 66 #define TARGET_OS_CPP_BUILTINS() \ 67 do { \ 68 OPENBSD_OS_CPP_BUILTINS_ELF(); \ 69 builtin_define ("__NO_LEADING_UNDERSCORES__"); \ 70 builtin_define ("__GP_SUPPORT__"); \ 71 builtin_assert ("machine=mips"); \ 72 if (TARGET_LONG64) \ 73 builtin_define ("__LONG64"); \ 74 if (TARGET_64BIT) \ 75 OPENBSD_OS_CPP_BUILTINS_LP64(); \ 76 if (TARGET_ABICALLS) \ 77 builtin_define ("__ABICALLS__"); \ 78 if (mips_abi == ABI_EABI) \ 79 builtin_define ("__mips_eabi"); \ 80 else if (mips_abi == ABI_N32) \ 81 builtin_define ("__mips_n32"); \ 82 else if (mips_abi == ABI_64) \ 83 builtin_define ("__mips_n64"); \ 84 else if (mips_abi == ABI_O64) \ 85 builtin_define ("__mips_o64"); \ 86 /* Needed to make libgcc to build properly */ \ 87 if (mips_abi == ABI_N32) \ 88 { \ 89 builtin_define ("_ABIN32=2"); \ 90 builtin_define ("_MIPS_SIM=_ABIN32"); \ 91 builtin_define ("_MIPS_SZLONG=32"); \ 92 builtin_define ("_MIPS_SZPTR=32"); \ 93 } \ 94 else if (mips_abi == ABI_64) \ 95 { \ 96 builtin_define ("_ABI64=3"); \ 97 builtin_define ("_MIPS_SIM=_ABI64"); \ 98 builtin_define ("_MIPS_SZLONG=64"); \ 99 builtin_define ("_MIPS_SZPTR=64"); \ 100 } \ 101 else \ 102 { \ 103 builtin_define ("_MIPS_SIM=_MIPS_SIM_ABI32"); \ 104 builtin_define ("_MIPS_SZLONG=32"); \ 105 builtin_define ("_MIPS_SZPTR=32"); \ 106 } \ 107 } while (0) 108 109 110 /* Layout of source language data types. */ 111 #undef INTMAX_TYPE 112 #define INTMAX_TYPE "long long int" 113 114 #undef UINTMAX_TYPE 115 #define UINTMAX_TYPE "long long unsigned int" 116 117 #undef WCHAR_TYPE 118 #define WCHAR_TYPE "int" 119 120 #undef WCHAR_TYPE_SIZE 121 #define WCHAR_TYPE_SIZE 32 122 123 /* Controlling the compilation driver. */ 124 125 /* LINK_SPEC appropriate for OpenBSD: support for GCC options 126 -static, -assert, and -nostdlib. Dynamic loader control. */ 127 #undef LINK_SPEC 128 #define LINK_SPEC \ 129 "%(endian_spec) \ 130 %{G*} %{mips1} %{mips2} %{mips3} %{mips4} %{mips32} %{mips64} \ 131 %{bestGnum} %{shared} %{non_shared} \ 132 %{call_shared} %{no_archive} %{exact_version} \ 133 %{!shared: %{!non_shared: %{!call_shared: -non_shared}}} \ 134 %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.so} \ 135 %{!nostdlib:%{!r*:%{!e*:-e __start}}} -dc -dp \ 136 %{static:-Bstatic} %{!static:-Bdynamic} %{assert*}" 137 138 /* -G is incompatible with -KPIC which is the default, so only allow objects 139 in the small data section if the user explicitly asks for it. */ 140 #undef MIPS_DEFAULT_GVALUE 141 #define MIPS_DEFAULT_GVALUE 0 142