xref: /openbsd-src/gnu/usr.bin/gcc/gcc/config/pa/pa-hpux11.h (revision c87b03e512fc05ed6e0222f6fb0ae86264b1d05b)
1 /* Definitions of target machine for GNU compiler, for HP PA-RISC
2    Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
3 
4 This file is part of GNU CC.
5 
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10 
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING.  If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA.  */
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).  */
27 #undef TARGET_OS_CPP_BUILTINS
28 #define TARGET_OS_CPP_BUILTINS()				\
29   do								\
30     {								\
31 	builtin_assert ("system=hpux");				\
32 	builtin_assert ("system=unix");				\
33 	builtin_define ("__hp9000s800");			\
34 	builtin_define ("__hp9000s800__");			\
35 	builtin_define ("__hpux");				\
36 	builtin_define ("__hpux__");				\
37 	builtin_define ("__unix");				\
38 	builtin_define ("__unix__");				\
39 	if (c_language == clk_cplusplus)			\
40 	  {							\
41 	    builtin_define ("_HPUX_SOURCE");			\
42 	    builtin_define ("_INCLUDE_LONGLONG");		\
43 	    builtin_define ("__STDC_EXT__");			\
44 	  }							\
45 	else							\
46 	  {							\
47 	    if (!flag_iso)					\
48 	      {							\
49 		builtin_define ("_HPUX_SOURCE");		\
50 		if (preprocessing_trad_p ())			\
51 		  {						\
52 		    builtin_define ("hp9000s800");		\
53 		    builtin_define ("hppa");			\
54 		    builtin_define ("hpux");			\
55 		    builtin_define ("unix");			\
56 		    builtin_define ("__CLASSIC_C__");		\
57 		    builtin_define ("_PWB");			\
58 		    builtin_define ("PWB");			\
59 		  }						\
60 		else						\
61 		  builtin_define ("__STDC_EXT__");		\
62 	      }							\
63 	    if (!TARGET_64BIT)					\
64 	      builtin_define ("_ILP32");			\
65 	  }							\
66 	if (TARGET_SIO)						\
67 	  builtin_define ("_SIO");				\
68 	else							\
69 	  {							\
70 	    builtin_define ("__hp9000s700");			\
71 	    builtin_define ("__hp9000s700__");			\
72 	    builtin_define ("_WSIO");				\
73 	  }							\
74     }								\
75   while (0)
76 
77 #undef CPP_SPEC
78 #define CPP_SPEC \
79   "%{mt|pthread:-D_REENTRANT -D_THREAD_SAFE -D_POSIX_C_SOURCE=199506L}"
80 /* aCC defines also -DRWSTD_MULTI_THREAD, -DRW_MULTI_THREAD.  These
81    affect only aCC's C++ library (Rogue Wave-derived) which we do not
82    use, and they violate the user's name space.  */
83 
84 /* We can debug dynamically linked executables on hpux11; we also
85    want dereferencing of a NULL pointer to cause a SEGV.  */
86 #undef LINK_SPEC
87 #if ((TARGET_DEFAULT | TARGET_CPU_DEFAULT) & 1)
88 #define LINK_SPEC \
89   "%{!mpa-risc-1-0:%{!shared:-L/lib/pa1.1 -L/usr/lib/pa1.1 }} -z\
90    %{mlinker-opt:-O} %{!shared:-u main -u __gcc_plt_call}\
91    %{static:-a archive} %{shared:-b}"
92 #else
93 #define LINK_SPEC \
94   "-z %{mlinker-opt:-O} %{!shared:-u main -u __gcc_plt_call}\
95    %{static:-a archive} %{shared:-b}"
96 #endif
97 
98 /* hpux 11 has posix threads.  */
99 #undef LIB_SPEC
100 #define LIB_SPEC \
101   "%{!shared:\
102      %{mt|pthread:-lpthread}     \
103      %{p|pg:-L/usr/lib/libp} -lc \
104      %{static:%{!nolibdld:-a shared -ldld -a archive -lc}}}"
105 
106 /* Under hpux11, the normal location of the `ld' and `as' programs is the
107    /usr/ccs/bin directory.  */
108 
109 #ifndef CROSS_COMPILE
110 #undef MD_EXEC_PREFIX
111 #define MD_EXEC_PREFIX "/usr/ccs/bin/"
112 #endif
113 
114 /* Under hpux11 the normal location of the various *crt*.o files is
115    the /usr/ccs/lib directory.  However, the profiling files are in
116    /opt/langtools/lib.  */
117 
118 #ifndef CROSS_COMPILE
119 #undef MD_STARTFILE_PREFIX
120 #define MD_STARTFILE_PREFIX "/usr/ccs/lib/"
121 #define MD_STARTFILE_PREFIX_1 "/opt/langtools/lib/"
122 #endif
123 
124 /* hpux11 has the new HP assembler.  It's still lousy, but it's a whole lot
125    better than the assembler shipped with older versions of hpux.  */
126 #undef NEW_HP_ASSEMBLER
127 #define NEW_HP_ASSEMBLER 1
128 
129 /* Make GCC agree with types.h.  */
130 #undef SIZE_TYPE
131 #undef PTRDIFF_TYPE
132 
133 #define SIZE_TYPE "long unsigned int"
134 #define PTRDIFF_TYPE "long int"
135 
136 /* HP-UX 11.0 and above provides initialization and finalization function
137    support from linker command line.  We don't need to invoke __main to run
138    constructors.  We also don't need chatr to determine the dependencies of
139    dynamically linked executables and shared libraries.  */
140 #undef LDD_SUFFIX
141 #undef PARSE_LDD_OUTPUT
142 #undef HAS_INIT_SECTION
143 #define HAS_INIT_SECTION 1
144 #undef LD_INIT_SWITCH
145 #define LD_INIT_SWITCH "+init"
146 #undef LD_FINI_SWITCH
147 #define LD_FINI_SWITCH "+fini"
148 
149 /* The HP-UX 11.X SOM linker (ld32) can successfully link shared libraries
150    with secondary definition (weak) symbols.  */
151 #undef TARGET_SOM_SDEF
152 #define TARGET_SOM_SDEF 1
153