OSDN Git Service

* alpha.h, arc.h, arm/aout.h, avr.h, cris.h, d30v.h, dsp16xx.h,
[pf3gnuchains/gcc-fork.git] / gcc / config / pa / pa-linux.h
1 /* Definitions for PA_RISC with ELF format
2    Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
3
4 This file is part of GNU CC.
5
6 GNU CC 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 GNU CC 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 GNU CC; see the file COPYING.  If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA.  */
20
21 /* Use DWARF2 debugging info and unwind.  */
22 #undef PREFERRED_DEBUGGING_TYPE
23 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
24 #define DWARF2_ASM_LINE_DEBUG_INFO 1
25
26 /* A C expression whose value is RTL representing the location of the
27    incoming return address at the beginning of any function, before the
28    prologue.  You only need to define this macro if you want to support
29    call frame debugging information like that provided by DWARF 2.  */
30 #define INCOMING_RETURN_ADDR_RTX (gen_rtx_REG (word_mode, 2))
31 #define DWARF_FRAME_RETURN_COLUMN (DWARF_FRAME_REGNUM (2))
32
33 /* This macro chooses the encoding of pointers embedded in the exception
34    handling sections.  If at all possible, this should be defined such
35    that the exception handling section will not require dynamic relocations,
36    and so may be read-only.
37
38    FIXME: We use DW_EH_PE_aligned to output a PLABEL constructor for
39    global function pointers.  */
40 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL)                       \
41   (CODE == 2 && GLOBAL ? DW_EH_PE_aligned : DW_EH_PE_absptr)
42
43 /* Handle special EH pointer encodings.  Absolute, pc-relative, and
44    indirect are handled automatically.  Since pc-relative encoding is
45    not possible on the PA and we don't have the infrastructure for
46    data relative encoding, we use aligned plabels for global function
47    pointers.  */
48 #define ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(FILE, ENCODING, SIZE, ADDR, DONE) \
49   do {                                                                  \
50     if (((ENCODING) & 0x0F) == DW_EH_PE_aligned)                        \
51       {                                                                 \
52         fputs (integer_asm_op (SIZE, FALSE), FILE);                     \
53         fputs ("P%", FILE);                                             \
54         assemble_name (FILE, XSTR (ADDR, 0));                           \
55         goto DONE;                                                      \
56       }                                                                 \
57     } while (0)
58
59 #undef CPP_PREDEFINES
60 #define CPP_PREDEFINES "-D__ELF__ -Dunix -D__hppa__ -D__gnu_linux__ -Dlinux -Asystem=unix -Asystem=posix -Acpu=hppa -Amachine=hppa -Amachine=bigendian"
61
62 #undef  LIB_SPEC
63 #define LIB_SPEC \
64   "%{shared: -lgcc -lc} \
65    %{!shared: %{mieee-fp:-lieee} %{pthread:-lpthread} \
66         %{shared-libgcc: -lgcc} %{profile:-lc_p} %{!profile: -lc}}"
67
68 #undef ASM_SPEC
69 #define ASM_SPEC \
70   "%{v:-V} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*}"
71
72 /* Define this for shared library support because it isn't in the main
73    linux.h file.  */
74
75 #undef LINK_SPEC
76 #define LINK_SPEC "\
77   %{shared:-shared} \
78   %{!shared: \
79     %{!static: \
80       %{rdynamic:-export-dynamic} \
81       %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
82       %{static:-static}}"
83
84 /* Sibcalls, stubs, and elf sections don't play well.  */
85 #undef FUNCTION_OK_FOR_SIBCALL
86 #define FUNCTION_OK_FOR_SIBCALL(x) 0
87
88 /* glibc's profiling functions don't need gcc to allocate counters.  */
89 #define NO_PROFILE_COUNTERS 1
90
91 /* Define the strings used for the special svr4 .type and .size directives.
92    These strings generally do not vary from one system running svr4 to
93    another, but if a given system (e.g. m88k running svr) needs to use
94    different pseudo-op names for these, they may be overridden in the
95    file which includes this one.  */
96
97 #undef STRING_ASM_OP
98 #define STRING_ASM_OP   ".stringz"
99
100 #define TEXT_SECTION_ASM_OP "\t.text"
101 #define DATA_SECTION_ASM_OP "\t.data"
102 #define BSS_SECTION_ASM_OP "\t.section\t.bss"
103
104 /* Output at beginning of assembler file.  We override the definition
105    from <linux.h> so that we can get the proper .LEVEL directive.  */
106 #undef ASM_FILE_START
107 #define ASM_FILE_START(FILE) \
108   do                                                            \
109     {                                                           \
110       if (write_symbols != NO_DEBUG)                            \
111         {                                                       \
112           output_file_directive (FILE, main_input_filename);    \
113           fputs ("\t.version\t\"01.01\"\n", FILE);              \
114         }                                                       \
115       if (TARGET_64BIT)                                         \
116         fputs("\t.LEVEL 2.0w\n", FILE);                         \
117       else if (TARGET_PA_20)                                    \
118         fputs("\t.LEVEL 2.0\n", FILE);                          \
119       else if (TARGET_PA_11)                                    \
120         fputs("\t.LEVEL 1.1\n", FILE);                          \
121       else                                                      \
122         fputs("\t.LEVEL 1.0\n", FILE);                          \
123       if (profile_flag)                                         \
124         fputs ("\t.IMPORT _mcount, CODE\n", FILE);              \
125     }                                                           \
126    while (0)
127
128 /* Output a definition */
129 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
130   do                                                            \
131     {                                                           \
132       fprintf ((FILE), "\t%s\t", SET_ASM_OP);                   \
133       assemble_name (FILE, LABEL1);                             \
134       fprintf (FILE, ",");                                      \
135       assemble_name (FILE, LABEL2);                             \
136       fprintf (FILE, "\n");                                     \
137     }                                                           \
138   while (0)
139
140 /* We want local labels to start with period if made with asm_fprintf.  */
141 #undef LOCAL_LABEL_PREFIX
142 #define LOCAL_LABEL_PREFIX "."
143
144 /* Define these to generate the Linux/ELF/SysV style of internal
145    labels all the time - i.e. to be compatible with
146    ASM_GENERATE_INTERNAL_LABEL in <elfos.h>.  Compare these with the
147    ones in pa.h and note the lack of dollar signs in these.  FIXME:
148    shouldn't we fix pa.h to use ASM_GENERATE_INTERNAL_LABEL instead? */
149
150 #undef ASM_OUTPUT_ADDR_VEC_ELT
151 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
152   if (TARGET_BIG_SWITCH)                                        \
153     fprintf (FILE, "\tstw %%r1,-16(%%r30)\n\tldil LR'.L%d,%%r1\n\tbe RR'.L%d(%%sr4,%%r1)\n\tldw -16(%%r30),%%r1\n", VALUE, VALUE);              \
154   else                                                          \
155     fprintf (FILE, "\tb .L%d\n\tnop\n", VALUE)
156
157 #undef ASM_OUTPUT_ADDR_DIFF_ELT
158 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
159   if (TARGET_BIG_SWITCH)                                        \
160     fprintf (FILE, "\tstw %%r1,-16(%%r30)\n\tldw T'.L%d(%%r19),%%r1\n\tbv %%r0(%%r1)\n\tldw -16(%%r30),%%r1\n", VALUE);                         \
161   else                                                          \
162     fprintf (FILE, "\tb .L%d\n\tnop\n", VALUE)
163
164 /* Use the default.  */
165 #undef ASM_OUTPUT_LABEL
166
167 /* NOTE: ASM_OUTPUT_INTERNAL_LABEL() is defined for us by elfos.h, and
168    does what we want (i.e. uses colons).  It must be compatible with
169    ASM_GENERATE_INTERNAL_LABEL(), so do not define it here.  */
170
171 /* Use the default.  */
172 #undef ASM_GLOBALIZE_LABEL
173 /* Globalizing directive for a label.  */
174 #definef GLOBAL_ASM_OP ".globl "
175
176 /* FIXME: Hacked from the <elfos.h> one so that we avoid multiple
177    labels in a function declaration (since pa.c seems determined to do
178    it differently)  */
179
180 #undef ASM_DECLARE_FUNCTION_NAME
181 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)             \
182   do                                                            \
183     {                                                           \
184       ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function");       \
185       ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL));            \
186     }                                                           \
187   while (0)
188
189 /* Linux always uses gas.  */
190 #undef TARGET_GAS
191 #define TARGET_GAS 1