1*404b540aSrobert /* Definitions for MIPS running Linux-based GNU systems with ELF format. 2*404b540aSrobert Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 3*404b540aSrobert Free Software Foundation, Inc. 4*404b540aSrobert 5*404b540aSrobert This file is part of GCC. 6*404b540aSrobert 7*404b540aSrobert GCC is free software; you can redistribute it and/or modify 8*404b540aSrobert it under the terms of the GNU General Public License as published by 9*404b540aSrobert the Free Software Foundation; either version 2, or (at your option) 10*404b540aSrobert any later version. 11*404b540aSrobert 12*404b540aSrobert GCC is distributed in the hope that it will be useful, 13*404b540aSrobert but WITHOUT ANY WARRANTY; without even the implied warranty of 14*404b540aSrobert MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15*404b540aSrobert GNU General Public License for more details. 16*404b540aSrobert 17*404b540aSrobert You should have received a copy of the GNU General Public License 18*404b540aSrobert along with GCC; see the file COPYING. If not, write to 19*404b540aSrobert the Free Software Foundation, 51 Franklin Street, Fifth Floor, 20*404b540aSrobert Boston, MA 02110-1301, USA. */ 21*404b540aSrobert 22*404b540aSrobert #undef WCHAR_TYPE 23*404b540aSrobert #define WCHAR_TYPE "int" 24*404b540aSrobert 25*404b540aSrobert #undef WCHAR_TYPE_SIZE 26*404b540aSrobert #define WCHAR_TYPE_SIZE 32 27*404b540aSrobert 28*404b540aSrobert /* If defined, a C expression whose value is a string containing the 29*404b540aSrobert assembler operation to identify the following data as 30*404b540aSrobert uninitialized global data. If not defined, and neither 31*404b540aSrobert `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined, 32*404b540aSrobert uninitialized global data will be output in the data section if 33*404b540aSrobert `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be 34*404b540aSrobert used. */ 35*404b540aSrobert #define BSS_SECTION_ASM_OP "\t.section\t.bss" 36*404b540aSrobert 37*404b540aSrobert #define ASM_OUTPUT_ALIGNED_BSS mips_output_aligned_bss 38*404b540aSrobert 39*404b540aSrobert #undef ASM_DECLARE_OBJECT_NAME 40*404b540aSrobert #define ASM_DECLARE_OBJECT_NAME mips_declare_object_name 41*404b540aSrobert 42*404b540aSrobert #undef TARGET_VERSION 43*404b540aSrobert #if TARGET_ENDIAN_DEFAULT == 0 44*404b540aSrobert #define TARGET_VERSION fprintf (stderr, " (MIPSel GNU/Linux with ELF)"); 45*404b540aSrobert #else 46*404b540aSrobert #define TARGET_VERSION fprintf (stderr, " (MIPS GNU/Linux with ELF)"); 47*404b540aSrobert #endif 48*404b540aSrobert 49*404b540aSrobert #undef MD_EXEC_PREFIX 50*404b540aSrobert #undef MD_STARTFILE_PREFIX 51*404b540aSrobert 52*404b540aSrobert /* If we don't set MASK_ABICALLS, we can't default to PIC. */ 53*404b540aSrobert #undef TARGET_DEFAULT 54*404b540aSrobert #define TARGET_DEFAULT MASK_ABICALLS 55*404b540aSrobert 56*404b540aSrobert #define TARGET_OS_CPP_BUILTINS() \ 57*404b540aSrobert do { \ 58*404b540aSrobert LINUX_TARGET_OS_CPP_BUILTINS(); \ 59*404b540aSrobert /* The GNU C++ standard library requires this. */ \ 60*404b540aSrobert if (c_dialect_cxx ()) \ 61*404b540aSrobert builtin_define ("_GNU_SOURCE"); \ 62*404b540aSrobert \ 63*404b540aSrobert if (mips_abi == ABI_N32) \ 64*404b540aSrobert { \ 65*404b540aSrobert builtin_define ("_ABIN32=2"); \ 66*404b540aSrobert builtin_define ("_MIPS_SIM=_ABIN32"); \ 67*404b540aSrobert builtin_define ("_MIPS_SZLONG=32"); \ 68*404b540aSrobert builtin_define ("_MIPS_SZPTR=32"); \ 69*404b540aSrobert } \ 70*404b540aSrobert else if (mips_abi == ABI_64) \ 71*404b540aSrobert { \ 72*404b540aSrobert builtin_define ("_ABI64=3"); \ 73*404b540aSrobert builtin_define ("_MIPS_SIM=_ABI64"); \ 74*404b540aSrobert builtin_define ("_MIPS_SZLONG=64"); \ 75*404b540aSrobert builtin_define ("_MIPS_SZPTR=64"); \ 76*404b540aSrobert } \ 77*404b540aSrobert else \ 78*404b540aSrobert { \ 79*404b540aSrobert builtin_define ("_ABIO32=1"); \ 80*404b540aSrobert builtin_define ("_MIPS_SIM=_ABIO32"); \ 81*404b540aSrobert builtin_define ("_MIPS_SZLONG=32"); \ 82*404b540aSrobert builtin_define ("_MIPS_SZPTR=32"); \ 83*404b540aSrobert } \ 84*404b540aSrobert if (TARGET_FLOAT64) \ 85*404b540aSrobert builtin_define ("_MIPS_FPSET=32"); \ 86*404b540aSrobert else \ 87*404b540aSrobert builtin_define ("_MIPS_FPSET=16"); \ 88*404b540aSrobert \ 89*404b540aSrobert builtin_define ("_MIPS_SZINT=32"); \ 90*404b540aSrobert } while (0) 91*404b540aSrobert 92*404b540aSrobert #undef SUBTARGET_CPP_SPEC 93*404b540aSrobert #define SUBTARGET_CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}" 94*404b540aSrobert 95*404b540aSrobert /* A standard GNU/Linux mapping. On most targets, it is included in 96*404b540aSrobert CC1_SPEC itself by config/linux.h, but mips.h overrides CC1_SPEC 97*404b540aSrobert and provides this hook instead. */ 98*404b540aSrobert #undef SUBTARGET_CC1_SPEC 99*404b540aSrobert #define SUBTARGET_CC1_SPEC "%{profile:-p}" 100*404b540aSrobert 101*404b540aSrobert /* From iris5.h */ 102*404b540aSrobert /* -G is incompatible with -KPIC which is the default, so only allow objects 103*404b540aSrobert in the small data section if the user explicitly asks for it. */ 104*404b540aSrobert #undef MIPS_DEFAULT_GVALUE 105*404b540aSrobert #define MIPS_DEFAULT_GVALUE 0 106*404b540aSrobert 107*404b540aSrobert #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1" 108*404b540aSrobert 109*404b540aSrobert /* Borrowed from sparc/linux.h */ 110*404b540aSrobert #undef LINK_SPEC 111*404b540aSrobert #define LINK_SPEC \ 112*404b540aSrobert "%(endian_spec) \ 113*404b540aSrobert %{shared:-shared} \ 114*404b540aSrobert %{!shared: \ 115*404b540aSrobert %{!ibcs: \ 116*404b540aSrobert %{!static: \ 117*404b540aSrobert %{rdynamic:-export-dynamic} \ 118*404b540aSrobert %{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER "}} \ 119*404b540aSrobert %{static:-static}}}" 120*404b540aSrobert 121*404b540aSrobert #undef SUBTARGET_ASM_SPEC 122*404b540aSrobert #define SUBTARGET_ASM_SPEC "%{mabi=64: -64} %{!mno-abicalls:-KPIC}" 123*404b540aSrobert 124*404b540aSrobert /* The MIPS assembler has different syntax for .set. We set it to 125*404b540aSrobert .dummy to trap any errors. */ 126*404b540aSrobert #undef SET_ASM_OP 127*404b540aSrobert #define SET_ASM_OP "\t.dummy\t" 128*404b540aSrobert 129*404b540aSrobert #undef ASM_OUTPUT_DEF 130*404b540aSrobert #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \ 131*404b540aSrobert do { \ 132*404b540aSrobert fputc ( '\t', FILE); \ 133*404b540aSrobert assemble_name (FILE, LABEL1); \ 134*404b540aSrobert fputs ( " = ", FILE); \ 135*404b540aSrobert assemble_name (FILE, LABEL2); \ 136*404b540aSrobert fputc ( '\n', FILE); \ 137*404b540aSrobert } while (0) 138*404b540aSrobert 139*404b540aSrobert #undef ASM_DECLARE_FUNCTION_NAME 140*404b540aSrobert #define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \ 141*404b540aSrobert do { \ 142*404b540aSrobert if (!flag_inhibit_size_directive) \ 143*404b540aSrobert { \ 144*404b540aSrobert fputs ("\t.ent\t", STREAM); \ 145*404b540aSrobert assemble_name (STREAM, NAME); \ 146*404b540aSrobert putc ('\n', STREAM); \ 147*404b540aSrobert } \ 148*404b540aSrobert ASM_OUTPUT_TYPE_DIRECTIVE (STREAM, NAME, "function"); \ 149*404b540aSrobert assemble_name (STREAM, NAME); \ 150*404b540aSrobert fputs (":\n", STREAM); \ 151*404b540aSrobert } while (0) 152*404b540aSrobert 153*404b540aSrobert #undef ASM_DECLARE_FUNCTION_SIZE 154*404b540aSrobert #define ASM_DECLARE_FUNCTION_SIZE(STREAM, NAME, DECL) \ 155*404b540aSrobert do { \ 156*404b540aSrobert if (!flag_inhibit_size_directive) \ 157*404b540aSrobert { \ 158*404b540aSrobert fputs ("\t.end\t", STREAM); \ 159*404b540aSrobert assemble_name (STREAM, NAME); \ 160*404b540aSrobert putc ('\n', STREAM); \ 161*404b540aSrobert } \ 162*404b540aSrobert } while (0) 163*404b540aSrobert 164*404b540aSrobert /* Tell function_prologue in mips.c that we have already output the .ent/.end 165*404b540aSrobert pseudo-ops. */ 166*404b540aSrobert #undef FUNCTION_NAME_ALREADY_DECLARED 167*404b540aSrobert #define FUNCTION_NAME_ALREADY_DECLARED 1 168*404b540aSrobert 169*404b540aSrobert /* The glibc _mcount stub will save $v0 for us. Don't mess with saving 170*404b540aSrobert it, since ASM_OUTPUT_REG_PUSH/ASM_OUTPUT_REG_POP do not work in the 171*404b540aSrobert presence of $gp-relative calls. */ 172*404b540aSrobert #undef ASM_OUTPUT_REG_PUSH 173*404b540aSrobert #undef ASM_OUTPUT_REG_POP 174*404b540aSrobert 175*404b540aSrobert #undef LIB_SPEC 176*404b540aSrobert #define LIB_SPEC "\ 177*404b540aSrobert %{shared: -lc} \ 178*404b540aSrobert %{!shared: %{pthread:-lpthread} \ 179*404b540aSrobert %{profile:-lc_p} %{!profile: -lc}}" 180*404b540aSrobert 181*404b540aSrobert #define MD_UNWIND_SUPPORT "config/mips/linux-unwind.h" 182