]> gcc.gnu.org Git - gcc.git/blame - gcc/config/pa/pa64-hpux.h
pa.h (STARTING_FRAME_OFFSET): Change offset for TARGET_64BIT to 16.
[gcc.git] / gcc / config / pa / pa64-hpux.h
CommitLineData
a7e184fc
AM
1/* Definitions of target machine for GNU compiler, for HPs running
2 HPUX using the 64bit runtime model.
85e79f96 3 Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
a7e184fc
AM
4
5This file is part of GNU CC.
6
7GNU CC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
12GNU CC is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU CC; see the file COPYING. If not, write to
19the Free Software Foundation, 59 Temple Place - Suite 330,
20Boston, MA 02111-1307, USA. */
21
83eb95f9
SE
22#undef SUBTARGET_SWITCHES
23#define SUBTARGET_SWITCHES \
24 { "sio", MASK_SIO, \
25 N_("Generate cpp defines for server IO") }, \
26 { "wsio", -MASK_SIO, \
27 N_("Generate cpp defines for workstation IO") }, \
28 {"gnu-ld", MASK_GNU_LD, \
29 N_("Assume code will be linked by GNU ld") }, \
30 {"hp-ld", -MASK_GNU_LD, \
31 N_("Assume code will be linked by HP ld") },
32
a7e184fc
AM
33/* We can debug dynamically linked executables on hpux11; we also
34 want dereferencing of a NULL pointer to cause a SEGV. */
35#undef LINK_SPEC
83eb95f9
SE
36#if ((TARGET_DEFAULT | TARGET_CPU_DEFAULT) & MASK_GNU_LD)
37#define LINK_SPEC \
38 "-E %{mlinker-opt:-O} %{!shared:-u main} %{static:-a archive} %{shared:%{mhp-ld:-b}%{!mhp-ld:-shared}} %{mhp-ld:+Accept TypeMismatch}"
39#else
a7e184fc 40#define LINK_SPEC \
83eb95f9
SE
41 "-E %{mlinker-opt:-O} %{!shared:-u main} %{static:-a archive} %{shared:%{mgnu-ld:-shared}%{!mgnu-ld:-b}} %{!mgnu-ld:+Accept TypeMismatch}"
42#endif
a7e184fc
AM
43
44/* Like the default, except no -lg. */
45#undef LIB_SPEC
46#define LIB_SPEC \
47 "%{!shared:\
48 %{!p:\
a9b11d44
JDA
49 %{!pg: %{!threads:-lc} %{threads:-lcma -lc_r}}\
50 %{pg: -L/usr/lib/pa20_64/libp/ -lgprof -lc}}\
51 %{p: -L/usr/lib/pa20_64/libp/ -lprof -lc}} /usr/lib/pa20_64/milli.a"
a7e184fc
AM
52
53/* Under hpux11, the normal location of the `ld' and `as' programs is the
54 /usr/ccs/bin directory. */
55
56#ifndef CROSS_COMPILE
57#undef MD_EXEC_PREFIX
85e79f96 58#define MD_EXEC_PREFIX "/usr/ccs/bin"
a7e184fc
AM
59#endif
60
85e79f96
JDA
61/* Under hpux11 the normal location of the various pa20_64 *crt*.o files
62 is the /usr/ccs/lib/pa20_64 directory. Some files may also be in the
63 /opt/langtools/lib/pa20_64 directory. */
a7e184fc
AM
64
65#ifndef CROSS_COMPILE
66#undef MD_STARTFILE_PREFIX
85e79f96
JDA
67#define MD_STARTFILE_PREFIX "/usr/ccs/lib/pa20_64/"
68#endif
69
70#ifndef CROSS_COMPILE
71#undef MD_STARTFILE_PREFIX_1
72#define MD_STARTFILE_PREFIX_1 "/opt/langtools/lib/pa20_64/"
a7e184fc
AM
73#endif
74
581d9404
JDA
75/* Due to limitations in the target structure, it isn't currently possible
76 to dynamically switch between the GNU and HP assemblers. */
77#undef TARGET_GAS
78
79/* Configure selects the standard ELFOS defines for use with GAS. */
80#ifdef USING_ELFOS_H
81
82/* We are using GAS. */
83#define TARGET_GAS 1
a7e184fc
AM
84
85#undef ASM_FILE_START
86#define ASM_FILE_START(FILE) \
581d9404
JDA
87do { \
88 if (TARGET_64BIT) \
89 fputs("\t.LEVEL 2.0w\n", FILE); \
90 else if (TARGET_PA_20) \
91 fputs("\t.LEVEL 2.0\n", FILE); \
92 else if (TARGET_PA_11) \
93 fputs("\t.LEVEL 1.1\n", FILE); \
94 else \
95 fputs("\t.LEVEL 1.0\n", FILE); \
96 if (profile_flag) \
97 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, "_mcount", "function"); \
98 if (write_symbols != NO_DEBUG) \
99 { \
100 output_file_directive ((FILE), main_input_filename); \
101 fputs ("\t.version\t\"01.01\"\n", FILE); \
102 } \
103} while (0)
104
105/* This is how we output a null terminated string. */
106#undef STRING_ASM_OP
107#define STRING_ASM_OP "\t.stringz\t"
108
109#define TEXT_SECTION_ASM_OP "\t.text"
110#define DATA_SECTION_ASM_OP "\t.data"
111#define BSS_SECTION_ASM_OP "\t.section\t.bss"
112
113#undef ASM_OUTPUT_ALIGNED_COMMON
114#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
115do { \
116 bss_section (); \
117 assemble_name ((FILE), (NAME)); \
118 fputs ("\t.comm ", (FILE)); \
119 fprintf ((FILE), "%d\n", MAX ((SIZE), ((ALIGN) / BITS_PER_UNIT))); \
120} while (0)
121
122#undef ASM_OUTPUT_ALIGNED_LOCAL
123#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
124do { \
125 bss_section (); \
126 fprintf ((FILE), "\t.align %d\n", ((ALIGN) / BITS_PER_UNIT)); \
127 assemble_name ((FILE), (NAME)); \
128 fprintf ((FILE), "\n\t.block %d\n", (SIZE)); \
129} while (0)
130
131/* The define in pa.h doesn't work with the alias attribute. The
132 default is ok with the following define for GLOBAL_ASM_OP. */
133#undef TARGET_ASM_GLOBALIZE_LABEL
134
135/* This is how we globalize a label. */
136#define GLOBAL_ASM_OP "\t.globl\t"
137
138/* Hacked version from elfos.h that doesn't output a label. */
139#undef ASM_DECLARE_FUNCTION_NAME
140#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
141do { \
142 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \
143 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
144} while (0)
145
146/* The type of external references must be set correctly for the
147 dynamic loader to work correctly. This is equivalent to the
148 HP assembler's .IMPORT directive but relates more directly to
149 ELF object file types. */
150#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
151do { \
152 int save_referenced; \
153 save_referenced = TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (DECL));\
154 if (FUNCTION_NAME_P (NAME)) \
155 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \
156 else \
157 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
158 TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (DECL)) = save_referenced;\
159} while (0)
160
161/* We need set the type for external libcalls. Also note that not all
162 libcall names are passed to targetm.encode_section_info (e.g., __main).
163 Thus, we also have to do the section encoding if it hasn't been done
164 already. */
165#undef ASM_OUTPUT_EXTERNAL_LIBCALL
166#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
167do { \
168 if (!FUNCTION_NAME_P (XSTR (FUN, 0))) \
169 hppa_encode_label (FUN); \
170 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, XSTR (FUN, 0), "function"); \
171} while (0)
172
173/* We need to use the HP style for internal labels. */
174#undef ASM_OUTPUT_INTERNAL_LABEL
175#define ASM_OUTPUT_INTERNAL_LABEL(FILE, PREFIX, NUM) \
176 fprintf (FILE, "%c$%s%04d\n", (PREFIX)[0], (PREFIX) + 1, NUM)
177
178#undef ASM_GENERATE_INTERNAL_LABEL
179#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
180 sprintf (LABEL, "*%c$%s%04ld", (PREFIX)[0], (PREFIX) + 1, (long)(NUM))
181
182#else /* USING_ELFOS_H */
183
184/* We are not using GAS. */
185#define TARGET_GAS 0
186
187/* HPUX 11 has the "new" HP assembler. It's still lousy, but it's a whole
188 lot better than the assembler shipped with older versions of hpux.
189 However, it doesn't support weak symbols and is a bad fit with ELF. */
190#undef NEW_HP_ASSEMBLER
191#define NEW_HP_ASSEMBLER 1
a7e184fc
AM
192
193/* It looks like DWARF2 will be the easiest debug format to handle on this
194 platform. */
23532de9 195#define DWARF2_DEBUGGING_INFO 1
a7e184fc 196#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
a7e184fc 197
581d9404
JDA
198/* This target uses the ELF object file format. */
199#define OBJECT_FORMAT_ELF
a7e184fc 200
581d9404
JDA
201#undef ASM_FILE_START
202#define ASM_FILE_START(FILE) \
203do { \
204 if (TARGET_64BIT) \
205 fputs("\t.LEVEL 2.0w\n", FILE); \
206 else if (TARGET_PA_20) \
207 fputs("\t.LEVEL 2.0\n", FILE); \
208 else if (TARGET_PA_11) \
209 fputs("\t.LEVEL 1.1\n", FILE); \
210 else \
211 fputs("\t.LEVEL 1.0\n", FILE); \
212 fputs("\t.SPACE $PRIVATE$,SORT=16\n\
213\t.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31\n\
214\t.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82\n\
215\t.SPACE $TEXT$,SORT=8\n\
216\t.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44\n\
217\t.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY\n", FILE); \
218 if (profile_flag) \
219 fprintf (FILE, "\t.IMPORT _mcount, CODE\n"); \
220 if (write_symbols != NO_DEBUG) \
221 output_file_directive ((FILE), main_input_filename); \
222} while (0)
a7e184fc 223
581d9404
JDA
224#undef TEXT_SECTION_ASM_OP
225#define TEXT_SECTION_ASM_OP "\t.SUBSPA $CODE$\n"
226#undef READONLY_DATA_SECTION_ASM_OP
227#define READONLY_DATA_SECTION_ASM_OP "\t.SUBSPA $LIT$\n"
228#undef DATA_SECTION_ASM_OP
229#define DATA_SECTION_ASM_OP "\t.SUBSPA $DATA$\n"
230#undef BSS_SECTION_ASM_OP
231#define BSS_SECTION_ASM_OP "\t.SUBSPA $BSS$\n"
a7e184fc 232
581d9404 233#endif /* USING_ELFOS_H */
a7e184fc 234
85e79f96
JDA
235/* For the time being, we aren't using init sections. `P' relocations
236 are currently used for function references. However, P relocations are
237 treated as data references and data references are bound by dld.sl
238 immediately at program startup. This causes an abort due to undefined
239 weak symbols in crtbegin.o (e.g., __register_frame_info). Possibly
240 Q relocations might avoid this problem but the GNU assembler doesn't
241 support them. */
581d9404
JDA
242#undef INIT_SECTION_ASM_OP
243#undef FINI_SECTION_ASM_OP
244
85e79f96
JDA
245#define EH_FRAME_IN_DATA_SECTION 1
246
247#undef ENDFILE_SPEC
248#define ENDFILE_SPEC ""
249
250#undef STARTFILE_SPEC
a9b11d44 251#define STARTFILE_SPEC "%{!shared: %{!symbolic: crt0.o%s}}"
81e5bc3d
JDA
252
253/* Since we are not yet using .init and .fini sections, we need to
254 explicitly arrange to run the global constructors and destructors.
255 HPUX 11 has ldd and we use it to determine the dependencies of
256 dynamic objects. It might be possible to use the ld options for
257 running initializers and terminators and thereby avoid the necessity
258 of running ldd, but unfortunately the options are different for
259 the two linkers. */
260#define LDD_SUFFIX "/usr/ccs/bin/ldd"
581d9404 261
81e5bc3d
JDA
262/* Skip to first '>' then advance to '/' at the beginning of the filename. */
263#define PARSE_LDD_OUTPUT(PTR) \
264do { \
265 while (*PTR != '>') PTR++; \
266 while (*PTR != '/') PTR++; \
267} while (0)
882affa8
SE
268
269/* If using HP ld do not call pxdb. Use size as a program that does nothing
270 and returns 0. /bin/true cannot be used because it is a script without
271 an interpreter. */
272#define INIT_ENVIRONMENT "LD_PXDB=/usr/ccs/bin/size"
This page took 0.438272 seconds and 5 git commands to generate.