* Mainline merge as of 2006-02-16 (@111136).
[official-gcc.git] / gcc / config / pa / pa-hpux11.h
blobad16bb41e3f2cd3ff99cc19785a206cdce3daf45
1 /* Definitions of target machine for GNU compiler, for HP PA-RISC
2 Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004, 2005
3 Free Software Foundation, Inc.
5 This file is part of GCC.
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.
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.
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. */
22 /* GCC always defines __STDC__. HP C++ compilers don't define it. This
23 causes trouble when sys/stdsyms.h is included. As a work around,
24 we define __STDC_EXT__. A similar situation exists with respect to
25 the definition of __cplusplus. We define _INCLUDE_LONGLONG
26 to prevent nlist.h from defining __STDC_32_MODE__ (no longlong
27 support). We define __STDCPP__ to get certain system headers
28 (notably assert.h) to assume standard preprocessor behavior in C++. */
29 #undef TARGET_OS_CPP_BUILTINS
30 #define TARGET_OS_CPP_BUILTINS() \
31 do \
32 { \
33 builtin_assert ("system=hpux"); \
34 builtin_assert ("system=unix"); \
35 builtin_define ("__hp9000s800"); \
36 builtin_define ("__hp9000s800__"); \
37 builtin_define ("__hpux"); \
38 builtin_define ("__hpux__"); \
39 builtin_define ("__unix"); \
40 builtin_define ("__unix__"); \
41 if (c_dialect_cxx ()) \
42 { \
43 builtin_define ("_HPUX_SOURCE"); \
44 builtin_define ("_INCLUDE_LONGLONG"); \
45 builtin_define ("__STDC_EXT__"); \
46 builtin_define ("__STDCPP__"); \
47 } \
48 else \
49 { \
50 if (!flag_iso) \
51 { \
52 builtin_define ("_HPUX_SOURCE"); \
53 if (preprocessing_trad_p ()) \
54 { \
55 builtin_define ("hp9000s800"); \
56 builtin_define ("hppa"); \
57 builtin_define ("hpux"); \
58 builtin_define ("unix"); \
59 builtin_define ("__CLASSIC_C__"); \
60 builtin_define ("_PWB"); \
61 builtin_define ("PWB"); \
62 } \
63 else \
64 builtin_define ("__STDC_EXT__"); \
65 } \
66 } \
67 if (!TARGET_64BIT) \
68 builtin_define ("_ILP32"); \
69 if (flag_pa_unix >= 1995 && !flag_iso) \
70 { \
71 builtin_define ("_XOPEN_UNIX"); \
72 builtin_define ("_XOPEN_SOURCE_EXTENDED"); \
73 } \
74 if (TARGET_HPUX_11_11) \
75 { \
76 if (flag_pa_unix >= 1998) \
77 { \
78 if (flag_isoc94 || flag_isoc99 || c_dialect_cxx() \
79 || !flag_iso) \
80 builtin_define ("_INCLUDE__STDC_A1_SOURCE"); \
81 if (!flag_iso) \
82 builtin_define ("_INCLUDE_XOPEN_SOURCE_500"); \
83 } \
84 else if (flag_isoc94 || flag_isoc99 || c_dialect_cxx ()) \
85 warning (0, "-munix=98 option required for C89 " \
86 "Amendment 1 features.\n"); \
87 } \
88 if (TARGET_SIO) \
89 builtin_define ("_SIO"); \
90 else \
91 { \
92 builtin_define ("__hp9000s700"); \
93 builtin_define ("__hp9000s700__"); \
94 builtin_define ("_WSIO"); \
95 } \
96 } \
97 while (0)
99 #undef CPP_SPEC
100 #define CPP_SPEC \
101 "%{mt|pthread:-D_REENTRANT -D_THREAD_SAFE -D_POSIX_C_SOURCE=199506L}"
102 /* aCC defines also -DRWSTD_MULTI_THREAD, -DRW_MULTI_THREAD. These
103 affect only aCC's C++ library (Rogue Wave-derived) which we do not
104 use, and they violate the user's name space. */
106 /* We can debug dynamically linked executables on hpux11; we also
107 want dereferencing of a NULL pointer to cause a SEGV. */
108 #undef LINK_SPEC
109 #if ((TARGET_DEFAULT | TARGET_CPU_DEFAULT) & MASK_PA_11)
110 #define LINK_SPEC \
111 "%{!mpa-risc-1-0:%{!march=1.0:%{!shared:-L/lib/pa1.1 -L/usr/lib/pa1.1 }}}\
112 %{!shared:%{p:-L/lib/libp -L/usr/lib/libp %{!static:\
113 %nWarning: consider linking with `-static' as system libraries with\n\
114 %n profiling support are only provided in archive format}}}\
115 %{!shared:%{pg:-L/lib/libp -L/usr/lib/libp %{!static:\
116 %nWarning: consider linking with `-static' as system libraries with\n\
117 %n profiling support are only provided in archive format}}}\
118 -z %{mlinker-opt:-O} %{!shared:-u main -u __gcc_plt_call}\
119 %{static:-a archive} %{shared:-b}"
120 #else
121 #define LINK_SPEC \
122 "%{!shared:%{p:-L/lib/libp -L/usr/lib/libp %{!static:\
123 %nWarning: consider linking with `-static' as system libraries with\n\
124 %n profiling support are only provided in archive format}}}\
125 %{!shared:%{pg:-L/lib/libp -L/usr/lib/libp %{!static:\
126 %nWarning: consider linking with `-static' as system libraries with\n\
127 %n profiling support are only provided in archive format}}}\
128 -z %{mlinker-opt:-O} %{!shared:-u main -u __gcc_plt_call}\
129 %{static:-a archive} %{shared:-b}"
130 #endif
132 /* hpux 11 has posix threads. */
133 #undef LIB_SPEC
134 #define LIB_SPEC \
135 "%{!shared:\
136 %{mt|pthread:-lpthread} -lc \
137 %{static:%{!nolibdld:-a shared -ldld -a archive -lpthread -lc}}}"
139 #undef STARTFILE_SPEC
140 #define STARTFILE_SPEC \
141 "%{!shared:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}} \
142 %{!munix=93:unix95%O%s}}"
144 /* Under hpux11, the normal location of the `ld' and `as' programs is the
145 /usr/ccs/bin directory. */
147 #ifndef CROSS_COMPILE
148 #undef MD_EXEC_PREFIX
149 #define MD_EXEC_PREFIX "/usr/ccs/bin/"
150 #endif
152 /* Under hpux11 the normal location of the various *crt*.o files is
153 the /usr/ccs/lib directory. However, the profiling files are in
154 /opt/langtools/lib. */
156 #ifndef CROSS_COMPILE
157 #undef MD_STARTFILE_PREFIX
158 #define MD_STARTFILE_PREFIX "/usr/ccs/lib/"
159 #define MD_STARTFILE_PREFIX_1 "/opt/langtools/lib/"
160 #endif
162 /* hpux11 has the new HP assembler. It's still lousy, but it's a whole lot
163 better than the assembler shipped with older versions of hpux. */
164 #undef NEW_HP_ASSEMBLER
165 #define NEW_HP_ASSEMBLER 1
167 /* Make GCC agree with types.h. */
168 #undef SIZE_TYPE
169 #undef PTRDIFF_TYPE
171 #define SIZE_TYPE "long unsigned int"
172 #define PTRDIFF_TYPE "long int"
174 /* HP-UX 11.0 and above provides initialization and finalization function
175 support from linker command line. We don't need to invoke __main to run
176 constructors. We also don't need chatr to determine the dependencies of
177 dynamically linked executables and shared libraries. */
178 #undef LDD_SUFFIX
179 #undef PARSE_LDD_OUTPUT
180 #undef HAS_INIT_SECTION
181 #define HAS_INIT_SECTION 1
182 #undef LD_INIT_SWITCH
183 #define LD_INIT_SWITCH "+init"
184 #undef LD_FINI_SWITCH
185 #define LD_FINI_SWITCH "+fini"
187 /* The HP-UX 11.X SOM linker (ld32) can successfully link shared libraries
188 with secondary definition (weak) symbols. */
189 #undef TARGET_SOM_SDEF
190 #define TARGET_SOM_SDEF 1