freebsd.h revision 236329
1117404Skan/* Definitions for Sun SPARC64 running FreeBSD using the ELF format 2169706Skan Copyright (C) 2001, 2002, 2004, 2005, 2006 Free Software Foundation, Inc. 390075Sobrien Contributed by David E. O'Brien <obrien@FreeBSD.org> and BSDi. 490075Sobrien 5132746SkanThis file is part of GCC. 690075Sobrien 7132746SkanGCC is free software; you can redistribute it and/or modify 890075Sobrienit under the terms of the GNU General Public License as published by 990075Sobrienthe Free Software Foundation; either version 2, or (at your option) 1090075Sobrienany later version. 1190075Sobrien 12132746SkanGCC is distributed in the hope that it will be useful, 1390075Sobrienbut WITHOUT ANY WARRANTY; without even the implied warranty of 1490075SobrienMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1590075SobrienGNU General Public License for more details. 1690075Sobrien 1790075SobrienYou should have received a copy of the GNU General Public License 18132746Skanalong with GCC; see the file COPYING. If not, write to 19169706Skanthe Free Software Foundation, 51 Franklin Street, Fifth Floor, 20169706SkanBoston, MA 02110-1301, USA. */ 2190075Sobrien 22103261Sobrien/* $FreeBSD: head/contrib/gcc/config/sparc/freebsd.h 236329 2012-05-30 20:13:49Z marius $ */ 2390075Sobrien 24132746Skan#undef SUBTARGET_EXTRA_SPECS 25132746Skan#define SUBTARGET_EXTRA_SPECS \ 26132746Skan { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER } 27132746Skan 28107599Sobrien/* FreeBSD needs the platform name (sparc64) defined. 29174482Smarius Emacs needs to know if the arch is 64 or 32-bits. 30174482Smarius This also selects which targets are available via -mcpu. */ 31103261Sobrien 32123546Sobrien#undef FBSD_TARGET_CPU_CPP_BUILTINS 33123546Sobrien#define FBSD_TARGET_CPU_CPP_BUILTINS() \ 34123546Sobrien do \ 35123546Sobrien { \ 36123546Sobrien builtin_define ("__LP64__"); \ 37174482Smarius builtin_define ("__sparc64__"); \ 38174482Smarius builtin_define ("__sparc_v9__"); \ 39174482Smarius builtin_define ("__sparcv9"); \ 40174482Smarius builtin_define ("__sparc__"); \ 41174482Smarius builtin_define ("__arch64__"); \ 42123546Sobrien } \ 43123546Sobrien while (0) 44123546Sobrien 4596263Sobrien#define LINK_SPEC "%(link_arch) \ 4696263Sobrien %{!mno-relax:%{!r:-relax}} \ 47169706Skan %{p:%nconsider using `-pg' instead of `-p' with gprof(1)} \ 48236329Smarius %{v:-V} \ 4990075Sobrien %{assert*} %{R*} %{rpath*} %{defsym*} \ 5090075Sobrien %{shared:-Bshareable %{h*} %{soname*}} \ 5190075Sobrien %{!shared: \ 5290075Sobrien %{!static: \ 5390075Sobrien %{rdynamic:-export-dynamic} \ 54132746Skan %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \ 55236329Smarius %{static:-Bstatic}} \ 56236329Smarius %{!static:--hash-style=both} \ 57236329Smarius %{symbolic:-Bsymbolic}" 5890075Sobrien 5990075Sobrien 6090075Sobrien/************************[ Target stuff ]***********************************/ 6190075Sobrien 6290075Sobrien/* Define the actual types of some ANSI-mandated types. 6390075Sobrien Needs to agree with <machine/ansi.h>. GCC defaults come from c-decl.c, 6490075Sobrien c-common.c, and config/<arch>/<arch>.h. */ 6590075Sobrien 6690075Sobrien/* Earlier headers may get this wrong for FreeBSD. 6790075Sobrien We use the GCC defaults instead. */ 6890075Sobrien#undef WCHAR_TYPE 6990075Sobrien 7090075Sobrien#undef WCHAR_TYPE_SIZE 7190075Sobrien#define WCHAR_TYPE_SIZE 32 7290075Sobrien 73117404Skan/* Define for support of TFmode long double. 74117404Skan SPARC ABI says that long double is 4 words. */ 7590075Sobrien#undef LONG_DOUBLE_TYPE_SIZE 7690075Sobrien#define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64) 7790075Sobrien 7890075Sobrien/* Define this to set long double type size to use in libgcc2.c, which can 7990075Sobrien not depend on target_flags. */ 8090075Sobrien#if defined(__arch64__) || defined(__LONG_DOUBLE_128__) 8190075Sobrien#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128 8290075Sobrien#else 8390075Sobrien#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64 8490075Sobrien#endif 8590075Sobrien 8690075Sobrien/* Definitions for 64-bit SPARC running systems with ELF. */ 8790075Sobrien 8890075Sobrien#undef TARGET_VERSION 8990075Sobrien#define TARGET_VERSION fprintf (stderr, " (FreeBSD/sparc64 ELF)"); 9090075Sobrien 9190075Sobrien#define TARGET_ELF 1 9290075Sobrien 9390075Sobrien/* XXX */ 9490075Sobrien/* A 64 bit v9 compiler with stack-bias, 9590075Sobrien in a Medium/mid code model environment. */ 9690075Sobrien 9790075Sobrien#undef TARGET_DEFAULT 9890075Sobrien#define TARGET_DEFAULT \ 9996263Sobrien (MASK_V9 + MASK_64BIT + MASK_PTR64 /* + MASK_FASTER_STRUCTS */ \ 10096263Sobrien + MASK_STACK_BIAS + MASK_APP_REGS + MASK_FPU \ 10190075Sobrien + MASK_LONG_DOUBLE_128 /* + MASK_HARD_QUAD */) 10290075Sobrien 10390075Sobrien/* The default code model. */ 10490075Sobrien#undef SPARC_DEFAULT_CMODEL 10596263Sobrien#define SPARC_DEFAULT_CMODEL CM_MEDLOW 10690075Sobrien 107132746Skan#define ENABLE_EXECUTE_STACK \ 108106442Sobrien static int need_enable_exec_stack; \ 109106442Sobrien static void check_enabling(void) __attribute__ ((constructor)); \ 110106442Sobrien static void check_enabling(void) \ 111106442Sobrien { \ 112106442Sobrien extern int sysctlbyname(const char *, void *, size_t *, void *, size_t);\ 113106442Sobrien int prot = 0; \ 114106442Sobrien size_t len = sizeof(prot); \ 115106442Sobrien \ 116106442Sobrien sysctlbyname ("kern.stackprot", &prot, &len, NULL, 0); \ 117106442Sobrien if (prot != 7) \ 118106442Sobrien need_enable_exec_stack = 1; \ 119106442Sobrien } \ 120106442Sobrien extern void __enable_execute_stack (void *); \ 121106442Sobrien void __enable_execute_stack (void *addr) \ 122106442Sobrien { \ 123106442Sobrien if (!need_enable_exec_stack) \ 124106442Sobrien return; \ 125106442Sobrien else { \ 126106442Sobrien /* 7 is PROT_READ | PROT_WRITE | PROT_EXEC */ \ 127106442Sobrien if (mprotect (addr, TRAMPOLINE_SIZE, 7) < 0) \ 128106442Sobrien perror ("mprotect of trampoline code"); \ 129106442Sobrien } \ 130106442Sobrien } 13190075Sobrien 132106442Sobrien 13390075Sobrien/************************[ Assembler stuff ]********************************/ 13490075Sobrien 13596263Sobrien#undef LOCAL_LABEL_PREFIX 13696263Sobrien#define LOCAL_LABEL_PREFIX "." 13790075Sobrien 13890075Sobrien/* XXX2 */ 13990075Sobrien/* This is how to store into the string LABEL 14090075Sobrien the symbol_ref name of an internal numbered label where 14190075Sobrien PREFIX is the class of label and NUM is the number within the class. 14290075Sobrien This is suitable for output with `assemble_name'. */ 14390075Sobrien 14490075Sobrien#undef ASM_GENERATE_INTERNAL_LABEL 14590075Sobrien#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \ 146132746Skan sprintf (LABEL, "*.L%s%lu", PREFIX, (unsigned long)(NUM)) 14790075Sobrien 14890075Sobrien 14990075Sobrien/************************[ Debugger stuff ]*********************************/ 15090075Sobrien 15190075Sobrien/* This is the char to use for continuation (in case we need to turn 15290075Sobrien continuation back on). */ 15390075Sobrien 15490075Sobrien#undef DBX_CONTIN_CHAR 15590075Sobrien#define DBX_CONTIN_CHAR '?' 15690075Sobrien 15790075Sobrien/* DWARF bits. */ 15890075Sobrien 15990075Sobrien/* Follow Irix 6 and not the Dwarf2 draft in using 64-bit offsets. 16090075Sobrien Obviously the Dwarf2 folks havn't tried to actually build systems 16190075Sobrien with their spec. On a 64-bit system, only 64-bit relocs become 16290075Sobrien RELATIVE relocations. */ 16390075Sobrien 16490075Sobrien/* #define DWARF_OFFSET_SIZE PTR_SIZE */ 16596263Sobrien 166219534Smarius#ifdef HAVE_AS_TLS 167219534Smarius#undef TARGET_SUN_TLS 168219534Smarius#undef TARGET_GNU_TLS 169219534Smarius#define TARGET_SUN_TLS 0 170219534Smarius#define TARGET_GNU_TLS 1 171219534Smarius#endif 172219534Smarius 17396263Sobrien#undef ENDFILE_SPEC 174169706Skan#define ENDFILE_SPEC \ 175169706Skan "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} " \ 176169706Skan FBSD_ENDFILE_SPEC 17796263Sobrien 17896263Sobrien/* We use GNU ld so undefine this so that attribute((init_priority)) works. */ 17996263Sobrien#undef CTORS_SECTION_ASM_OP 18096263Sobrien#undef DTORS_SECTION_ASM_OP 181