OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [config/] [pa/] [pa64-hpux.h] - Blame information for rev 853

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
/* Definitions of target machine for GNU compiler, for HPs running
2
   HPUX using the 64bit runtime model.
3
   Copyright (C) 1999, 2000, 2001, 2002, 2004, 2005, 2007 Free Software Foundation,
4
   Inc.
5
 
6
This file is part of GCC.
7
 
8
GCC is free software; you can redistribute it and/or modify
9
it under the terms of the GNU General Public License as published by
10
the Free Software Foundation; either version 3, or (at your option)
11
any later version.
12
 
13
GCC is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
GNU General Public License for more details.
17
 
18
You should have received a copy of the GNU General Public License
19
along with GCC; see the file COPYING3.  If not see
20
<http://www.gnu.org/licenses/>.  */
21
 
22
/* We can debug dynamically linked executables on hpux11; we also
23
   want dereferencing of a NULL pointer to cause a SEGV.  Do not move
24
   the "+Accept TypeMismatch" switch.  We check for it in collect2
25
   to determine which init/fini is needed.  */
26
#undef LINK_SPEC
27
#if ((TARGET_DEFAULT | TARGET_CPU_DEFAULT) & MASK_GNU_LD)
28
#define LINK_SPEC \
29
  "%{!shared:%{p:-L/lib/pa20_64/libp -L/usr/lib/pa20_64/libp %{!static:\
30
     %nWarning: consider linking with `-static' as system libraries with\n\
31
     %n  profiling support are only provided in archive format}}}\
32
   %{!shared:%{pg:-L/lib/pa20_64/libp -L/usr/lib/pa20_64/libp %{!static:\
33
     %nWarning: consider linking with `-static' as system libraries with\n\
34
     %n  profiling support are only provided in archive format}}}\
35
   %{mhp-ld:+Accept TypeMismatch -z} -E %{mlinker-opt:-O}\
36
   %{!shared:-u main %{!nostdlib:%{!nodefaultlibs:-u __cxa_finalize}}}\
37
   %{static:-a archive} %{shared:%{mhp-ld:-b}%{!mhp-ld:-shared}}"
38
#else
39
#define LINK_SPEC \
40
  "%{!shared:%{p:-L/lib/pa20_64/libp -L/usr/lib/pa20_64/libp %{!static:\
41
     %nWarning: consider linking with `-static' as system libraries with\n\
42
     %n  profiling support are only provided in archive format}}}\
43
   %{!shared:%{pg:-L/lib/pa20_64/libp -L/usr/lib/pa20_64/libp %{!static:\
44
     %nWarning: consider linking with `-static' as system libraries with\n\
45
     %n  profiling support are only provided in archive format}}}\
46
   %{!mgnu-ld:+Accept TypeMismatch -z} -E %{mlinker-opt:-O}\
47
   %{!shared:-u main %{!nostdlib:%{!nodefaultlibs:-u __cxa_finalize}}}\
48
   %{static:-a archive} %{shared:%{mgnu-ld:-shared}%{!mgnu-ld:-b}}"
49
#endif
50
 
51
/* Profiling support is only provided in libc.a.  However, libprof and
52
   libgprof are only available in shared form on HP-UX 11.00.  We use
53
   the shared form if we are using the GNU linker or an archive form
54
   isn't available.  We also usually need to link with libdld and it's
55
   only available in shared form.  */
56
#undef LIB_SPEC
57
#if ((TARGET_DEFAULT | TARGET_CPU_DEFAULT) & MASK_GNU_LD)
58
#define LIB_SPEC \
59
  "%{!shared:\
60
     %{!p:%{!pg: %{static|mt|pthread:-lpthread} -lc\
61
            %{static:%{!nolibdld:-a shared -ldld -a archive -lc}}}}\
62
     %{p:%{!pg:%{static:%{!mhp-ld:-a shared}%{mhp-ld:-a archive_shared}}\
63
           -lprof %{static:-a archive} %{static|mt|pthread:-lpthread} -lc\
64
           %{static:%{!nolibdld:-a shared -ldld -a archive -lc}}}}\
65
     %{pg:%{static:%{!mhp-ld:-a shared}%{mhp-ld:-a archive_shared}}\
66
       -lgprof %{static:-a archive} %{static|mt|pthread:-lpthread} -lc\
67
       %{static:%{!nolibdld:-a shared -ldld -a archive -lc}}}}"
68
#else
69
#define LIB_SPEC \
70
  "%{!shared:\
71
     %{!p:%{!pg: %{static|mt|pthread:-lpthread} -lc\
72
            %{static:%{!nolibdld:-a shared -ldld -a archive -lc}}}}\
73
     %{p:%{!pg:%{static:%{mgnu-ld:-a shared}%{!mgnu-ld:-a archive_shared}}\
74
           -lprof %{static:-a archive} %{static|mt|pthread:-lpthread} -lc\
75
           %{static:%{!nolibdld:-a shared -ldld -a archive -lc}}}}\
76
     %{pg:%{static:%{mgnu-ld:-a shared}%{!mgnu-ld:-a archive_shared}}\
77
       -lgprof %{static:-a archive} %{static|mt|pthread:-lpthread} -lc\
78
       %{static:%{!nolibdld:-a shared -ldld -a archive -lc}}}}"
79
#endif
80
 
81
/* The libgcc_stub.a and milli.a libraries need to come last.  */
82
#undef LINK_GCC_C_SEQUENCE_SPEC
83
#define LINK_GCC_C_SEQUENCE_SPEC "\
84
  %G %L %G %{!nostdlib:%{!nodefaultlibs:%{!shared:-lgcc_stub}\
85
  /usr/lib/pa20_64/milli.a}}"
86
 
87
/* Under hpux11, the normal location of the `ld' and `as' programs is the
88
   /usr/ccs/bin directory.  */
89
 
90
#ifndef CROSS_COMPILE
91
#undef MD_EXEC_PREFIX
92
#define MD_EXEC_PREFIX "/usr/ccs/bin"
93
#endif
94
 
95
/* Default prefixes.  */
96
 
97
#undef STANDARD_STARTFILE_PREFIX_1
98
#define STANDARD_STARTFILE_PREFIX_1 "/lib/pa20_64/"
99
 
100
#undef STANDARD_STARTFILE_PREFIX_2
101
#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/pa20_64/"
102
 
103
/* Under hpux11 the normal location of the various pa20_64 *crt*.o files
104
   is the /usr/ccs/lib/pa20_64 directory.  Some files may also be in the
105
   /opt/langtools/lib/pa20_64 directory.  */
106
 
107
#ifndef CROSS_COMPILE
108
#undef MD_STARTFILE_PREFIX
109
#define MD_STARTFILE_PREFIX "/usr/ccs/lib/pa20_64/"
110
#endif
111
 
112
#ifndef CROSS_COMPILE
113
#undef MD_STARTFILE_PREFIX_1
114
#define MD_STARTFILE_PREFIX_1 "/opt/langtools/lib/pa20_64/"
115
#endif
116
 
117
/* This macro specifies the biggest alignment supported by the object
118
   file format of this machine.
119
 
120
   The .align directive in the HP assembler allows alignments up to
121
   4096 bytes.  However, the maximum alignment of a global common symbol
122
   is 16 bytes using HP ld.  Unfortunately, this macro doesn't provide
123
   a method to check for common symbols.  */
124
#undef MAX_OFILE_ALIGNMENT
125
#define MAX_OFILE_ALIGNMENT 32768
126
 
127
/* Due to limitations in the target structure, it isn't currently possible
128
   to dynamically switch between the GNU and HP assemblers.  */
129
#undef TARGET_GAS
130
 
131
/* Configure selects the standard ELFOS defines for use with GAS.  */
132
#ifdef USING_ELFOS_H
133
 
134
/* We are using GAS.  */
135
#define TARGET_GAS 1
136
 
137
#undef TARGET_ASM_FILE_START
138
#define TARGET_ASM_FILE_START pa_hpux64_gas_file_start
139
 
140
/* This is how we output a null terminated string.  */
141
#undef STRING_ASM_OP
142
#define STRING_ASM_OP   "\t.stringz\t"
143
 
144
#define TEXT_SECTION_ASM_OP     "\t.text"
145
#define DATA_SECTION_ASM_OP     "\t.data"
146
#define BSS_SECTION_ASM_OP      "\t.section\t.bss"
147
 
148
#define JCR_SECTION_NAME        ".jcr"
149
 
150
#define HP_INIT_ARRAY_SECTION_ASM_OP    "\t.section\t.init"
151
#define GNU_INIT_ARRAY_SECTION_ASM_OP   "\t.section\t.init_array"
152
#define HP_FINI_ARRAY_SECTION_ASM_OP    "\t.section\t.fini"
153
#define GNU_FINI_ARRAY_SECTION_ASM_OP   "\t.section\t.fini_array"
154
 
155
/* We need to override the following two macros defined in elfos.h since
156
   the .comm directive has a different syntax and it can't be used for
157
   local common symbols.  */
158
#undef ASM_OUTPUT_ALIGNED_COMMON
159
#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN)              \
160
  pa_asm_output_aligned_common (FILE, NAME, SIZE, ALIGN)
161
 
162
#undef ASM_OUTPUT_ALIGNED_LOCAL
163
#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN)               \
164
  pa_asm_output_aligned_local (FILE, NAME, SIZE, ALIGN)
165
 
166
/* The define in pa.h doesn't work with the alias attribute.  The
167
   default is ok with the following define for GLOBAL_ASM_OP.  */
168
#undef TARGET_ASM_GLOBALIZE_LABEL
169
 
170
/* This is how we globalize a label.  */
171
#define GLOBAL_ASM_OP   "\t.globl\t"
172
 
173
/* Hacked version from defaults.h that uses assemble_name_raw
174
   instead of assemble_name.  A symbol in a type directive that
175
   isn't otherwise referenced doesn't cause the symbol to be
176
   placed in the symbol table of the assembled object.  */
177
#undef ASM_OUTPUT_TYPE_DIRECTIVE
178
#define ASM_OUTPUT_TYPE_DIRECTIVE(STREAM, NAME, TYPE)           \
179
do {                                                            \
180
  fputs (TYPE_ASM_OP, STREAM);                                  \
181
  assemble_name_raw (STREAM, NAME);                             \
182
  fputs (", ", STREAM);                                         \
183
  fprintf (STREAM, TYPE_OPERAND_FMT, TYPE);                     \
184
  putc ('\n', STREAM);                                          \
185
} while (0)
186
 
187
/* Hacked version from elfos.h that doesn't output a label.  */
188
#undef ASM_DECLARE_FUNCTION_NAME
189
#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)             \
190
do {                                                            \
191
  ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function");           \
192
  ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL));                \
193
} while (0)
194
 
195
/* The type of external references must be set correctly for the
196
   dynamic loader to work correctly.  This is equivalent to the
197
   HP assembler's .IMPORT directive but relates more directly to
198
   ELF object file types.  */
199
#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME)                   \
200
  pa_hpux_asm_output_external ((FILE), (DECL), (NAME))
201
#define ASM_OUTPUT_EXTERNAL_REAL(FILE, DECL, NAME)              \
202
do {                                                            \
203
  if (FUNCTION_NAME_P (NAME))                                   \
204
    ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function");         \
205
  else                                                          \
206
    ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object");           \
207
} while (0)
208
 
209
/* We need set the type for external libcalls.  Also note that not all
210
   libcall names are passed to targetm.encode_section_info (e.g., __main).
211
   Thus, we also have to do the section encoding if it hasn't been done
212
   already.  */
213
#undef ASM_OUTPUT_EXTERNAL_LIBCALL
214
#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN)                  \
215
do {                                                            \
216
  if (!FUNCTION_NAME_P (XSTR (FUN, 0)))                         \
217
    hppa_encode_label (FUN);                                    \
218
  ASM_OUTPUT_TYPE_DIRECTIVE (FILE, XSTR (FUN, 0), "function");  \
219
} while (0)
220
 
221
/* We need to use the HP style for internal labels.  */
222
#undef ASM_GENERATE_INTERNAL_LABEL
223
#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
224
  sprintf (LABEL, "*%c$%s%04ld", (PREFIX)[0], (PREFIX) + 1, (long)(NUM))
225
 
226
#else /* USING_ELFOS_H */
227
 
228
/* We are not using GAS.  */
229
#define TARGET_GAS 0
230
 
231
/* HPUX 11 has the "new" HP assembler.  It's still lousy, but it's a whole
232
   lot better than the assembler shipped with older versions of hpux.
233
   However, it doesn't support weak symbols and is a bad fit with ELF.  */
234
#undef NEW_HP_ASSEMBLER
235
#define NEW_HP_ASSEMBLER 1
236
 
237
/* It looks like DWARF2 will be the easiest debug format to handle on this
238
   platform.  */
239
#define DWARF2_DEBUGGING_INFO 1
240
#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
241
 
242
/* This target uses the ELF object file format.  */
243
#define OBJECT_FORMAT_ELF
244
 
245
#undef TARGET_ASM_FILE_START
246
#define TARGET_ASM_FILE_START pa_hpux64_hpas_file_start
247
 
248
#undef TEXT_SECTION_ASM_OP
249
#define TEXT_SECTION_ASM_OP             "\t.SUBSPA $CODE$\n"
250
#undef READONLY_DATA_SECTION_ASM_OP
251
#define READONLY_DATA_SECTION_ASM_OP    "\t.SUBSPA $LIT$\n"
252
#undef DATA_SECTION_ASM_OP
253
#define DATA_SECTION_ASM_OP             "\t.SUBSPA $DATA$\n"
254
#undef BSS_SECTION_ASM_OP
255
#define BSS_SECTION_ASM_OP              "\t.SUBSPA $BSS$\n"
256
 
257
/* We provide explicit defines for CTORS_SECTION_ASM_OP and
258
   DTORS_SECTION_ASM_OP since we don't yet have support for
259
   named sections with the HP assembler.  */
260
#undef CTORS_SECTION_ASM_OP
261
#define CTORS_SECTION_ASM_OP "\t.SUBSPA \\.ctors,QUAD=1,ALIGN=8,ACCESS=31"
262
#undef DTORS_SECTION_ASM_OP
263
#define DTORS_SECTION_ASM_OP "\t.SUBSPA \\.dtors,QUAD=1,ALIGN=8,ACCESS=31"
264
 
265
#define HP_INIT_ARRAY_SECTION_ASM_OP \
266
  "\t.SUBSPA \\.init,QUAD=1,ALIGN=8,ACCESS=31"
267
#define GNU_INIT_ARRAY_SECTION_ASM_OP \
268
  "\t.SUBSPA \\.init_array,QUAD=1,ALIGN=8,ACCESS=31"
269
#define HP_FINI_ARRAY_SECTION_ASM_OP \
270
  "\t.SUBSPA \\.fini,QUAD=1,ALIGN=8,ACCESS=31"
271
#define GNU_FINI_ARRAY_SECTION_ASM_OP \
272
  "\t.SUBSPA \\.fini_array,QUAD=1,ALIGN=8,ACCESS=31"
273
 
274
#endif /* USING_ELFOS_H */
275
 
276
/* The following defines, used to run constructors and destructors with
277
   the SOM linker under HP-UX 11, are not needed.  */
278
#undef HAS_INIT_SECTION
279
#undef LD_INIT_SWITCH
280
#undef LD_FINI_SWITCH
281
 
282
/* The following STARTFILE_SPEC and ENDFILE_SPEC defines provide the
283
   magic needed to run initializers and finalizers.  */
284
#undef STARTFILE_SPEC
285
#if TARGET_HPUX_11_11
286
#define STARTFILE_SPEC \
287
  "%{!shared: %{!symbolic: crt0%O%s} %{munix=95:unix95.o%s} \
288
     %{!munix=93:%{!munix=95:unix98%O%s}}} %{static:crtbeginT%O%s} \
289
   %{!static:%{!shared:crtbegin%O%s} %{shared:crtbeginS%O%s}}"
290
#else
291
#define STARTFILE_SPEC \
292
  "%{!shared: %{!symbolic: crt0%O%s} %{munix=95:unix95%O%s}} \
293
   %{static:crtbeginT%O%s} %{!static:%{!shared:crtbegin%O%s} \
294
   %{shared:crtbeginS%O%s}}"
295
#endif
296
#undef ENDFILE_SPEC
297
#define ENDFILE_SPEC "%{!shared:crtend%O%s} %{shared:crtendS%O%s}"
298
 
299
/* Since HP uses the .init and .fini sections for array initializers
300
   and finalizers, we need different defines for INIT_SECTION_ASM_OP
301
   and FINI_SECTION_ASM_OP.  With the implementation adopted below,
302
   the sections are not actually used.  However, we still must provide
303
   defines to select the proper code path.  */
304
#undef INIT_SECTION_ASM_OP
305
#define INIT_SECTION_ASM_OP
306
#undef FINI_SECTION_ASM_OP
307
#define FINI_SECTION_ASM_OP
308
 
309
/* We are using array initializers and don't want calls in the INIT
310
   and FINI sections.  */
311
#undef CRT_CALL_STATIC_FUNCTION
312
#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC)
313
 
314
/* The init_priority attribute is not supported with HP ld.  This could be
315
   supported if collect2 was used with LD_INIT_SWITCH.  Unfortunately, this
316
   approach doesn't work with GNU ld since HP-UX doesn't support DT_INIT,
317
   and therefore the -init and -fini GNU ld switches.  */
318
#undef SUPPORTS_INIT_PRIORITY
319
#define SUPPORTS_INIT_PRIORITY (TARGET_GNU_LD ? 1 : 0)
320
 
321
/* We use DTOR_LIST_BEGIN to carry a bunch of hacks to allow us to use
322
   the init and fini array sections with both the HP and GNU linkers.
323
   The linkers setup the required dynamic entries in the dynamic segment
324
   and the dynamic linker does the calls.  This approach avoids using
325
   collect2.
326
 
327
   The first hack is to implement __do_global_ctors_aux in crtbegin as
328
   it needs to be the first entry in the init array so that it is called
329
   last.  HP got the order of the init array backwards.  The DT_INIT_ARRAY
330
   is supposed to be executed in the same order as the addresses appear in
331
   the array.  DT_FINI_ARRAY is supposed to be executed in the opposite
332
   order.
333
 
334
   The second hack is a set of plabels to implement the effect of
335
   CRT_CALL_STATIC_FUNCTION.  HP-UX 11 only supports DI_INIT_ARRAY and
336
   DT_FINI_ARRAY and they put the arrays in .init and .fini, rather than
337
   in .init_array and .fini_array.  The standard defines for .init and
338
   .fini have the execute flag set.  So, the assembler has to be hacked
339
   to munge the standard flags for these sections to make them agree
340
   with what the HP linker expects.  With the GNU linker, we need to
341
   used the .init_array and .fini_array sections.  So, we set up for
342
   both just in case.  Once we have built the table, the linker does
343
   the rest of the work.
344
 
345
   The order is significant.  Placing __do_global_ctors_aux first in
346
   the list, results in it being called last.  User specified initializers,
347
   either using the linker +init command or a plabel, run before the
348
   initializers specified here.  */
349
 
350
/* We need to add frame_dummy to the initializer list if EH_FRAME_SECTION_NAME
351
   or JCR_SECTION_NAME is defined.  */
352
#if defined(EH_FRAME_SECTION_NAME) || defined(JCR_SECTION_NAME)
353
#define PA_INIT_FRAME_DUMMY_ASM_OP ".dword P%frame_dummy"
354
#else
355
#define PA_INIT_FRAME_DUMMY_ASM_OP ""
356
#endif
357
 
358
/* The following hack sets up the .init, .init_array, .fini and
359
   .fini_array sections.  */
360
#define PA_CRTBEGIN_HACK \
361
asm (TEXT_SECTION_ASM_OP);                                              \
362
static void __attribute__((used))                                       \
363
__do_global_ctors_aux (void)                                            \
364
{                                                                       \
365
  func_ptr *p = __CTOR_LIST__;                                          \
366
  while (*(p + 1))                                                      \
367
    p++;                                                                \
368
  for (; *p != (func_ptr) -1; p--)                                      \
369
    (*p) ();                                                            \
370
}                                                                       \
371
                                                                        \
372
asm (HP_INIT_ARRAY_SECTION_ASM_OP);                                     \
373
asm (".align 8");                                                       \
374
asm (".dword P%__do_global_ctors_aux");                                 \
375
asm (PA_INIT_FRAME_DUMMY_ASM_OP);                                       \
376
asm (GNU_INIT_ARRAY_SECTION_ASM_OP);                                    \
377
asm (".align 8");                                                       \
378
asm (".dword P%__do_global_ctors_aux");                                 \
379
asm (PA_INIT_FRAME_DUMMY_ASM_OP);                                       \
380
asm (HP_FINI_ARRAY_SECTION_ASM_OP);                                     \
381
asm (".align 8");                                                       \
382
asm (".dword P%__do_global_dtors_aux");                                 \
383
asm (GNU_FINI_ARRAY_SECTION_ASM_OP);                                    \
384
asm (".align 8");                                                       \
385
asm (".dword P%__do_global_dtors_aux")
386
 
387
/* The following two variants of DTOR_LIST_BEGIN are identical to those
388
   in crtstuff.c except for the addition of the above crtbegin hack.  */
389
#ifdef DTORS_SECTION_ASM_OP
390
#define DTOR_LIST_BEGIN \
391
asm (DTORS_SECTION_ASM_OP);                                             \
392
STATIC func_ptr __DTOR_LIST__[1]                                        \
393
  __attribute__ ((aligned(sizeof(func_ptr))))                           \
394
  = { (func_ptr) (-1) };                                                \
395
PA_CRTBEGIN_HACK
396
#else
397
#define DTOR_LIST_BEGIN \
398
STATIC func_ptr __DTOR_LIST__[1]                                        \
399
  __attribute__ ((section(".dtors"), aligned(sizeof(func_ptr))))        \
400
  = { (func_ptr) (-1) };                                                \
401
PA_CRTBEGIN_HACK
402
#endif
403
 
404
/* If using HP ld do not call pxdb.  Use size as a program that does nothing
405
   and returns 0.  /bin/true cannot be used because it is a script without
406
   an interpreter.  */
407
#define INIT_ENVIRONMENT "LD_PXDB=/usr/ccs/bin/size"
408
 
409
/* The HPUX dynamic linker objects to undefined weak symbols, so do
410
   not use them in gthr-posix.h.  */
411
#define GTHREAD_USE_WEAK 0
412
 
413
/* We don't want undefined weak references to __register_frame_info,
414
   __deregister_frame_info, _Jv_RegisterClasses and __cxa_finalize
415
   introduced by crtbegin.o.  The GNU linker only resolves weak
416
   references if they appear in a shared library.  Thus, it would be
417
   impossible to create a static executable if the symbols were weak.
418
   So, the best solution seems to be to make the symbols strong and
419
   provide an archive library of empty stub functions.  */
420
#define TARGET_ATTRIBUTE_WEAK

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.