xref: /netbsd-src/external/gpl3/gcc.old/dist/gcc/config/pa/pa-hpux10.h (revision 8feb0f0b7eaff0608f8350bbfa3098827b4bb91b)
1 /* Definitions of target machine for GNU compiler, for HP PA-RISC
2    Copyright (C) 1995-2020 Free Software Foundation, Inc.
3    Contributed by Tim Moore (moore@defmacro.cs.utah.edu)
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 3, 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 COPYING3.  If not see
19 <http://www.gnu.org/licenses/>.  */
20 
21 /* GCC always defines __STDC__.  HP C++ compilers don't define it.  This
22    causes trouble when sys/stdsyms.h is included.  As a work around,
23    we define __STDC_EXT__.  A similar situation exists with respect to
24    the definition of __cplusplus.  We define _INCLUDE_LONGLONG
25    to prevent nlist.h from defining __STDC_32_MODE__ (no longlong
26    support).  We define __STDCPP__ to get certain system headers
27    (notably assert.h) to assume standard preprocessor behavior in C++.
28    We define _XOPEN_SOURCE_EXTENDED when we define _HPUX_SOURCE to avoid
29    non standard hpux variants in _INCLUDE_XOPEN_SOURCE_EXTENDED.  */
30 #undef TARGET_OS_CPP_BUILTINS
31 #define TARGET_OS_CPP_BUILTINS()					\
32   do									\
33     {									\
34 	builtin_assert ("system=hpux");					\
35 	builtin_assert ("system=unix");					\
36 	builtin_define ("__hp9000s800");				\
37 	builtin_define ("__hp9000s800__");				\
38 	builtin_define ("__hpux");					\
39 	builtin_define ("__hpux__");					\
40 	builtin_define ("__unix");					\
41 	builtin_define ("__unix__");					\
42 	builtin_define ("__STDC_EXT__");				\
43 	if (c_dialect_cxx ())						\
44 	  {								\
45 	    builtin_define ("_HPUX_SOURCE");				\
46 	    builtin_define ("_REENTRANT");				\
47 	    builtin_define ("_INCLUDE_LONGLONG");			\
48 	    builtin_define ("__STDCPP__");				\
49 	    builtin_define ("_LARGEFILE_SOURCE");			\
50 	    builtin_define ("_LARGEFILE64_SOURCE");			\
51 	    if (flag_pa_unix >= 1995)					\
52 	      {								\
53 		builtin_define ("_XOPEN_UNIX");				\
54 		builtin_define ("_XOPEN_SOURCE_EXTENDED");		\
55 	      }								\
56 	  }								\
57 	else if (flag_iso)						\
58 	  {								\
59 	    if (flag_isoc94)						\
60 	      builtin_define ("_INCLUDE__STDC_A1_SOURCE");		\
61 	  }								\
62 	else								\
63 	  {								\
64 	    builtin_define ("_HPUX_SOURCE");				\
65 	    builtin_define ("_REENTRANT");				\
66 	    if (preprocessing_trad_p ())				\
67 	      {								\
68 		builtin_define ("hp9000s800");				\
69 		builtin_define ("hppa");				\
70 		builtin_define ("hpux");				\
71 		builtin_define ("unix");				\
72 		builtin_define ("__CLASSIC_C__");			\
73 		builtin_define ("_PWB");				\
74 		builtin_define ("PWB");					\
75 	      }								\
76 	    if (flag_pa_unix >= 1995)					\
77 	      {								\
78 		builtin_define ("_XOPEN_UNIX");				\
79 		builtin_define ("_XOPEN_SOURCE_EXTENDED");		\
80 	      }								\
81 	  }								\
82 	if (TARGET_SIO)							\
83 	  builtin_define ("_SIO");					\
84 	else								\
85 	  {								\
86 	    builtin_define ("__hp9000s700");				\
87 	    builtin_define ("__hp9000s700__");				\
88 	    builtin_define ("_WSIO");					\
89 	  }								\
90     }									\
91   while (0)
92 
93 #define CPP_SPEC "%{threads: -D_REENTRANT -D_DCE_THREADS}"
94 
95 /* We can debug dynamically linked executables on hpux9; we also want
96    dereferencing of a NULL pointer to cause a SEGV.  */
97 #undef LINK_SPEC
98 #if ((TARGET_DEFAULT | TARGET_CPU_DEFAULT) & MASK_PA_11)
99 #define LINK_SPEC \
100   "%{!mpa-risc-1-0:%{!march=1.0:%{static:-L/lib/pa1.1 -L/usr/lib/pa1.1 }}}\
101    %{!shared:%{p:-L/lib/libp %{!static:\
102      %nwarning: consider linking with '-static' as system libraries with\n\
103      %n  profiling support are only provided in archive format}}}\
104    %{!shared:%{pg:-L/lib/libp %{!static:\
105      %nwarning: consider linking with '-static' as system libraries with\n\
106      %n  profiling support are only provided in archive format}}}\
107    %{!shared:%{!static:%{rdynamic:-E}}}\
108    -z %{mlinker-opt:-O} %{!shared:-u main}\
109    %{static:-a archive} %{shared:-b}"
110 #else
111 #define LINK_SPEC \
112   "%{!shared:%{p:-L/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 %{!static:\
116      %nwarning: consider linking with '-static' as system libraries with\n\
117      %n  profiling support are only provided in archive format}}}\
118    %{!shared:%{!static:%{rdynamic:-E}}}\
119    -z %{mlinker-opt:-O} %{!shared:-u main}\
120    %{static:-a archive} %{shared:-b}"
121 #endif
122 
123 /* Like the default, except no -lg.  */
124 #undef LIB_SPEC
125 #define LIB_SPEC \
126   "%{!shared:\
127      %{!p:%{!pg:\
128        %{!threads:-lc %{static:%{!nolibdld:-a shared -ldld -a archive -lc}}}\
129        %{threads:-lcma -lc}}}\
130      %{p:%{!pg:-lc %{static:%{!nolibdld:-a shared -ldld -a archive -lc}}}}\
131      %{pg:-lc %{static:%{!nolibdld:-a shared -ldld -a archive -lc}}}}"
132 
133 #undef THREAD_MODEL_SPEC
134 #define THREAD_MODEL_SPEC "%{!threads:single}%{threads:dce}"
135 
136 /* Under hpux10, the normal location of the `ld' and `as' programs is the
137    /usr/ccs/bin directory.  */
138 
139 #ifndef CROSS_DIRECTORY_STRUCTURE
140 #undef MD_EXEC_PREFIX
141 #define MD_EXEC_PREFIX "/usr/ccs/bin/"
142 #endif
143 
144 /* Under hpux10, the normal location of the various *crt*.o files is
145    the /usr/ccs/lib directory.  However, the profiling files are in
146    /opt/langtools/lib.  */
147 
148 #ifndef CROSS_DIRECTORY_STRUCTURE
149 #undef MD_STARTFILE_PREFIX
150 #define MD_STARTFILE_PREFIX "/usr/ccs/lib/"
151 #define MD_STARTFILE_PREFIX_1 "/opt/langtools/lib/"
152 #endif
153 
154 /* hpux10 has the new HP assembler.  It's still lousy, but it's a whole lot
155    better than the assembler shipped with older versions of hpux.  */
156 #undef NEW_HP_ASSEMBLER
157 #define NEW_HP_ASSEMBLER 1
158