1*404b540aSrobert /* Definitions for SPARC running Linux-based GNU systems with ELF. 2*404b540aSrobert Copyright (C) 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006 3*404b540aSrobert Free Software Foundation, Inc. 4*404b540aSrobert Contributed by Eddie C. Dost (ecd@skynet.be) 5*404b540aSrobert 6*404b540aSrobert This file is part of GCC. 7*404b540aSrobert 8*404b540aSrobert GCC is free software; you can redistribute it and/or modify 9*404b540aSrobert it under the terms of the GNU General Public License as published by 10*404b540aSrobert the Free Software Foundation; either version 2, or (at your option) 11*404b540aSrobert any later version. 12*404b540aSrobert 13*404b540aSrobert GCC is distributed in the hope that it will be useful, 14*404b540aSrobert but WITHOUT ANY WARRANTY; without even the implied warranty of 15*404b540aSrobert MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16*404b540aSrobert GNU General Public License for more details. 17*404b540aSrobert 18*404b540aSrobert You should have received a copy of the GNU General Public License 19*404b540aSrobert along with GCC; see the file COPYING. If not, write to 20*404b540aSrobert the Free Software Foundation, 51 Franklin Street, Fifth Floor, 21*404b540aSrobert Boston, MA 02110-1301, USA. */ 22*404b540aSrobert 23*404b540aSrobert #define TARGET_OS_CPP_BUILTINS() \ 24*404b540aSrobert do \ 25*404b540aSrobert { \ 26*404b540aSrobert builtin_define_std ("unix"); \ 27*404b540aSrobert builtin_define_std ("linux"); \ 28*404b540aSrobert builtin_define ("__gnu_linux__"); \ 29*404b540aSrobert builtin_assert ("system=linux"); \ 30*404b540aSrobert builtin_assert ("system=unix"); \ 31*404b540aSrobert builtin_assert ("system=posix"); \ 32*404b540aSrobert if (TARGET_LONG_DOUBLE_128) \ 33*404b540aSrobert builtin_define ("__LONG_DOUBLE_128__"); \ 34*404b540aSrobert } \ 35*404b540aSrobert while (0) 36*404b540aSrobert 37*404b540aSrobert /* Don't assume anything about the header files. */ 38*404b540aSrobert #define NO_IMPLICIT_EXTERN_C 39*404b540aSrobert 40*404b540aSrobert #undef MD_EXEC_PREFIX 41*404b540aSrobert #undef MD_STARTFILE_PREFIX 42*404b540aSrobert 43*404b540aSrobert /* Provide a STARTFILE_SPEC appropriate for GNU/Linux. Here we add 44*404b540aSrobert the GNU/Linux magical crtbegin.o file (see crtstuff.c) which 45*404b540aSrobert provides part of the support for getting C++ file-scope static 46*404b540aSrobert object constructed before entering `main'. */ 47*404b540aSrobert 48*404b540aSrobert #undef STARTFILE_SPEC 49*404b540aSrobert #if defined HAVE_LD_PIE 50*404b540aSrobert #define STARTFILE_SPEC \ 51*404b540aSrobert "%{!shared: %{pg|p:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}}\ 52*404b540aSrobert crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}" 53*404b540aSrobert #else 54*404b540aSrobert #define STARTFILE_SPEC \ 55*404b540aSrobert "%{!shared: %{pg|p:gcrt1.o%s;:crt1.o%s}}\ 56*404b540aSrobert crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}" 57*404b540aSrobert #endif 58*404b540aSrobert 59*404b540aSrobert /* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on 60*404b540aSrobert the GNU/Linux magical crtend.o file (see crtstuff.c) which 61*404b540aSrobert provides part of the support for getting C++ file-scope static 62*404b540aSrobert object constructed before entering `main', followed by a normal 63*404b540aSrobert GNU/Linux "finalizer" file, `crtn.o'. */ 64*404b540aSrobert 65*404b540aSrobert #undef ENDFILE_SPEC 66*404b540aSrobert #define ENDFILE_SPEC \ 67*404b540aSrobert "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ 68*404b540aSrobert %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s" 69*404b540aSrobert 70*404b540aSrobert /* This is for -profile to use -lc_p instead of -lc. */ 71*404b540aSrobert #undef CC1_SPEC 72*404b540aSrobert #define CC1_SPEC "%{profile:-p} \ 73*404b540aSrobert %{sun4:} %{target:} \ 74*404b540aSrobert %{mcypress:-mcpu=cypress} \ 75*404b540aSrobert %{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \ 76*404b540aSrobert %{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \ 77*404b540aSrobert " 78*404b540aSrobert 79*404b540aSrobert /* The GNU C++ standard library requires that these macros be defined. */ 80*404b540aSrobert #undef CPLUSPLUS_CPP_SPEC 81*404b540aSrobert #define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)" 82*404b540aSrobert 83*404b540aSrobert #undef TARGET_VERSION 84*404b540aSrobert #define TARGET_VERSION fprintf (stderr, " (sparc GNU/Linux with ELF)"); 85*404b540aSrobert 86*404b540aSrobert #undef SIZE_TYPE 87*404b540aSrobert #define SIZE_TYPE "unsigned int" 88*404b540aSrobert 89*404b540aSrobert #undef PTRDIFF_TYPE 90*404b540aSrobert #define PTRDIFF_TYPE "int" 91*404b540aSrobert 92*404b540aSrobert #undef WCHAR_TYPE 93*404b540aSrobert #define WCHAR_TYPE "int" 94*404b540aSrobert 95*404b540aSrobert #undef WCHAR_TYPE_SIZE 96*404b540aSrobert #define WCHAR_TYPE_SIZE 32 97*404b540aSrobert 98*404b540aSrobert #undef CPP_SUBTARGET_SPEC 99*404b540aSrobert #define CPP_SUBTARGET_SPEC \ 100*404b540aSrobert "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}" 101*404b540aSrobert 102*404b540aSrobert #undef LIB_SPEC 103*404b540aSrobert #define LIB_SPEC \ 104*404b540aSrobert "%{pthread:-lpthread} \ 105*404b540aSrobert %{shared:-lc} \ 106*404b540aSrobert %{!shared:%{mieee-fp:-lieee} %{profile:-lc_p}%{!profile:-lc}}" 107*404b540aSrobert 108*404b540aSrobert /* Provide a LINK_SPEC appropriate for GNU/Linux. Here we provide support 109*404b540aSrobert for the special GCC options -static and -shared, which allow us to 110*404b540aSrobert link things in one of these three modes by applying the appropriate 111*404b540aSrobert combinations of options at link-time. We like to support here for 112*404b540aSrobert as many of the other GNU linker options as possible. But I don't 113*404b540aSrobert have the time to search for those flags. I am sure how to add 114*404b540aSrobert support for -soname shared_object_name. H.J. 115*404b540aSrobert 116*404b540aSrobert I took out %{v:%{!V:-V}}. It is too much :-(. They can use 117*404b540aSrobert -Wl,-V. 118*404b540aSrobert 119*404b540aSrobert When the -shared link option is used a final link is not being 120*404b540aSrobert done. */ 121*404b540aSrobert 122*404b540aSrobert /* If ELF is the default format, we should not use /lib/elf. */ 123*404b540aSrobert 124*404b540aSrobert #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" 125*404b540aSrobert #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" 126*404b540aSrobert #if UCLIBC_DEFAULT 127*404b540aSrobert #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:%{muclibc:%e-mglibc and -muclibc used together}" G ";:" U "}" 128*404b540aSrobert #else 129*404b540aSrobert #define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:%{mglibc:%e-mglibc and -muclibc used together}" U ";:" G "}" 130*404b540aSrobert #endif 131*404b540aSrobert #define LINUX_DYNAMIC_LINKER \ 132*404b540aSrobert CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER) 133*404b540aSrobert 134*404b540aSrobert 135*404b540aSrobert #undef LINK_SPEC 136*404b540aSrobert #define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \ 137*404b540aSrobert %{!mno-relax:%{!r:-relax}} \ 138*404b540aSrobert %{!shared: \ 139*404b540aSrobert %{!ibcs: \ 140*404b540aSrobert %{!static: \ 141*404b540aSrobert %{rdynamic:-export-dynamic} \ 142*404b540aSrobert %{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER "}} \ 143*404b540aSrobert %{static:-static}}}" 144*404b540aSrobert 145*404b540aSrobert /* The sun bundled assembler doesn't accept -Yd, (and neither does gas). 146*404b540aSrobert It's safe to pass -s always, even if -g is not used. */ 147*404b540aSrobert #undef ASM_SPEC 148*404b540aSrobert #define ASM_SPEC \ 149*404b540aSrobert "%{V} %{v:%{!V:-V}} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s \ 150*404b540aSrobert %{fpic|fPIC|fpie|fPIE:-K PIC} %(asm_cpu) %(asm_relax)" 151*404b540aSrobert 152*404b540aSrobert /* Same as sparc.h */ 153*404b540aSrobert #undef DBX_REGISTER_NUMBER 154*404b540aSrobert #define DBX_REGISTER_NUMBER(REGNO) (REGNO) 155*404b540aSrobert 156*404b540aSrobert #undef ASM_OUTPUT_ALIGNED_LOCAL 157*404b540aSrobert #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \ 158*404b540aSrobert do { \ 159*404b540aSrobert fputs ("\t.local\t", (FILE)); \ 160*404b540aSrobert assemble_name ((FILE), (NAME)); \ 161*404b540aSrobert putc ('\n', (FILE)); \ 162*404b540aSrobert ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \ 163*404b540aSrobert } while (0) 164*404b540aSrobert 165*404b540aSrobert #undef COMMON_ASM_OP 166*404b540aSrobert #define COMMON_ASM_OP "\t.common\t" 167*404b540aSrobert 168*404b540aSrobert #undef LOCAL_LABEL_PREFIX 169*404b540aSrobert #define LOCAL_LABEL_PREFIX "." 170*404b540aSrobert 171*404b540aSrobert /* This is how to store into the string LABEL 172*404b540aSrobert the symbol_ref name of an internal numbered label where 173*404b540aSrobert PREFIX is the class of label and NUM is the number within the class. 174*404b540aSrobert This is suitable for output with `assemble_name'. */ 175*404b540aSrobert 176*404b540aSrobert #undef ASM_GENERATE_INTERNAL_LABEL 177*404b540aSrobert #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \ 178*404b540aSrobert sprintf (LABEL, "*.L%s%ld", PREFIX, (long)(NUM)) 179*404b540aSrobert 180*404b540aSrobert 181*404b540aSrobert /* Define for support of TFmode long double. 182*404b540aSrobert SPARC ABI says that long double is 4 words. */ 183*404b540aSrobert #define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64) 184*404b540aSrobert 185*404b540aSrobert /* Define this to set long double type size to use in libgcc2.c, which can 186*404b540aSrobert not depend on target_flags. */ 187*404b540aSrobert #ifdef __LONG_DOUBLE_128__ 188*404b540aSrobert #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128 189*404b540aSrobert #else 190*404b540aSrobert #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64 191*404b540aSrobert #endif 192*404b540aSrobert 193*404b540aSrobert #undef DITF_CONVERSION_LIBFUNCS 194*404b540aSrobert #define DITF_CONVERSION_LIBFUNCS 1 195*404b540aSrobert 196*404b540aSrobert #if defined(HAVE_LD_EH_FRAME_HDR) 197*404b540aSrobert #define LINK_EH_SPEC "%{!static:--eh-frame-hdr} " 198*404b540aSrobert #endif 199*404b540aSrobert 200*404b540aSrobert #ifdef HAVE_AS_TLS 201*404b540aSrobert #undef TARGET_SUN_TLS 202*404b540aSrobert #undef TARGET_GNU_TLS 203*404b540aSrobert #define TARGET_SUN_TLS 0 204*404b540aSrobert #define TARGET_GNU_TLS 1 205*404b540aSrobert #endif 206*404b540aSrobert 207*404b540aSrobert /* Don't be different from other Linux platforms in this regard. */ 208*404b540aSrobert #define HANDLE_PRAGMA_PACK_PUSH_POP 209*404b540aSrobert 210*404b540aSrobert /* We use GNU ld so undefine this so that attribute((init_priority)) works. */ 211*404b540aSrobert #undef CTORS_SECTION_ASM_OP 212*404b540aSrobert #undef DTORS_SECTION_ASM_OP 213*404b540aSrobert 214*404b540aSrobert /* Determine whether the entire c99 runtime is present in the 215*404b540aSrobert runtime library. */ 216*404b540aSrobert #define TARGET_C99_FUNCTIONS (OPTION_GLIBC) 217*404b540aSrobert 218*404b540aSrobert #define TARGET_POSIX_IO 219*404b540aSrobert 220*404b540aSrobert #undef LINK_GCC_C_SEQUENCE_SPEC 221*404b540aSrobert #define LINK_GCC_C_SEQUENCE_SPEC \ 222*404b540aSrobert "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}" 223*404b540aSrobert 224*404b540aSrobert /* Use --as-needed -lgcc_s for eh support. */ 225*404b540aSrobert #ifdef HAVE_LD_AS_NEEDED 226*404b540aSrobert #define USE_LD_AS_NEEDED 1 227*404b540aSrobert #endif 228*404b540aSrobert 229*404b540aSrobert #define MD_UNWIND_SUPPORT "config/sparc/linux-unwind.h" 230*404b540aSrobert 231*404b540aSrobert /* Linux currently uses RMO in uniprocessor mode, which is equivalent to 232*404b540aSrobert TMO, and TMO in multiprocessor mode. But they reserve the right to 233*404b540aSrobert change their minds. */ 234*404b540aSrobert #undef SPARC_RELAXED_ORDERING 235*404b540aSrobert #define SPARC_RELAXED_ORDERING true 236*404b540aSrobert 237*404b540aSrobert #undef NEED_INDICATE_EXEC_STACK 238*404b540aSrobert #define NEED_INDICATE_EXEC_STACK 1 239*404b540aSrobert 240*404b540aSrobert #ifdef TARGET_LIBC_PROVIDES_SSP 241*404b540aSrobert /* sparc glibc provides __stack_chk_guard in [%g7 + 0x14]. */ 242*404b540aSrobert #define TARGET_THREAD_SSP_OFFSET 0x14 243*404b540aSrobert #endif 244*404b540aSrobert 245*404b540aSrobert /* Define if long doubles should be mangled as 'g'. */ 246*404b540aSrobert #define TARGET_ALTERNATE_LONG_DOUBLE_MANGLING 247