1/* Definitions for SPARC running Linux-based GNU systems with ELF. 2 Copyright (C) 1996-2020 Free Software Foundation, Inc. 3 Contributed by Eddie C. Dost (ecd@skynet.be) 4 5This file is part of GCC. 6 7GCC is free software; you can redistribute it and/or modify 8it under the terms of the GNU General Public License as published by 9the Free Software Foundation; either version 3, or (at your option) 10any later version. 11 12GCC is distributed in the hope that it will be useful, 13but WITHOUT ANY WARRANTY; without even the implied warranty of 14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15GNU General Public License for more details. 16 17You should have received a copy of the GNU General Public License 18along with GCC; see the file COPYING3. If not see 19<http://www.gnu.org/licenses/>. */ 20 21#define TARGET_OS_CPP_BUILTINS() \ 22 do \ 23 { \ 24 GNU_USER_TARGET_OS_CPP_BUILTINS(); \ 25 if (TARGET_LONG_DOUBLE_128) \ 26 builtin_define ("__LONG_DOUBLE_128__"); \ 27 } \ 28 while (0) 29 30#undef ENDFILE_SPEC 31#define ENDFILE_SPEC \ 32 GNU_USER_TARGET_ENDFILE_SPEC \ 33 "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}" 34 35/* -mcpu=native handling only makes sense with compiler running on 36 a SPARC chip. */ 37#if defined(__sparc__) && defined(__linux__) 38extern const char *host_detect_local_cpu (int argc, const char **argv); 39# define EXTRA_SPEC_FUNCTIONS \ 40 { "local_cpu_detect", host_detect_local_cpu }, 41 42# define MCPU_MTUNE_NATIVE_SPECS \ 43 " %{mcpu=native:%<mcpu=native %:local_cpu_detect(cpu)}" \ 44 " %{mtune=native:%<mtune=native %:local_cpu_detect(tune)}" 45#else 46# define MCPU_MTUNE_NATIVE_SPECS "" 47#endif 48 49#define DRIVER_SELF_SPECS MCPU_MTUNE_NATIVE_SPECS 50 51#undef ASAN_CC1_SPEC 52#define ASAN_CC1_SPEC "%{%:sanitize(address):-funwind-tables}" 53 54#undef CC1_SPEC 55#define CC1_SPEC GNU_USER_TARGET_CC1_SPEC ASAN_CC1_SPEC 56 57#undef SIZE_TYPE 58#define SIZE_TYPE "unsigned int" 59 60#undef PTRDIFF_TYPE 61#define PTRDIFF_TYPE "int" 62 63#undef WCHAR_TYPE 64#define WCHAR_TYPE "int" 65 66#undef WCHAR_TYPE_SIZE 67#define WCHAR_TYPE_SIZE 32 68 69#undef CPP_SUBTARGET_SPEC 70#define CPP_SUBTARGET_SPEC \ 71"%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}" 72 73/* Provide a LINK_SPEC appropriate for GNU/Linux. Here we provide support 74 for the special GCC options -static and -shared, which allow us to 75 link things in one of these three modes by applying the appropriate 76 combinations of options at link-time. 77 78 When the -shared link option is used a final link is not being 79 done. */ 80 81#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" 82 83#undef LINK_SPEC 84#define LINK_SPEC "-m elf32_sparc %{shared:-shared} \ 85 %{!mno-relax:%{!r:-relax}} \ 86 %{!shared: \ 87 %{!static: \ 88 %{rdynamic:-export-dynamic} \ 89 -dynamic-linker " GNU_USER_DYNAMIC_LINKER "} \ 90 %{static:-static}}" 91 92/* It's safe to pass -s always, even if -g is not used. */ 93#undef ASM_SPEC 94#define ASM_SPEC "\ 95-s \ 96%{" FPIE_OR_FPIC_SPEC ":-K PIC} \ 97%{!.c:%{findirect-dispatch:-K PIC}} \ 98%(asm_cpu) %(asm_relax)" 99 100#undef ASM_OUTPUT_ALIGNED_LOCAL 101#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \ 102do { \ 103 fputs ("\t.local\t", (FILE)); \ 104 assemble_name ((FILE), (NAME)); \ 105 putc ('\n', (FILE)); \ 106 ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \ 107} while (0) 108 109#undef COMMON_ASM_OP 110#define COMMON_ASM_OP "\t.common\t" 111 112#undef LOCAL_LABEL_PREFIX 113#define LOCAL_LABEL_PREFIX "." 114 115 116/* Define for support of TFmode long double. 117 SPARC ABI says that long double is 4 words. */ 118#define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64) 119 120#undef DITF_CONVERSION_LIBFUNCS 121#define DITF_CONVERSION_LIBFUNCS 1 122 123#ifdef HAVE_AS_TLS 124#undef TARGET_SUN_TLS 125#undef TARGET_GNU_TLS 126#define TARGET_SUN_TLS 0 127#define TARGET_GNU_TLS 1 128#endif 129 130/* We use GNU ld so undefine this so that attribute((init_priority)) works. */ 131#undef CTORS_SECTION_ASM_OP 132#undef DTORS_SECTION_ASM_OP 133 134/* Static stack checking is supported by means of probes. */ 135#define STACK_CHECK_STATIC_BUILTIN 1 136 137#undef NEED_INDICATE_EXEC_STACK 138#define NEED_INDICATE_EXEC_STACK 1 139 140#ifdef TARGET_LIBC_PROVIDES_SSP 141/* sparc glibc provides __stack_chk_guard in [%g7 + 0x14]. */ 142#define TARGET_THREAD_SSP_OFFSET 0x14 143#endif 144 145/* Define if long doubles should be mangled as 'g'. */ 146#define TARGET_ALTERNATE_LONG_DOUBLE_MANGLING 147 148/* We use glibc _mcount for profiling. */ 149#undef NO_PROFILE_COUNTERS 150#define NO_PROFILE_COUNTERS 1 151