freebsd.h revision 238472
1/* Definitions for Sun SPARC64 running FreeBSD using the ELF format 2 Copyright (C) 2001, 2002, 2004, 2005, 2006 Free Software Foundation, Inc. 3 Contributed by David E. O'Brien <obrien@FreeBSD.org> and BSDi. 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 2, 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 COPYING. If not, write to 19the Free Software Foundation, 51 Franklin Street, Fifth Floor, 20Boston, MA 02110-1301, USA. */ 21 22/* $FreeBSD: head/contrib/gcc/config/sparc/freebsd.h 238472 2012-07-15 10:54:10Z kib $ */ 23 24#undef SUBTARGET_EXTRA_SPECS 25#define SUBTARGET_EXTRA_SPECS \ 26 { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER } 27 28/* FreeBSD needs the platform name (sparc64) defined. 29 Emacs needs to know if the arch is 64 or 32-bits. 30 This also selects which targets are available via -mcpu. */ 31 32#undef FBSD_TARGET_CPU_CPP_BUILTINS 33#define FBSD_TARGET_CPU_CPP_BUILTINS() \ 34 do \ 35 { \ 36 builtin_define ("__LP64__"); \ 37 builtin_define ("__sparc64__"); \ 38 builtin_define ("__sparc_v9__"); \ 39 builtin_define ("__sparcv9"); \ 40 builtin_define ("__sparc__"); \ 41 builtin_define ("__arch64__"); \ 42 } \ 43 while (0) 44 45#define LINK_SPEC "%(link_arch) \ 46 %{!mno-relax:%{!r:-relax}} \ 47 %{p:%nconsider using `-pg' instead of `-p' with gprof(1)} \ 48 %{v:-V} \ 49 %{assert*} %{R*} %{rpath*} %{defsym*} \ 50 %{shared:-Bshareable %{h*} %{soname*}} \ 51 %{!shared: \ 52 %{!static: \ 53 %{rdynamic:-export-dynamic} \ 54 %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \ 55 %{static:-Bstatic}} \ 56 %{!static:--hash-style=both --enable-new-dtags} \ 57 %{symbolic:-Bsymbolic}" 58 59 60/************************[ Target stuff ]***********************************/ 61 62/* Define the actual types of some ANSI-mandated types. 63 Needs to agree with <machine/ansi.h>. GCC defaults come from c-decl.c, 64 c-common.c, and config/<arch>/<arch>.h. */ 65 66/* Earlier headers may get this wrong for FreeBSD. 67 We use the GCC defaults instead. */ 68#undef WCHAR_TYPE 69 70#undef WCHAR_TYPE_SIZE 71#define WCHAR_TYPE_SIZE 32 72 73/* Define for support of TFmode long double. 74 SPARC ABI says that long double is 4 words. */ 75#undef LONG_DOUBLE_TYPE_SIZE 76#define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64) 77 78/* Define this to set long double type size to use in libgcc2.c, which can 79 not depend on target_flags. */ 80#if defined(__arch64__) || defined(__LONG_DOUBLE_128__) 81#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128 82#else 83#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64 84#endif 85 86/* Definitions for 64-bit SPARC running systems with ELF. */ 87 88#undef TARGET_VERSION 89#define TARGET_VERSION fprintf (stderr, " (FreeBSD/sparc64 ELF)"); 90 91#define TARGET_ELF 1 92 93/* XXX */ 94/* A 64 bit v9 compiler with stack-bias, 95 in a Medium/mid code model environment. */ 96 97#undef TARGET_DEFAULT 98#define TARGET_DEFAULT \ 99 (MASK_V9 + MASK_64BIT + MASK_PTR64 /* + MASK_FASTER_STRUCTS */ \ 100 + MASK_STACK_BIAS + MASK_APP_REGS + MASK_FPU \ 101 + MASK_LONG_DOUBLE_128 /* + MASK_HARD_QUAD */) 102 103/* The default code model. */ 104#undef SPARC_DEFAULT_CMODEL 105#define SPARC_DEFAULT_CMODEL CM_MEDLOW 106 107#define ENABLE_EXECUTE_STACK \ 108 static int need_enable_exec_stack; \ 109 static void check_enabling(void) __attribute__ ((constructor)); \ 110 static void check_enabling(void) \ 111 { \ 112 extern int sysctlbyname(const char *, void *, size_t *, void *, size_t);\ 113 int prot = 0; \ 114 size_t len = sizeof(prot); \ 115 \ 116 sysctlbyname ("kern.stackprot", &prot, &len, NULL, 0); \ 117 if (prot != 7) \ 118 need_enable_exec_stack = 1; \ 119 } \ 120 extern void __enable_execute_stack (void *); \ 121 void __enable_execute_stack (void *addr) \ 122 { \ 123 if (!need_enable_exec_stack) \ 124 return; \ 125 else { \ 126 /* 7 is PROT_READ | PROT_WRITE | PROT_EXEC */ \ 127 if (mprotect (addr, TRAMPOLINE_SIZE, 7) < 0) \ 128 perror ("mprotect of trampoline code"); \ 129 } \ 130 } 131 132 133/************************[ Assembler stuff ]********************************/ 134 135#undef LOCAL_LABEL_PREFIX 136#define LOCAL_LABEL_PREFIX "." 137 138/* XXX2 */ 139/* This is how to store into the string LABEL 140 the symbol_ref name of an internal numbered label where 141 PREFIX is the class of label and NUM is the number within the class. 142 This is suitable for output with `assemble_name'. */ 143 144#undef ASM_GENERATE_INTERNAL_LABEL 145#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \ 146 sprintf (LABEL, "*.L%s%lu", PREFIX, (unsigned long)(NUM)) 147 148 149/************************[ Debugger stuff ]*********************************/ 150 151/* This is the char to use for continuation (in case we need to turn 152 continuation back on). */ 153 154#undef DBX_CONTIN_CHAR 155#define DBX_CONTIN_CHAR '?' 156 157/* DWARF bits. */ 158 159/* Follow Irix 6 and not the Dwarf2 draft in using 64-bit offsets. 160 Obviously the Dwarf2 folks havn't tried to actually build systems 161 with their spec. On a 64-bit system, only 64-bit relocs become 162 RELATIVE relocations. */ 163 164/* #define DWARF_OFFSET_SIZE PTR_SIZE */ 165 166#ifdef HAVE_AS_TLS 167#undef TARGET_SUN_TLS 168#undef TARGET_GNU_TLS 169#define TARGET_SUN_TLS 0 170#define TARGET_GNU_TLS 1 171#endif 172 173#undef ENDFILE_SPEC 174#define ENDFILE_SPEC \ 175 "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} " \ 176 FBSD_ENDFILE_SPEC 177 178/* We use GNU ld so undefine this so that attribute((init_priority)) works. */ 179#undef CTORS_SECTION_ASM_OP 180#undef DTORS_SECTION_ASM_OP 181