1169689Skan/* Definitions for MIPS running Linux-based GNU systems with ELF format. 2169689Skan Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 3169689Skan Free Software Foundation, Inc. 4169689Skan 5169689SkanThis file is part of GCC. 6169689Skan 7169689SkanGCC is free software; you can redistribute it and/or modify 8169689Skanit under the terms of the GNU General Public License as published by 9169689Skanthe Free Software Foundation; either version 2, or (at your option) 10169689Skanany later version. 11169689Skan 12169689SkanGCC is distributed in the hope that it will be useful, 13169689Skanbut WITHOUT ANY WARRANTY; without even the implied warranty of 14169689SkanMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15169689SkanGNU General Public License for more details. 16169689Skan 17169689SkanYou should have received a copy of the GNU General Public License 18169689Skanalong with GCC; see the file COPYING. If not, write to 19169689Skanthe Free Software Foundation, 51 Franklin Street, Fifth Floor, 20169689SkanBoston, MA 02110-1301, USA. */ 21169689Skan 22169689Skan#undef WCHAR_TYPE 23169689Skan#define WCHAR_TYPE "int" 24169689Skan 25169689Skan#undef WCHAR_TYPE_SIZE 26169689Skan#define WCHAR_TYPE_SIZE 32 27169689Skan 28169689Skan/* If defined, a C expression whose value is a string containing the 29169689Skan assembler operation to identify the following data as 30169689Skan uninitialized global data. If not defined, and neither 31169689Skan `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined, 32169689Skan uninitialized global data will be output in the data section if 33169689Skan `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be 34169689Skan used. */ 35169689Skan#define BSS_SECTION_ASM_OP "\t.section\t.bss" 36169689Skan 37169689Skan#define ASM_OUTPUT_ALIGNED_BSS mips_output_aligned_bss 38169689Skan 39169689Skan#undef ASM_DECLARE_OBJECT_NAME 40169689Skan#define ASM_DECLARE_OBJECT_NAME mips_declare_object_name 41169689Skan 42169689Skan#undef TARGET_VERSION 43169689Skan#if TARGET_ENDIAN_DEFAULT == 0 44169689Skan#define TARGET_VERSION fprintf (stderr, " (MIPSel GNU/Linux with ELF)"); 45169689Skan#else 46169689Skan#define TARGET_VERSION fprintf (stderr, " (MIPS GNU/Linux with ELF)"); 47169689Skan#endif 48169689Skan 49169689Skan#undef MD_EXEC_PREFIX 50169689Skan#undef MD_STARTFILE_PREFIX 51169689Skan 52169689Skan/* If we don't set MASK_ABICALLS, we can't default to PIC. */ 53169689Skan#undef TARGET_DEFAULT 54169689Skan#define TARGET_DEFAULT MASK_ABICALLS 55169689Skan 56169689Skan#define TARGET_OS_CPP_BUILTINS() \ 57169689Skan do { \ 58169689Skan LINUX_TARGET_OS_CPP_BUILTINS(); \ 59169689Skan /* The GNU C++ standard library requires this. */ \ 60169689Skan if (c_dialect_cxx ()) \ 61169689Skan builtin_define ("_GNU_SOURCE"); \ 62169689Skan \ 63169689Skan if (mips_abi == ABI_N32) \ 64169689Skan { \ 65169689Skan builtin_define ("_ABIN32=2"); \ 66169689Skan builtin_define ("_MIPS_SIM=_ABIN32"); \ 67169689Skan builtin_define ("_MIPS_SZLONG=32"); \ 68169689Skan builtin_define ("_MIPS_SZPTR=32"); \ 69169689Skan } \ 70169689Skan else if (mips_abi == ABI_64) \ 71169689Skan { \ 72169689Skan builtin_define ("_ABI64=3"); \ 73169689Skan builtin_define ("_MIPS_SIM=_ABI64"); \ 74169689Skan builtin_define ("_MIPS_SZLONG=64"); \ 75169689Skan builtin_define ("_MIPS_SZPTR=64"); \ 76169689Skan } \ 77169689Skan else \ 78169689Skan { \ 79169689Skan builtin_define ("_ABIO32=1"); \ 80169689Skan builtin_define ("_MIPS_SIM=_ABIO32"); \ 81169689Skan builtin_define ("_MIPS_SZLONG=32"); \ 82169689Skan builtin_define ("_MIPS_SZPTR=32"); \ 83169689Skan } \ 84169689Skan if (TARGET_FLOAT64) \ 85169689Skan builtin_define ("_MIPS_FPSET=32"); \ 86169689Skan else \ 87169689Skan builtin_define ("_MIPS_FPSET=16"); \ 88169689Skan \ 89169689Skan builtin_define ("_MIPS_SZINT=32"); \ 90169689Skan } while (0) 91169689Skan 92169689Skan#undef SUBTARGET_CPP_SPEC 93169689Skan#define SUBTARGET_CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}" 94169689Skan 95169689Skan/* A standard GNU/Linux mapping. On most targets, it is included in 96169689Skan CC1_SPEC itself by config/linux.h, but mips.h overrides CC1_SPEC 97169689Skan and provides this hook instead. */ 98169689Skan#undef SUBTARGET_CC1_SPEC 99169689Skan#define SUBTARGET_CC1_SPEC "%{profile:-p}" 100169689Skan 101169689Skan/* From iris5.h */ 102169689Skan/* -G is incompatible with -KPIC which is the default, so only allow objects 103169689Skan in the small data section if the user explicitly asks for it. */ 104169689Skan#undef MIPS_DEFAULT_GVALUE 105169689Skan#define MIPS_DEFAULT_GVALUE 0 106169689Skan 107169689Skan#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1" 108169689Skan 109169689Skan/* Borrowed from sparc/linux.h */ 110169689Skan#undef LINK_SPEC 111169689Skan#define LINK_SPEC \ 112169689Skan "%(endian_spec) \ 113169689Skan %{shared:-shared} \ 114169689Skan %{!shared: \ 115169689Skan %{!ibcs: \ 116169689Skan %{!static: \ 117169689Skan %{rdynamic:-export-dynamic} \ 118169689Skan %{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER "}} \ 119169689Skan %{static:-static}}}" 120169689Skan 121169689Skan#undef SUBTARGET_ASM_SPEC 122169689Skan#define SUBTARGET_ASM_SPEC "%{mabi=64: -64} %{!mno-abicalls:-KPIC}" 123169689Skan 124169689Skan/* The MIPS assembler has different syntax for .set. We set it to 125169689Skan .dummy to trap any errors. */ 126169689Skan#undef SET_ASM_OP 127169689Skan#define SET_ASM_OP "\t.dummy\t" 128169689Skan 129169689Skan#undef ASM_OUTPUT_DEF 130169689Skan#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \ 131169689Skan do { \ 132169689Skan fputc ( '\t', FILE); \ 133169689Skan assemble_name (FILE, LABEL1); \ 134169689Skan fputs ( " = ", FILE); \ 135169689Skan assemble_name (FILE, LABEL2); \ 136169689Skan fputc ( '\n', FILE); \ 137169689Skan } while (0) 138169689Skan 139169689Skan#undef ASM_DECLARE_FUNCTION_NAME 140169689Skan#define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \ 141169689Skan do { \ 142169689Skan if (!flag_inhibit_size_directive) \ 143169689Skan { \ 144169689Skan fputs ("\t.ent\t", STREAM); \ 145169689Skan assemble_name (STREAM, NAME); \ 146169689Skan putc ('\n', STREAM); \ 147169689Skan } \ 148169689Skan ASM_OUTPUT_TYPE_DIRECTIVE (STREAM, NAME, "function"); \ 149169689Skan assemble_name (STREAM, NAME); \ 150169689Skan fputs (":\n", STREAM); \ 151169689Skan } while (0) 152169689Skan 153169689Skan#undef ASM_DECLARE_FUNCTION_SIZE 154169689Skan#define ASM_DECLARE_FUNCTION_SIZE(STREAM, NAME, DECL) \ 155169689Skan do { \ 156169689Skan if (!flag_inhibit_size_directive) \ 157169689Skan { \ 158169689Skan fputs ("\t.end\t", STREAM); \ 159169689Skan assemble_name (STREAM, NAME); \ 160169689Skan putc ('\n', STREAM); \ 161169689Skan } \ 162169689Skan } while (0) 163169689Skan 164169689Skan/* Tell function_prologue in mips.c that we have already output the .ent/.end 165169689Skan pseudo-ops. */ 166169689Skan#undef FUNCTION_NAME_ALREADY_DECLARED 167169689Skan#define FUNCTION_NAME_ALREADY_DECLARED 1 168169689Skan 169169689Skan/* The glibc _mcount stub will save $v0 for us. Don't mess with saving 170169689Skan it, since ASM_OUTPUT_REG_PUSH/ASM_OUTPUT_REG_POP do not work in the 171169689Skan presence of $gp-relative calls. */ 172169689Skan#undef ASM_OUTPUT_REG_PUSH 173169689Skan#undef ASM_OUTPUT_REG_POP 174169689Skan 175169689Skan#undef LIB_SPEC 176169689Skan#define LIB_SPEC "\ 177169689Skan%{shared: -lc} \ 178169689Skan%{!shared: %{pthread:-lpthread} \ 179169689Skan %{profile:-lc_p} %{!profile: -lc}}" 180169689Skan 181169689Skan#define MD_UNWIND_SUPPORT "config/mips/linux-unwind.h" 182