1 |
12 |
jlechner |
/* 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 |
|
|
|
5 |
|
|
This file is part of GCC.
|
6 |
|
|
|
7 |
|
|
GCC is free software; you can redistribute it and/or modify
|
8 |
|
|
it under the terms of the GNU General Public License as published by
|
9 |
|
|
the Free Software Foundation; either version 2, or (at your option)
|
10 |
|
|
any later version.
|
11 |
|
|
|
12 |
|
|
GCC is distributed in the hope that it will be useful,
|
13 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15 |
|
|
GNU General Public License for more details.
|
16 |
|
|
|
17 |
|
|
You should have received a copy of the GNU General Public License
|
18 |
|
|
along with GCC; see the file COPYING. If not, write to
|
19 |
|
|
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
20 |
|
|
Boston, MA 02110-1301, USA. */
|
21 |
|
|
|
22 |
|
|
#undef SUBTARGET_EXTRA_SPECS
|
23 |
|
|
#define SUBTARGET_EXTRA_SPECS \
|
24 |
|
|
{ "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER }
|
25 |
|
|
|
26 |
|
|
/* FreeBSD needs the platform name (sparc64) defined.
|
27 |
|
|
Emacs needs to know if the arch is 64 or 32-bits. */
|
28 |
|
|
|
29 |
|
|
#undef CPP_CPU64_DEFAULT_SPEC
|
30 |
|
|
#define CPP_CPU64_DEFAULT_SPEC \
|
31 |
|
|
"-D__sparc64__ -D__sparc_v9__ -D__sparcv9 -D__arch64__"
|
32 |
|
|
|
33 |
|
|
#define LINK_SPEC "%(link_arch) \
|
34 |
|
|
%{!mno-relax:%{!r:-relax}} \
|
35 |
|
|
%{p:%nconsider using `-pg' instead of `-p' with gprof(1)} \
|
36 |
|
|
%{assert*} %{R*} %{rpath*} %{defsym*} \
|
37 |
|
|
%{shared:-Bshareable %{h*} %{soname*}} \
|
38 |
|
|
%{symbolic:-Bsymbolic} \
|
39 |
|
|
%{!shared: \
|
40 |
|
|
%{!static: \
|
41 |
|
|
%{rdynamic:-export-dynamic} \
|
42 |
|
|
%{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \
|
43 |
|
|
%{static:-Bstatic}}"
|
44 |
|
|
|
45 |
|
|
|
46 |
|
|
/************************[ Target stuff ]***********************************/
|
47 |
|
|
|
48 |
|
|
/* Define the actual types of some ANSI-mandated types.
|
49 |
|
|
Needs to agree with <machine/ansi.h>. GCC defaults come from c-decl.c,
|
50 |
|
|
c-common.c, and config/<arch>/<arch>.h. */
|
51 |
|
|
|
52 |
|
|
/* Earlier headers may get this wrong for FreeBSD.
|
53 |
|
|
We use the GCC defaults instead. */
|
54 |
|
|
#undef WCHAR_TYPE
|
55 |
|
|
|
56 |
|
|
#undef WCHAR_TYPE_SIZE
|
57 |
|
|
#define WCHAR_TYPE_SIZE 32
|
58 |
|
|
|
59 |
|
|
/* Define for support of TFmode long double.
|
60 |
|
|
SPARC ABI says that long double is 4 words. */
|
61 |
|
|
#undef LONG_DOUBLE_TYPE_SIZE
|
62 |
|
|
#define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64)
|
63 |
|
|
|
64 |
|
|
/* Define this to set long double type size to use in libgcc2.c, which can
|
65 |
|
|
not depend on target_flags. */
|
66 |
|
|
#if defined(__arch64__) || defined(__LONG_DOUBLE_128__)
|
67 |
|
|
#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128
|
68 |
|
|
#else
|
69 |
|
|
#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
|
70 |
|
|
#endif
|
71 |
|
|
|
72 |
|
|
/* Definitions for 64-bit SPARC running systems with ELF. */
|
73 |
|
|
|
74 |
|
|
#undef TARGET_VERSION
|
75 |
|
|
#define TARGET_VERSION fprintf (stderr, " (FreeBSD/sparc64 ELF)");
|
76 |
|
|
|
77 |
|
|
#define TARGET_ELF 1
|
78 |
|
|
|
79 |
|
|
/* XXX */
|
80 |
|
|
/* A 64 bit v9 compiler with stack-bias,
|
81 |
|
|
in a Medium/mid code model environment. */
|
82 |
|
|
|
83 |
|
|
#undef TARGET_DEFAULT
|
84 |
|
|
#define TARGET_DEFAULT \
|
85 |
|
|
(MASK_V9 + MASK_64BIT + MASK_PTR64 /* + MASK_FASTER_STRUCTS */ \
|
86 |
|
|
+ MASK_STACK_BIAS + MASK_APP_REGS + MASK_FPU \
|
87 |
|
|
+ MASK_LONG_DOUBLE_128 /* + MASK_HARD_QUAD */)
|
88 |
|
|
|
89 |
|
|
/* The default code model. */
|
90 |
|
|
#undef SPARC_DEFAULT_CMODEL
|
91 |
|
|
#define SPARC_DEFAULT_CMODEL CM_MEDLOW
|
92 |
|
|
|
93 |
|
|
#define ENABLE_EXECUTE_STACK \
|
94 |
|
|
static int need_enable_exec_stack; \
|
95 |
|
|
static void check_enabling(void) __attribute__ ((constructor)); \
|
96 |
|
|
static void check_enabling(void) \
|
97 |
|
|
{ \
|
98 |
|
|
extern int sysctlbyname(const char *, void *, size_t *, void *, size_t);\
|
99 |
|
|
int prot = 0; \
|
100 |
|
|
size_t len = sizeof(prot); \
|
101 |
|
|
\
|
102 |
|
|
sysctlbyname ("kern.stackprot", &prot, &len, NULL, 0); \
|
103 |
|
|
if (prot != 7) \
|
104 |
|
|
need_enable_exec_stack = 1; \
|
105 |
|
|
} \
|
106 |
|
|
extern void __enable_execute_stack (void *); \
|
107 |
|
|
void __enable_execute_stack (void *addr) \
|
108 |
|
|
{ \
|
109 |
|
|
if (!need_enable_exec_stack) \
|
110 |
|
|
return; \
|
111 |
|
|
else { \
|
112 |
|
|
/* 7 is PROT_READ | PROT_WRITE | PROT_EXEC */ \
|
113 |
|
|
if (mprotect (addr, TRAMPOLINE_SIZE, 7) < 0) \
|
114 |
|
|
perror ("mprotect of trampoline code"); \
|
115 |
|
|
} \
|
116 |
|
|
}
|
117 |
|
|
|
118 |
|
|
|
119 |
|
|
/************************[ Assembler stuff ]********************************/
|
120 |
|
|
|
121 |
|
|
#undef LOCAL_LABEL_PREFIX
|
122 |
|
|
#define LOCAL_LABEL_PREFIX "."
|
123 |
|
|
|
124 |
|
|
/* XXX2 */
|
125 |
|
|
/* This is how to store into the string LABEL
|
126 |
|
|
the symbol_ref name of an internal numbered label where
|
127 |
|
|
PREFIX is the class of label and NUM is the number within the class.
|
128 |
|
|
This is suitable for output with `assemble_name'. */
|
129 |
|
|
|
130 |
|
|
#undef ASM_GENERATE_INTERNAL_LABEL
|
131 |
|
|
#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
|
132 |
|
|
sprintf (LABEL, "*.L%s%lu", PREFIX, (unsigned long)(NUM))
|
133 |
|
|
|
134 |
|
|
|
135 |
|
|
/************************[ Debugger stuff ]*********************************/
|
136 |
|
|
|
137 |
|
|
/* This is the char to use for continuation (in case we need to turn
|
138 |
|
|
continuation back on). */
|
139 |
|
|
|
140 |
|
|
#undef DBX_CONTIN_CHAR
|
141 |
|
|
#define DBX_CONTIN_CHAR '?'
|
142 |
|
|
|
143 |
|
|
/* DWARF bits. */
|
144 |
|
|
|
145 |
|
|
/* Follow Irix 6 and not the Dwarf2 draft in using 64-bit offsets.
|
146 |
|
|
Obviously the Dwarf2 folks havn't tried to actually build systems
|
147 |
|
|
with their spec. On a 64-bit system, only 64-bit relocs become
|
148 |
|
|
RELATIVE relocations. */
|
149 |
|
|
|
150 |
|
|
/* #define DWARF_OFFSET_SIZE PTR_SIZE */
|
151 |
|
|
|
152 |
|
|
#undef ENDFILE_SPEC
|
153 |
|
|
#define ENDFILE_SPEC \
|
154 |
|
|
"%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} " \
|
155 |
|
|
FBSD_ENDFILE_SPEC
|
156 |
|
|
|
157 |
|
|
/* We use GNU ld so undefine this so that attribute((init_priority)) works. */
|
158 |
|
|
#undef CTORS_SECTION_ASM_OP
|
159 |
|
|
#undef DTORS_SECTION_ASM_OP
|