]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/config/pa/pa-hpux11.h
Update copyright years.
[thirdparty/gcc.git] / gcc / config / pa / pa-hpux11.h
CommitLineData
c219e1da 1/* Definitions of target machine for GNU compiler, for HP PA-RISC
99dee823 2 Copyright (C) 1998-2021 Free Software Foundation, Inc.
fab7be4f 3
b7849684 4This file is part of GCC.
fab7be4f 5
b7849684 6GCC is free software; you can redistribute it and/or modify
fab7be4f 7it under the terms of the GNU General Public License as published by
2f83c7d6 8the Free Software Foundation; either version 3, or (at your option)
fab7be4f
JL
9any later version.
10
b7849684 11GCC is distributed in the hope that it will be useful,
fab7be4f
JL
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
2f83c7d6
NC
17along with GCC; see the file COPYING3. If not see
18<http://www.gnu.org/licenses/>. */
fab7be4f 19
cb99b61a
JDA
20/* GCC always defines __STDC__. HP C++ compilers don't define it. This
21 causes trouble when sys/stdsyms.h is included. As a work around,
22 we define __STDC_EXT__. A similar situation exists with respect to
23 the definition of __cplusplus. We define _INCLUDE_LONGLONG
24 to prevent nlist.h from defining __STDC_32_MODE__ (no longlong
7dd7fb88 25 support). We define __STDCPP__ to get certain system headers
08b5b29e
JDA
26 (notably assert.h) to assume standard preprocessor behavior in C++.
27 We define _XOPEN_SOURCE_EXTENDED when we define _HPUX_SOURCE to avoid
28 non standard hpux variants in _INCLUDE_XOPEN_SOURCE_EXTENDED. */
c219e1da 29#undef TARGET_OS_CPP_BUILTINS
d711cf67
JDA
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__"); \
9a17c91d 41 builtin_define ("__STDC_EXT__"); \
d711cf67
JDA
42 if (c_dialect_cxx ()) \
43 { \
44 builtin_define ("_HPUX_SOURCE"); \
e28c7606 45 builtin_define ("_REENTRANT"); \
d711cf67 46 builtin_define ("_INCLUDE_LONGLONG"); \
d711cf67 47 builtin_define ("__STDCPP__"); \
08b5b29e
JDA
48 builtin_define ("_LARGEFILE_SOURCE"); \
49 builtin_define ("_LARGEFILE64_SOURCE"); \
50 if (flag_pa_unix >= 1995) \
51 { \
52 builtin_define ("_XOPEN_UNIX"); \
53 builtin_define ("_XOPEN_SOURCE_EXTENDED"); \
54 } \
55 if (flag_pa_unix >= 1998) \
d711cf67 56 { \
08b5b29e
JDA
57 builtin_define ("_INCLUDE__STDC_A1_SOURCE"); \
58 builtin_define ("_INCLUDE_XOPEN_SOURCE_500"); \
59 } \
60 if (flag_pa_unix >= 2003) \
61 { \
62 builtin_define ("_INCLUDE_STDC_SOURCE_PRE_199901"); \
63 builtin_define ("_INCLUDE_STDC_SOURCE_199901"); \
64 builtin_define ("_INCLUDE_XOPEN_SOURCE_PRE_500"); \
65 builtin_define ("_INCLUDE_XOPEN_SOURCE_520"); \
66 builtin_define ("_INCLUDE_XOPEN_SOURCE_PRE_600"); \
67 builtin_define ("_INCLUDE_XOPEN_SOURCE_600"); \
d711cf67
JDA
68 } \
69 } \
08b5b29e 70 else if (flag_iso) \
d711cf67 71 { \
08b5b29e
JDA
72 if (flag_isoc94) \
73 builtin_define ("_INCLUDE__STDC_A1_SOURCE"); \
d711cf67 74 } \
08b5b29e 75 else \
d711cf67 76 { \
08b5b29e
JDA
77 builtin_define ("_HPUX_SOURCE"); \
78 builtin_define ("_REENTRANT"); \
79 if (preprocessing_trad_p ()) \
80 { \
81 builtin_define ("hp9000s800"); \
82 builtin_define ("hppa"); \
83 builtin_define ("hpux"); \
84 builtin_define ("unix"); \
85 builtin_define ("__CLASSIC_C__"); \
86 builtin_define ("_PWB"); \
87 builtin_define ("PWB"); \
88 } \
89 if (flag_pa_unix >= 1995) \
90 { \
91 builtin_define ("_XOPEN_UNIX"); \
92 builtin_define ("_XOPEN_SOURCE_EXTENDED"); \
93 } \
d711cf67
JDA
94 if (flag_pa_unix >= 1998) \
95 { \
08b5b29e
JDA
96 builtin_define ("_INCLUDE__STDC_A1_SOURCE"); \
97 builtin_define ("_INCLUDE_XOPEN_SOURCE_500"); \
98 } \
99 if (flag_pa_unix >= 2003) \
100 { \
101 builtin_define ("_INCLUDE_STDC_SOURCE_PRE_199901"); \
102 builtin_define ("_INCLUDE_STDC_SOURCE_199901"); \
103 builtin_define ("_INCLUDE_XOPEN_SOURCE_PRE_500"); \
104 builtin_define ("_INCLUDE_XOPEN_SOURCE_520"); \
105 builtin_define ("_INCLUDE_XOPEN_SOURCE_PRE_600"); \
106 builtin_define ("_INCLUDE_XOPEN_SOURCE_600"); \
d711cf67 107 } \
d711cf67 108 } \
08b5b29e
JDA
109 if (!TARGET_64BIT) \
110 builtin_define ("_ILP32"); \
d711cf67
JDA
111 if (TARGET_SIO) \
112 builtin_define ("_SIO"); \
113 else \
114 { \
115 builtin_define ("__hp9000s700"); \
116 builtin_define ("__hp9000s700__"); \
117 builtin_define ("_WSIO"); \
118 } \
119 } \
c219e1da
JDA
120 while (0)
121
7e2055ec
ZW
122#undef CPP_SPEC
123#define CPP_SPEC \
124 "%{mt|pthread:-D_REENTRANT -D_THREAD_SAFE -D_POSIX_C_SOURCE=199506L}"
125/* aCC defines also -DRWSTD_MULTI_THREAD, -DRW_MULTI_THREAD. These
126 affect only aCC's C++ library (Rogue Wave-derived) which we do not
127 use, and they violate the user's name space. */
128
fab7be4f
JL
129/* We can debug dynamically linked executables on hpux11; we also
130 want dereferencing of a NULL pointer to cause a SEGV. */
131#undef LINK_SPEC
fab7be4f 132#define LINK_SPEC \
8633c315 133 "%{!shared:%{p:-L/lib/libp -L/usr/lib/libp %{!static:\
d8a07487 134 %nwarning: consider linking with '-static' as system libraries with\n\
f48758e4
JDA
135 %n profiling support are only provided in archive format}}}\
136 %{!shared:%{pg:-L/lib/libp -L/usr/lib/libp %{!static:\
d8a07487 137 %nwarning: consider linking with '-static' as system libraries with\n\
f48758e4 138 %n profiling support are only provided in archive format}}}\
70d60e88 139 %{!shared:%{!static:%{rdynamic:-E}}}\
f48758e4 140 -z %{mlinker-opt:-O} %{!shared:-u main -u __gcc_plt_call}\
f401d0f5 141 %{static:-a archive} %{shared:-b}"
fab7be4f 142
90488014
JDA
143/* HP-UX 11 has posix threads. HP's shared libc contains pthread stubs
144 so that non-threaded applications can be linked with a thread-safe
145 libc without a subsequent loss of performance. For more details,
146 see <http://docs.hp.com/en/1896/pthreads.html>. */
fab7be4f
JL
147#undef LIB_SPEC
148#define LIB_SPEC \
149 "%{!shared:\
9dbe3d77 150 %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
41dbbb37 151 %{static:-a archive_shared} -lrt %{static:-a archive}}\
8c157f90 152 %{mt|pthread:-lpthread} -lc\
90488014
JDA
153 %{static:%{!nolibdld:-a archive_shared -ldld -a archive -lc}\
154 %{!mt:%{!pthread:-a shared -lc -a archive}}}}\
4d6f8e56 155 %{shared:%{mt|pthread:-lpthread}}"
fab7be4f 156
d711cf67
JDA
157#undef STARTFILE_SPEC
158#define STARTFILE_SPEC \
159 "%{!shared:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}} \
160 %{!munix=93:unix95%O%s}}"
161
fab7be4f
JL
162/* Under hpux11, the normal location of the `ld' and `as' programs is the
163 /usr/ccs/bin directory. */
164
2989d30c 165#ifndef CROSS_DIRECTORY_STRUCTURE
fab7be4f
JL
166#undef MD_EXEC_PREFIX
167#define MD_EXEC_PREFIX "/usr/ccs/bin/"
168#endif
169
7d4d8603
SE
170/* Under hpux11 the normal location of the various *crt*.o files is
171 the /usr/ccs/lib directory. However, the profiling files are in
172 /opt/langtools/lib. */
fab7be4f 173
2989d30c 174#ifndef CROSS_DIRECTORY_STRUCTURE
fab7be4f
JL
175#undef MD_STARTFILE_PREFIX
176#define MD_STARTFILE_PREFIX "/usr/ccs/lib/"
7d4d8603 177#define MD_STARTFILE_PREFIX_1 "/opt/langtools/lib/"
fab7be4f
JL
178#endif
179
180/* hpux11 has the new HP assembler. It's still lousy, but it's a whole lot
181 better than the assembler shipped with older versions of hpux. */
8d913d99
AM
182#undef NEW_HP_ASSEMBLER
183#define NEW_HP_ASSEMBLER 1
fab7be4f
JL
184
185/* Make GCC agree with types.h. */
186#undef SIZE_TYPE
187#undef PTRDIFF_TYPE
188
189#define SIZE_TYPE "long unsigned int"
190#define PTRDIFF_TYPE "long int"
35d434ed
JDA
191
192/* HP-UX 11.0 and above provides initialization and finalization function
193 support from linker command line. We don't need to invoke __main to run
194 constructors. We also don't need chatr to determine the dependencies of
195 dynamically linked executables and shared libraries. */
196#undef LDD_SUFFIX
197#undef PARSE_LDD_OUTPUT
198#undef HAS_INIT_SECTION
199#define HAS_INIT_SECTION 1
200#undef LD_INIT_SWITCH
201#define LD_INIT_SWITCH "+init"
202#undef LD_FINI_SWITCH
203#define LD_FINI_SWITCH "+fini"
4af6a063
JDA
204
205/* The HP-UX 11.X SOM linker (ld32) can successfully link shared libraries
206 with secondary definition (weak) symbols. */
207#undef TARGET_SOM_SDEF
208#define TARGET_SOM_SDEF 1
dfcb2b51
SE
209
210#undef TARGET_HPUX_11
211#define TARGET_HPUX_11 1