OSDN Git Service

261684fff98d6bf7f6031c4f6eae0e4655e96263
[pf3gnuchains/gcc-fork.git] / gcc / config / pa / pa-linux.h
1 /* Definitions for PA_RISC with ELF format
2    Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
3
4 This file is part of GCC.
5
6 GCC 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 GCC 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 GCC; see the file COPYING.  If not, write to
18 the Free Software Foundation, 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.  */
20
21
22 /* A C expression whose value is RTL representing the location of the
23    incoming return address at the beginning of any function, before the
24    prologue.  You only need to define this macro if you want to support
25    call frame debugging information like that provided by DWARF 2.  */
26 #define INCOMING_RETURN_ADDR_RTX (gen_rtx_REG (word_mode, 2))
27 #define DWARF_FRAME_RETURN_COLUMN (DWARF_FRAME_REGNUM (2))
28
29 /* This macro chooses the encoding of pointers embedded in the exception
30    handling sections.  If at all possible, this should be defined such
31    that the exception handling section will not require dynamic relocations,
32    and so may be read-only.
33
34    FIXME: We use DW_EH_PE_aligned to output a PLABEL constructor for
35    global function pointers.  */
36 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL)                       \
37   (CODE == 2 && GLOBAL ? DW_EH_PE_aligned : DW_EH_PE_absptr)
38
39 /* Handle special EH pointer encodings.  Absolute, pc-relative, and
40    indirect are handled automatically.  Since pc-relative encoding is
41    not possible on the PA and we don't have the infrastructure for
42    data relative encoding, we use aligned plabels for global function
43    pointers.  */
44 #define ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(FILE, ENCODING, SIZE, ADDR, DONE) \
45   do {                                                                  \
46     if (((ENCODING) & 0x0F) == DW_EH_PE_aligned)                        \
47       {                                                                 \
48         fputs (integer_asm_op (SIZE, FALSE), FILE);                     \
49         fputs ("P%", FILE);                                             \
50         assemble_name (FILE, XSTR (ADDR, 0));                           \
51         goto DONE;                                                      \
52       }                                                                 \
53     } while (0)
54
55 #undef TARGET_OS_CPP_BUILTINS
56 #define TARGET_OS_CPP_BUILTINS()                \
57   do                                            \
58     {                                           \
59         LINUX_TARGET_OS_CPP_BUILTINS();         \
60         builtin_assert ("machine=bigendian");   \
61         if (flag_pic)                           \
62           {                                     \
63                 builtin_define ("__PIC__");     \
64                 builtin_define ("__pic__");     \
65           }                                     \
66     }                                           \
67   while (0)
68
69 #undef CPP_SPEC
70 #define CPP_SPEC "%{posix:-D_POSIX_SOURCE}"
71
72 #undef  LIB_SPEC
73 #define LIB_SPEC \
74   "%{pthread:-lpthread} \
75    %{shared:-lgcc -lc} \
76    %{!shared:%{mieee-fp:-lieee} %{shared-libgcc:-lgcc} %{profile:-lc_p}%{!profile:-lc}}"
77
78 #undef ASM_SPEC
79 #define ASM_SPEC \
80   "%{v:-V} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*}"
81
82 /* Define this for shared library support because it isn't in the main
83    linux.h file.  */
84
85 #undef LINK_SPEC
86 #define LINK_SPEC "\
87   %{shared:-shared} \
88   %{!shared: \
89     %{!static: \
90       %{rdynamic:-export-dynamic} \
91       %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
92       %{static:-static}}"
93
94 /* glibc's profiling functions don't need gcc to allocate counters.  */
95 #define NO_PROFILE_COUNTERS 1
96
97 /* Define the strings used for the special svr4 .type and .size directives.
98    These strings generally do not vary from one system running svr4 to
99    another, but if a given system (e.g. m88k running svr) needs to use
100    different pseudo-op names for these, they may be overridden in the
101    file which includes this one.  */
102
103 #undef STRING_ASM_OP
104 #define STRING_ASM_OP   ".stringz"
105
106 #define TEXT_SECTION_ASM_OP "\t.text"
107 #define DATA_SECTION_ASM_OP "\t.data"
108 #define BSS_SECTION_ASM_OP "\t.section\t.bss"
109
110 #define TARGET_ASM_FILE_START pa_linux_file_start
111
112 /* We want local labels to start with period if made with asm_fprintf.  */
113 #undef LOCAL_LABEL_PREFIX
114 #define LOCAL_LABEL_PREFIX "."
115
116 /* Define these to generate the Linux/ELF/SysV style of internal
117    labels all the time - i.e. to be compatible with
118    ASM_GENERATE_INTERNAL_LABEL in <elfos.h>.  Compare these with the
119    ones in pa.h and note the lack of dollar signs in these.  FIXME:
120    shouldn't we fix pa.h to use ASM_GENERATE_INTERNAL_LABEL instead? */
121
122 #undef ASM_OUTPUT_ADDR_VEC_ELT
123 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
124   if (TARGET_BIG_SWITCH)                                        \
125     fprintf (FILE, "\t.word .L%d\n", VALUE);                    \
126   else                                                          \
127     fprintf (FILE, "\tb .L%d\n\tnop\n", VALUE)
128
129 #undef ASM_OUTPUT_ADDR_DIFF_ELT
130 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
131   if (TARGET_BIG_SWITCH)                                        \
132     fprintf (FILE, "\t.word .L%d-.L%d\n", VALUE, REL);          \
133   else                                                          \
134     fprintf (FILE, "\tb .L%d\n\tnop\n", VALUE)
135
136 /* Use the default.  */
137 #undef ASM_OUTPUT_LABEL
138
139 /* NOTE: (*targetm.asm_out.internal_label)() is defined for us by elfos.h, and
140    does what we want (i.e. uses colons).  It must be compatible with
141    ASM_GENERATE_INTERNAL_LABEL(), so do not define it here.  */
142
143 /* Use the default.  */
144 #undef TARGET_ASM_GLOBALIZE_LABEL
145 /* Globalizing directive for a label.  */
146 #define GLOBAL_ASM_OP ".globl "
147
148 /* FIXME: Hacked from the <elfos.h> one so that we avoid multiple
149    labels in a function declaration (since pa.c seems determined to do
150    it differently)  */
151
152 #undef ASM_DECLARE_FUNCTION_NAME
153 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)             \
154   do                                                            \
155     {                                                           \
156       ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function");       \
157       ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL));            \
158     }                                                           \
159   while (0)
160
161 /* As well as globalizing the label, we need to encode the label
162    to ensure a plabel is generated in an indirect call.  */
163
164 #undef ASM_OUTPUT_EXTERNAL_LIBCALL
165 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN)                  \
166   do                                                            \
167     {                                                           \
168       if (!FUNCTION_NAME_P (XSTR (FUN, 0)))                     \
169         hppa_encode_label (FUN);                                \
170       (*targetm.asm_out.globalize_label) (FILE, XSTR (FUN, 0)); \
171     }                                                           \
172   while (0)
173
174 /* Linux always uses gas.  */
175 #undef TARGET_GAS
176 #define TARGET_GAS 1