OSDN Git Service

* gcc.c (set_collect_gcc_options): New function, split out from
[pf3gnuchains/gcc-fork.git] / gcc / config / alpha / osf.h
1 /* Definitions of target machine for GNU compiler, for DEC Alpha on OSF/1.
2    Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2001
3    Free Software Foundation, Inc.
4    Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
5
6 This file is part of GNU CC.
7
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 GNU CC is distributed in the hope that it will be useful,
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
19 along with GNU CC; see the file COPYING.  If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA.  */
22
23 /* As of OSF 4.0, as can subtract adjacent labels.  */
24
25 #undef TARGET_AS_CAN_SUBTRACT_LABELS
26 #define TARGET_AS_CAN_SUBTRACT_LABELS 1
27
28 /* The GEM libraries for X_float are present, though not used by C.  */
29
30 #undef TARGET_HAS_XFLOATING_LIBS
31 #define TARGET_HAS_XFLOATING_LIBS 1
32
33 /* Names to predefine in the preprocessor for this target machine.  */
34
35 #define CPP_PREDEFINES "\
36 -Dunix -D__osf__ -D_LONGLONG -DSYSTYPE_BSD \
37 -D_SYSTYPE_BSD -Asystem=unix -Asystem=xpg4"
38
39 /* Tru64 UNIX V5 requires additional definitions for 16 byte long double
40    support.  Empty by default.  */
41
42 #define CPP_XFLOAT_SPEC ""
43
44 /* Accept DEC C flags for multithreaded programs.  We use _PTHREAD_USE_D4
45    instead of PTHREAD_USE_D4 since both have the same effect and the former
46    doesn't invade the users' namespace.  */
47
48 #undef CPP_SUBTARGET_SPEC
49 #define CPP_SUBTARGET_SPEC \
50 "%{pthread|threads:-D_REENTRANT} %{threads:-D_PTHREAD_USE_D4} %(cpp_xfloat)"
51
52 /* Under OSF4, -p and -pg require -lprof1, and -lprof1 requires -lpdf.  */
53
54 #define LIB_SPEC \
55 "%{p|pg:-lprof1%{pthread|threads:_r} -lpdf} %{a:-lprof2} \
56  %{threads: -lpthreads} %{pthread|threads: -lpthread -lmach -lexc} -lc"
57
58 /* Pass "-G 8" to ld because Alpha's CC does.  Pass -O3 if we are
59    optimizing, -O1 if we are not.  Pass -shared, -non_shared or
60    -call_shared as appropriate.  Pass -hidden_symbol so that our
61    constructor and call-frame data structures are not accidentally
62    overridden.  */
63 #define LINK_SPEC  \
64   "-G 8 %{O*:-O3} %{!O*:-O1} %{static:-non_shared} \
65    %{!static:%{shared:-shared -hidden_symbol _GLOBAL_*} \
66    %{!shared:-call_shared}} %{pg} %{taso} %{rpath*}"
67
68 #define STARTFILE_SPEC  \
69   "%{!shared:%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}"
70
71 #define ENDFILE_SPEC \
72   "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}"
73
74 #define MD_STARTFILE_PREFIX "/usr/lib/cmplrs/cc/"
75
76 #define ASM_FILE_START(FILE)                                    \
77 {                                                               \
78   alpha_write_verstamp (FILE);                                  \
79   fprintf (FILE, "\t.set noreorder\n");                         \
80   fprintf (FILE, "\t.set volatile\n");                          \
81   fprintf (FILE, "\t.set noat\n");                              \
82   if (TARGET_SUPPORT_ARCH)                                      \
83     fprintf (FILE, "\t.arch %s\n",                              \
84              TARGET_CPU_EV6 ? "ev6"                             \
85              : (TARGET_CPU_EV5                                  \
86                 ? (TARGET_MAX ? "pca56" : TARGET_BWX ? "ev56" : "ev5") \
87                 : "ev4"));                                      \
88                                                                 \
89   ASM_OUTPUT_SOURCE_FILENAME (FILE, main_input_filename);       \
90 }
91
92 /* Tru64 UNIX V5.1 requires a special as flag.  Empty by default.  */
93
94 #define ASM_OLDAS_SPEC ""
95
96 /* No point in running CPP on our assembler output.  */
97 #if ((TARGET_DEFAULT | TARGET_CPU_DEFAULT) & MASK_GAS) != 0
98 /* Don't pass -g to GNU as, because some versions don't accept this option.  */
99 #define ASM_SPEC "%{malpha-as:-g %(asm_oldas)} -nocpp %{pg}"
100 #else
101 /* In OSF/1 v3.2c, the assembler by default does not output file names which
102    causes mips-tfile to fail.  Passing -g to the assembler fixes this problem.
103    ??? Strictly speaking, we need -g only if the user specifies -g.  Passing
104    it always means that we get slightly larger than necessary object files
105    if the user does not specify -g.  If we don't pass -g, then mips-tfile
106    will need to be fixed to work in this case.  Pass -O0 since some
107    optimization are broken and don't help us anyway.  */
108 #define ASM_SPEC "%{!mgas:-g %(asm_oldas)} -nocpp %{pg} -O0"
109 #endif
110
111 /* Specify to run a post-processor, mips-tfile after the assembler
112    has run to stuff the ecoff debug information into the object file.
113    This is needed because the Alpha assembler provides no way
114    of specifying such information in the assembly file.  */
115
116 #if ((TARGET_DEFAULT | TARGET_CPU_DEFAULT) & MASK_GAS) != 0
117
118 #define ASM_FINAL_SPEC "\
119 %{malpha-as: %{!mno-mips-tfile: \
120         \n mips-tfile %{v*: -v} \
121                 %{K: -I %b.o~} \
122                 %{!K: %{save-temps: -I %b.o~}} \
123                 %{c:%W{o*}%{!o*:-o %b.o}}%{!c:-o %U.o} \
124                 %{.s:%i} %{!.s:%U.s}}}"
125
126 #else
127 #define ASM_FINAL_SPEC "\
128 %{!mgas: %{!mno-mips-tfile: \
129         \n mips-tfile %{v*: -v} \
130                 %{K: -I %b.o~} \
131                 %{!K: %{save-temps: -I %b.o~}} \
132                 %{c:%W{o*}%{!o*:-o %b.o}}%{!c:-o %U.o} \
133                 %{.s:%i} %{!.s:%U.s}}}"
134
135 #endif
136
137 #undef SUBTARGET_EXTRA_SPECS
138 #define SUBTARGET_EXTRA_SPECS           \
139   { "cpp_xfloat", CPP_XFLOAT_SPEC },    \
140   { "asm_oldas", ASM_OLDAS_SPEC }
141
142 /* Indicate that we have a stamp.h to use.  */
143 #ifndef CROSS_COMPILE
144 #define HAVE_STAMP_H 1
145 #endif
146
147 /* Attempt to turn on access permissions for the stack.  */
148
149 #define TRANSFER_FROM_TRAMPOLINE                                        \
150 extern void __enable_execute_stack PARAMS ((void *));                   \
151                                                                         \
152 void                                                                    \
153 __enable_execute_stack (addr)                                           \
154      void *addr;                                                        \
155 {                                                                       \
156   extern int mprotect PARAMS ((const void *, size_t, int));             \
157   long size = getpagesize ();                                           \
158   long mask = ~(size-1);                                                \
159   char *page = (char *) (((long) addr) & mask);                         \
160   char *end  = (char *) ((((long) (addr + TRAMPOLINE_SIZE)) & mask) + size); \
161                                                                         \
162   /* 7 is PROT_READ | PROT_WRITE | PROT_EXEC */                         \
163   if (mprotect (page, end - page, 7) < 0)                               \
164     perror ("mprotect of trampoline code");                             \
165 }
166
167 /* Digital UNIX V4.0E (1091)/usr/include/sys/types.h 4.3.49.9 1997/08/14 */
168 #define SIZE_TYPE       "long unsigned int"
169 #define PTRDIFF_TYPE    "long int"
170
171 /* The linker will stick __main into the .init section.  */
172 #define HAS_INIT_SECTION
173 #define LD_INIT_SWITCH "-init"
174 #define LD_FINI_SWITCH "-fini"
175
176 /* Select a format to encode pointers in exception handling data.  CODE
177    is 0 for data, 1 for code labels, 2 for function pointers.  GLOBAL is
178    true if the symbol may be affected by dynamic relocations.
179    
180    We really ought to be using the SREL32 relocations that ECOFF has,
181    but no version of the native assembler supports creating such things,
182    and Compaq has no plans to rectify this.  Worse, the dynamic loader
183    cannot handle unaligned relocations, so we have to make sure that
184    things get padded appropriately.  */
185 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL)                            \
186   (TARGET_GAS                                                                \
187    ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4) \
188    : DW_EH_PE_aligned)
189
190 /* This is how we tell the assembler that a symbol is weak.  */
191
192 #define ASM_OUTPUT_WEAK_ALIAS(FILE, NAME, VALUE)        \
193   do                                                    \
194     {                                                   \
195       ASM_GLOBALIZE_LABEL (FILE, NAME);                 \
196       fputs ("\t.weakext\t", FILE);                     \
197       assemble_name (FILE, NAME);                       \
198       if (VALUE)                                        \
199         {                                               \
200           fputc (' ', FILE);                            \
201           assemble_name (FILE, VALUE);                  \
202         }                                               \
203       fputc ('\n', FILE);                               \
204     }                                                   \
205   while (0)
206
207 #define ASM_WEAKEN_LABEL(FILE, NAME) ASM_OUTPUT_WEAK_ALIAS(FILE, NAME, 0)
208
209 /* Handle #pragma weak and #pragma pack.  */
210 #undef HANDLE_SYSV_PRAGMA
211 #define HANDLE_SYSV_PRAGMA 1