1 /* Definitions of target machine for GNU compiler, for HPs running
2 HPUX using the 64bit runtime model.
3 Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
5 This file is part of GNU CC.
7 GNU CC 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)
12 GNU CC 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 GNU CC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
22 #undef SUBTARGET_SWITCHES
23 #define SUBTARGET_SWITCHES \
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") },
33 /* We can debug dynamically linked executables on hpux11; we also
34 want dereferencing of a NULL pointer to cause a SEGV. */
36 #if ((TARGET_DEFAULT | TARGET_CPU_DEFAULT) & MASK_GNU_LD)
38 "-E %{mlinker-opt:-O} %{!shared:-u main} %{static:-a archive} %{shared:%{mhp-ld:-b}%{!mhp-ld:-shared}} %{mhp-ld:+Accept TypeMismatch}"
41 "-E %{mlinker-opt:-O} %{!shared:-u main} %{static:-a archive} %{shared:%{mgnu-ld:-shared}%{!mgnu-ld:-b}} %{!mgnu-ld:+Accept TypeMismatch}"
44 /* Like the default, except no -lg. */
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"
53 /* Under hpux11, the normal location of the `ld' and `as' programs is the
54 /usr/ccs/bin directory. */
58 #define MD_EXEC_PREFIX "/usr/ccs/bin"
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. */
66 #undef MD_STARTFILE_PREFIX
67 #define MD_STARTFILE_PREFIX "/usr/ccs/lib/pa20_64/"
71 #undef MD_STARTFILE_PREFIX_1
72 #define MD_STARTFILE_PREFIX_1 "/opt/langtools/lib/pa20_64/"
75 /* Due to limitations in the target structure, it isn't currently possible
76 to dynamically switch between the GNU and HP assemblers. */
79 /* Configure selects the standard ELFOS defines for use with GAS. */
82 /* We are using GAS. */
86 #define ASM_FILE_START(FILE) \
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); \
95 fputs("\t.LEVEL 1.0\n", FILE); \
97 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, "_mcount", "function"); \
98 if (write_symbols != NO_DEBUG) \
100 output_file_directive ((FILE), main_input_filename); \
101 fputs ("\t.version\t\"01.01\"\n", FILE); \
105 /* This is how we output a null terminated string. */
107 #define STRING_ASM_OP "\t.stringz\t"
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"
113 #undef ASM_OUTPUT_ALIGNED_COMMON
114 #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
117 assemble_name ((FILE), (NAME)); \
118 fputs ("\t.comm ", (FILE)); \
119 fprintf ((FILE), "%d\n", MAX ((SIZE), ((ALIGN) / BITS_PER_UNIT))); \
122 #undef ASM_OUTPUT_ALIGNED_LOCAL
123 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
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)); \
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
135 /* This is how we globalize a label. */
136 #define GLOBAL_ASM_OP "\t.globl\t"
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) \
142 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \
143 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
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) \
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"); \
157 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
158 TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (DECL)) = save_referenced;\
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
165 #undef ASM_OUTPUT_EXTERNAL_LIBCALL
166 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
168 if (!FUNCTION_NAME_P (XSTR (FUN, 0))) \
169 hppa_encode_label (FUN); \
170 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, XSTR (FUN, 0), "function"); \
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)
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))
182 #else /* USING_ELFOS_H */
184 /* We are not using GAS. */
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
193 /* It looks like DWARF2 will be the easiest debug format to handle on this
195 #define DWARF2_DEBUGGING_INFO 1
196 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
198 /* This target uses the ELF object file format. */
199 #define OBJECT_FORMAT_ELF
201 #undef ASM_FILE_START
202 #define ASM_FILE_START(FILE) \
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); \
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); \
219 fprintf (FILE, "\t.IMPORT _mcount, CODE\n"); \
220 if (write_symbols != NO_DEBUG) \
221 output_file_directive ((FILE), main_input_filename); \
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"
233 #endif /* USING_ELFOS_H */
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
242 #undef INIT_SECTION_ASM_OP
243 #undef FINI_SECTION_ASM_OP
245 #define EH_FRAME_IN_DATA_SECTION 1
248 #define ENDFILE_SPEC ""
250 #undef STARTFILE_SPEC
251 #define STARTFILE_SPEC "%{!shared: %{!symbolic: crt0.o%s}}"
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
260 #define LDD_SUFFIX "/usr/ccs/bin/ldd"
262 /* Skip to first '>' then advance to '/' at the beginning of the filename. */
263 #define PARSE_LDD_OUTPUT(PTR) \
265 while (*PTR != '>') PTR++; \
266 while (*PTR != '/') PTR++; \
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
272 #define INIT_ENVIRONMENT "LD_PXDB=/usr/ccs/bin/size"