OSDN Git Service

* config.gcc (hppa*64*-*-hpux11*): Check gnu_ld.
[pf3gnuchains/gcc-fork.git] / gcc / config / pa / pa64-hpux.h
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.
4
5 This file is part of GNU CC.
6
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)
10 any later version.
11
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.
16
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.  */
21
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
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
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
40 #define LINK_SPEC \
41   "-E %{mlinker-opt:-O} %{!shared:-u main} %{static:-a archive} %{shared:%{mgnu-ld:-shared}%{!mgnu-ld:-b}} %{!mgnu-ld:+Accept TypeMismatch}"
42 #endif
43
44 /* Like the default, except no -lg.  */
45 #undef LIB_SPEC
46 #define LIB_SPEC \
47   "%{!shared:\
48      %{!p:\
49        %{!pg:\
50          %{!threads:-lc}\
51          %{threads:-lcma -lc_r}}\
52        %{p: -L/lib/libp/ -lc}\
53        %{pg: -L/lib/libp/ -lc}}} /usr/lib/pa20_64/milli.a"
54
55 /* Under hpux11, the normal location of the `ld' and `as' programs is the
56    /usr/ccs/bin directory.  */
57
58 #ifndef CROSS_COMPILE
59 #undef MD_EXEC_PREFIX
60 #define MD_EXEC_PREFIX "/usr/ccs/bin"
61 #endif
62
63 /* Under hpux11 the normal location of the various pa20_64 *crt*.o files
64    is the /usr/ccs/lib/pa20_64 directory.  Some files may also be in the
65    /opt/langtools/lib/pa20_64 directory.  */
66
67 #ifndef CROSS_COMPILE
68 #undef MD_STARTFILE_PREFIX
69 #define MD_STARTFILE_PREFIX "/usr/ccs/lib/pa20_64/"
70 #endif
71
72 #ifndef CROSS_COMPILE
73 #undef MD_STARTFILE_PREFIX_1
74 #define MD_STARTFILE_PREFIX_1 "/opt/langtools/lib/pa20_64/"
75 #endif
76
77 /* hpux11 has the new HP assembler.  It's still lousy, but it's a whole lot
78    better than the assembler shipped with older versions of hpux.  */
79 #undef NEW_HP_ASSEMBLER
80 #define NEW_HP_ASSEMBLER 1
81
82 #undef ASM_FILE_START
83 #define ASM_FILE_START(FILE) \
84 do {  \
85      if (TARGET_64BIT) \
86        fputs("\t.LEVEL 2.0w\n", FILE); \
87      else if (TARGET_PA_20) \
88        fputs("\t.LEVEL 2.0\n", FILE); \
89      else if (TARGET_PA_11) \
90        fputs("\t.LEVEL 1.1\n", FILE); \
91      else \
92        fputs("\t.LEVEL 1.0\n", FILE); \
93      if (profile_flag)\
94        fprintf (FILE, "\t.IMPORT _mcount, CODE\n");\
95      if (write_symbols != NO_DEBUG) \
96        output_file_directive ((FILE), main_input_filename); \
97    } while (0)
98
99 /* It looks like DWARF2 will be the easiest debug format to handle on this
100    platform.  */
101 #define OBJECT_FORMAT_ELF
102 #define DWARF2_DEBUGGING_INFO 1
103 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
104 /* This isn't quite ready yet.  I'm seeing it mess up some line
105    tables.  For example, we're getting lines starting/ending at
106    impossible addresses.  */
107 #define DWARF2_ASM_LINE_DEBUG_INFO 1
108
109
110 /* The rest of this file is copied from the generic svr4.h.  One day we
111    would like to simply include svr4.h instead of copying all these
112    definitions.  */
113
114 #define READONLY_DATA_SECTION_ASM_OP    "\t.section\t.rodata"
115
116 /* On svr4, we *do* have support for the .init and .fini sections, and we
117    can put stuff in there to be executed before and after `main'.  We let
118    crtstuff.c and other files know this by defining the following symbols.
119    The definitions say how to change sections to the .init and .fini
120    sections.  This is the same for all known svr4 assemblers.  */
121
122 /* For the time being, we aren't using init sections.  `P' relocations
123    are currently used for function references.  However, P relocations are
124    treated as data references and data references are bound by dld.sl
125    immediately at program startup.  This causes an abort due to undefined
126    weak symbols in crtbegin.o (e.g., __register_frame_info).  Possibly
127    Q relocations might avoid this problem but the GNU assembler doesn't
128    support them.  */
129 #if 0
130 #define INIT_SECTION_ASM_OP     "\t.section\t.init"
131 #define FINI_SECTION_ASM_OP     "\t.section\t.fini"
132 #else
133 #define EH_FRAME_IN_DATA_SECTION 1
134
135 #undef ENDFILE_SPEC
136 #define ENDFILE_SPEC ""
137
138 #undef STARTFILE_SPEC
139 #define STARTFILE_SPEC "%{!shared: \
140                          %{!symbolic: \
141                           %{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}}"
142 #endif
143
144 /* Switch into a generic section.  */
145 #define TARGET_ASM_NAMED_SECTION  default_elf_asm_named_section
146
147 #define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
148
149 /* This is how we tell the assembler that a symbol is weak.  */
150
151 #define ASM_WEAKEN_LABEL(FILE,NAME) \
152   do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
153        fputc ('\n', FILE); } while (0)
154
155 /* Write the extra assembler code needed to declare a function's result.
156    Most svr4 assemblers don't require any special declaration of the
157    result value, but there are exceptions.  */
158
159 #ifndef ASM_DECLARE_RESULT
160 #define ASM_DECLARE_RESULT(FILE, RESULT)
161 #endif