OSDN Git Service

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