]>
Commit | Line | Data |
---|---|---|
b0435cf4 | 1 | /* Definitions of target machine for GNU compiler, for DEC Alpha on OSF/1. |
5076da17 | 2 | Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2001, 2002, 2003, |
2f83c7d6 | 3 | 2004, 2007 Free Software Foundation, Inc. |
b0435cf4 RH |
4 | Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu) |
5 | ||
7ec022b2 | 6 | This file is part of GCC. |
b0435cf4 | 7 | |
7ec022b2 | 8 | GCC is free software; you can redistribute it and/or modify |
b0435cf4 | 9 | it under the terms of the GNU General Public License as published by |
2f83c7d6 | 10 | the Free Software Foundation; either version 3, or (at your option) |
b0435cf4 RH |
11 | any later version. |
12 | ||
7ec022b2 | 13 | GCC is distributed in the hope that it will be useful, |
b0435cf4 RH |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | GNU General Public License for more details. | |
17 | ||
18 | You should have received a copy of the GNU General Public License | |
2f83c7d6 NC |
19 | along with GCC; see the file COPYING3. If not see |
20 | <http://www.gnu.org/licenses/>. */ | |
b0435cf4 | 21 | |
9ba3994a RH |
22 | /* As of OSF 4.0, as can subtract adjacent labels. */ |
23 | ||
24 | #undef TARGET_AS_CAN_SUBTRACT_LABELS | |
25 | #define TARGET_AS_CAN_SUBTRACT_LABELS 1 | |
b0435cf4 | 26 | |
5495cc55 RH |
27 | /* The GEM libraries for X_float are present, though not used by C. */ |
28 | ||
29 | #undef TARGET_HAS_XFLOATING_LIBS | |
30 | #define TARGET_HAS_XFLOATING_LIBS 1 | |
31 | ||
b0435cf4 RH |
32 | /* Names to predefine in the preprocessor for this target machine. */ |
33 | ||
f8dc212b RO |
34 | #define TARGET_OS_CPP_BUILTINS() \ |
35 | do { \ | |
36 | builtin_define_std ("unix"); \ | |
37 | builtin_define_std ("SYSTYPE_BSD"); \ | |
38 | builtin_define ("_SYSTYPE_BSD"); \ | |
39 | builtin_define ("__osf__"); \ | |
aeefc21d DL |
40 | builtin_define ("__digital__"); \ |
41 | builtin_define ("__arch64__"); \ | |
f8dc212b | 42 | builtin_define ("_LONGLONG"); \ |
f8dc212b RO |
43 | builtin_assert ("system=unix"); \ |
44 | builtin_assert ("system=xpg4"); \ | |
45 | /* Tru64 UNIX V5 has a 16 byte long \ | |
46 | double type and requires __X_FLOAT \ | |
47 | to be defined for <math.h>. */ \ | |
48 | if (LONG_DOUBLE_TYPE_SIZE == 128) \ | |
49 | builtin_define ("__X_FLOAT"); \ | |
f502cbff RO |
50 | \ |
51 | /* Tru64 UNIX V4/V5 provide several ISO C94 \ | |
52 | features protected by the corresponding \ | |
53 | __STDC_VERSION__ macro. libstdc++ v3 \ | |
54 | needs them as well. */ \ | |
55 | if (c_dialect_cxx ()) \ | |
56 | builtin_define ("__STDC_VERSION__=199409L"); \ | |
12a41c22 | 57 | } while (0) |
b0435cf4 | 58 | |
5c5d086f RO |
59 | /* Accept DEC C flags for multithreaded programs. We use _PTHREAD_USE_D4 |
60 | instead of PTHREAD_USE_D4 since both have the same effect and the former | |
61 | doesn't invade the users' namespace. */ | |
62 | ||
f326fd7a RH |
63 | #undef CPP_SPEC |
64 | #define CPP_SPEC \ | |
e0322d5c | 65 | "%{pthread|threads:-D_REENTRANT} %{threads:-D_PTHREAD_USE_D4}" |
c04635cc | 66 | |
b0435cf4 RH |
67 | /* Under OSF4, -p and -pg require -lprof1, and -lprof1 requires -lpdf. */ |
68 | ||
c04635cc | 69 | #define LIB_SPEC \ |
5c5d086f RO |
70 | "%{p|pg:-lprof1%{pthread|threads:_r} -lpdf} %{a:-lprof2} \ |
71 | %{threads: -lpthreads} %{pthread|threads: -lpthread -lmach -lexc} -lc" | |
b0435cf4 RH |
72 | |
73 | /* Pass "-G 8" to ld because Alpha's CC does. Pass -O3 if we are | |
cc8475cb RO |
74 | optimizing, -O1 if we are not. Pass -S to silence `weak symbol |
75 | multiply defined' warnings. Pass -shared, -non_shared or | |
f90e86cd RH |
76 | -call_shared as appropriate. Pass -hidden_symbol so that our |
77 | constructor and call-frame data structures are not accidentally | |
78 | overridden. */ | |
b0435cf4 | 79 | #define LINK_SPEC \ |
cc8475cb | 80 | "-G 8 %{O*:-O3} %{!O*:-O1} -S %{static:-non_shared} \ |
f90e86cd RH |
81 | %{!static:%{shared:-shared -hidden_symbol _GLOBAL_*} \ |
82 | %{!shared:-call_shared}} %{pg} %{taso} %{rpath*}" | |
b0435cf4 RH |
83 | |
84 | #define STARTFILE_SPEC \ | |
85 | "%{!shared:%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}" | |
86 | ||
567d20f0 RH |
87 | #define ENDFILE_SPEC \ |
88 | "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}" | |
89 | ||
b0435cf4 RH |
90 | #define MD_STARTFILE_PREFIX "/usr/lib/cmplrs/cc/" |
91 | ||
5076b0ea RO |
92 | /* Tru64 UNIX V5.1 requires a special as flag. Empty by default. */ |
93 | ||
94 | #define ASM_OLDAS_SPEC "" | |
95 | ||
b0435cf4 RH |
96 | /* In OSF/1 v3.2c, the assembler by default does not output file names which |
97 | causes mips-tfile to fail. Passing -g to the assembler fixes this problem. | |
98 | ??? Strictly speaking, we need -g only if the user specifies -g. Passing | |
99 | it always means that we get slightly larger than necessary object files | |
100 | if the user does not specify -g. If we don't pass -g, then mips-tfile | |
101 | will need to be fixed to work in this case. Pass -O0 since some | |
c9045f47 RH |
102 | optimization are broken and don't help us anyway. Pass -nocpp because |
103 | there's no point in running CPP on our assembler output. */ | |
104 | #if ((TARGET_DEFAULT | TARGET_CPU_DEFAULT) & MASK_GAS) != 0 | |
105 | #define ASM_SPEC "%{malpha-as:-g %(asm_oldas) -nocpp %{pg} -O0}" | |
106 | #else | |
107 | #define ASM_SPEC "%{!mgas:-g %(asm_oldas) -nocpp %{pg} -O0}" | |
b0435cf4 RH |
108 | #endif |
109 | ||
110 | /* Specify to run a post-processor, mips-tfile after the assembler | |
111 | has run to stuff the ecoff debug information into the object file. | |
112 | This is needed because the Alpha assembler provides no way | |
113 | of specifying such information in the assembly file. */ | |
114 | ||
115 | #if ((TARGET_DEFAULT | TARGET_CPU_DEFAULT) & MASK_GAS) != 0 | |
116 | ||
117 | #define ASM_FINAL_SPEC "\ | |
118 | %{malpha-as: %{!mno-mips-tfile: \ | |
119 | \n mips-tfile %{v*: -v} \ | |
120 | %{K: -I %b.o~} \ | |
121 | %{!K: %{save-temps: -I %b.o~}} \ | |
122 | %{c:%W{o*}%{!o*:-o %b.o}}%{!c:-o %U.o} \ | |
48137d59 | 123 | %{,assembler:%i;:%g.s}}}" |
b0435cf4 RH |
124 | |
125 | #else | |
126 | #define ASM_FINAL_SPEC "\ | |
127 | %{!mgas: %{!mno-mips-tfile: \ | |
128 | \n mips-tfile %{v*: -v} \ | |
129 | %{K: -I %b.o~} \ | |
130 | %{!K: %{save-temps: -I %b.o~}} \ | |
131 | %{c:%W{o*}%{!o*:-o %b.o}}%{!c:-o %U.o} \ | |
48137d59 | 132 | %{,assembler:%i;:%g.s}}}" |
b0435cf4 RH |
133 | |
134 | #endif | |
9d654bba | 135 | |
f326fd7a RH |
136 | #undef EXTRA_SPECS |
137 | #define EXTRA_SPECS { "asm_oldas", ASM_OLDAS_SPEC } | |
5076b0ea | 138 | |
9d654bba | 139 | /* Indicate that we have a stamp.h to use. */ |
2989d30c | 140 | #ifndef CROSS_DIRECTORY_STRUCTURE |
9d654bba RH |
141 | #define HAVE_STAMP_H 1 |
142 | #endif | |
c714f03d RH |
143 | |
144 | /* Attempt to turn on access permissions for the stack. */ | |
145 | ||
e7a742ec | 146 | #define ENABLE_EXECUTE_STACK \ |
c714f03d | 147 | void \ |
a5c24926 | 148 | __enable_execute_stack (void *addr) \ |
c714f03d | 149 | { \ |
a5c24926 | 150 | extern int mprotect (const void *, size_t, int); \ |
c714f03d RH |
151 | long size = getpagesize (); \ |
152 | long mask = ~(size-1); \ | |
153 | char *page = (char *) (((long) addr) & mask); \ | |
154 | char *end = (char *) ((((long) (addr + TRAMPOLINE_SIZE)) & mask) + size); \ | |
155 | \ | |
156 | /* 7 is PROT_READ | PROT_WRITE | PROT_EXEC */ \ | |
157 | if (mprotect (page, end - page, 7) < 0) \ | |
158 | perror ("mprotect of trampoline code"); \ | |
159 | } | |
54ffbc76 RB |
160 | |
161 | /* Digital UNIX V4.0E (1091)/usr/include/sys/types.h 4.3.49.9 1997/08/14 */ | |
162 | #define SIZE_TYPE "long unsigned int" | |
163 | #define PTRDIFF_TYPE "long int" | |
6dbaddf9 RH |
164 | |
165 | /* The linker will stick __main into the .init section. */ | |
166 | #define HAS_INIT_SECTION | |
167 | #define LD_INIT_SWITCH "-init" | |
168 | #define LD_FINI_SWITCH "-fini" | |
099c8b17 | 169 | |
5076da17 RO |
170 | /* The linker needs a space after "-o". This allows -oldstyle_liblookup to |
171 | be passed to ld. */ | |
172 | #define SWITCHES_NEED_SPACES "o" | |
173 | ||
099c8b17 RH |
174 | /* Select a format to encode pointers in exception handling data. CODE |
175 | is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is | |
176 | true if the symbol may be affected by dynamic relocations. | |
177 | ||
178 | We really ought to be using the SREL32 relocations that ECOFF has, | |
179 | but no version of the native assembler supports creating such things, | |
180 | and Compaq has no plans to rectify this. Worse, the dynamic loader | |
181 | cannot handle unaligned relocations, so we have to make sure that | |
182 | things get padded appropriately. */ | |
183 | #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \ | |
184 | (TARGET_GAS \ | |
185 | ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4) \ | |
186 | : DW_EH_PE_aligned) | |
432fa9f2 RO |
187 | |
188 | /* This is how we tell the assembler that a symbol is weak. */ | |
189 | ||
190 | #define ASM_OUTPUT_WEAK_ALIAS(FILE, NAME, VALUE) \ | |
191 | do \ | |
192 | { \ | |
5eb99654 | 193 | (*targetm.asm_out.globalize_label) (FILE, NAME); \ |
432fa9f2 RO |
194 | fputs ("\t.weakext\t", FILE); \ |
195 | assemble_name (FILE, NAME); \ | |
196 | if (VALUE) \ | |
197 | { \ | |
198 | fputc (' ', FILE); \ | |
199 | assemble_name (FILE, VALUE); \ | |
200 | } \ | |
201 | fputc ('\n', FILE); \ | |
202 | } \ | |
203 | while (0) | |
204 | ||
205 | #define ASM_WEAKEN_LABEL(FILE, NAME) ASM_OUTPUT_WEAK_ALIAS(FILE, NAME, 0) | |
206 | ||
207 | /* Handle #pragma weak and #pragma pack. */ | |
432fa9f2 | 208 | #define HANDLE_SYSV_PRAGMA 1 |
41c64394 RH |
209 | |
210 | /* Handle #pragma extern_prefix. Technically only needed for Tru64 5.x, | |
211 | but easier to manipulate preprocessor bits from here. */ | |
84b8b0e0 | 212 | #define TARGET_HANDLE_PRAGMA_EXTERN_PREFIX 1 |