OSDN Git Service

49e167cf824cf91fe35820c72e4bc0160bf18edb
[pf3gnuchains/gcc-fork.git] / gcc / config / pa / pa-linux.h
1 /* Definitions for PA_RISC with ELF format
2    Copyright 1999, 2000, 2001 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 #undef CPP_PREDEFINES
28 #define CPP_PREDEFINES "-D__ELF__ -Dunix -D__hppa__ -Dlinux -Asystem=unix -Asystem=posix -Acpu=hppa -Amachine=hppa -Amachine=bigendian"
29
30 #undef  LIB_SPEC
31 #define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
32
33 #undef ASM_SPEC
34 #define ASM_SPEC \
35   "%{v:-V} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*}"
36
37 /* Define this for shared library support because it isn't in the main
38    linux.h file.  */
39
40 #undef LINK_SPEC
41 #define LINK_SPEC "\
42   %{shared:-shared} \
43   %{!shared: \
44     %{!static: \
45       %{rdynamic:-export-dynamic} \
46       %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
47       %{static:-static}}"
48
49 /* Sibcalls, stubs, and elf sections don't play well.  */
50 #undef FUNCTION_OK_FOR_SIBCALL
51 #define FUNCTION_OK_FOR_SIBCALL(x) 0
52
53 /* glibc's profiling functions don't need gcc to allocate counters.  */
54 #define NO_PROFILE_COUNTERS 1
55
56 /* Put plabels into the data section so we can relocate them.  */
57 #undef SELECT_RTX_SECTION
58 #define SELECT_RTX_SECTION(MODE,RTX,ALIGN)      \
59   if (flag_pic && function_label_operand (RTX, MODE))   \
60     data_section ();                                    \
61   else                                                  \
62     readonly_data_section ();
63
64 /* A C expression whose value is RTL representing the location of the
65    incoming return address at the beginning of any function, before the
66    prologue.  */
67 #define INCOMING_RETURN_ADDR_RTX  (gen_rtx_REG (word_mode, 2))
68 #define DWARF_FRAME_RETURN_COLUMN (DWARF_FRAME_REGNUM (2))
69
70 /* Define the strings used for the special svr4 .type and .size directives.
71    These strings generally do not vary from one system running svr4 to
72    another, but if a given system (e.g. m88k running svr) needs to use
73    different pseudo-op names for these, they may be overridden in the
74    file which includes this one.  */
75
76 #undef STRING_ASM_OP
77 #define STRING_ASM_OP   ".stringz"
78
79 #define TEXT_SECTION_ASM_OP "\t.text"
80 #define DATA_SECTION_ASM_OP "\t.data"
81 #define BSS_SECTION_ASM_OP "\t.section\t.bss"
82
83 /* Output at beginning of assembler file.  We override the definition
84    from <linux.h> so that we can get the proper .LEVEL directive.  */
85 #undef ASM_FILE_START
86 #define ASM_FILE_START(FILE) \
87   do                                                            \
88     {                                                           \
89       if (write_symbols != NO_DEBUG)                            \
90         {                                                       \
91           output_file_directive (FILE, main_input_filename);    \
92           fputs ("\t.version\t\"01.01\"\n", FILE);              \
93         }                                                       \
94       if (TARGET_64BIT)                                         \
95         fputs("\t.LEVEL 2.0w\n", FILE);                         \
96       else if (TARGET_PA_20)                                    \
97         fputs("\t.LEVEL 2.0\n", FILE);                          \
98       else if (TARGET_PA_11)                                    \
99         fputs("\t.LEVEL 1.1\n", FILE);                          \
100       else                                                      \
101         fputs("\t.LEVEL 1.0\n", FILE);                          \
102       if (profile_flag)                                         \
103         fputs ("\t.IMPORT _mcount, CODE\n", FILE);              \
104     }                                                           \
105    while (0)
106
107 /* Output a definition */
108 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
109   do                                                            \
110     {                                                           \
111       fprintf ((FILE), "\t%s\t", SET_ASM_OP);                   \
112       assemble_name (FILE, LABEL1);                             \
113       fprintf (FILE, ",");                                      \
114       assemble_name (FILE, LABEL2);                             \
115       fprintf (FILE, "\n");                                     \
116     }                                                           \
117   while (0)
118
119 /* Define these to generate the Linux/ELF/SysV style of internal
120    labels all the time - i.e. to be compatible with
121    ASM_GENERATE_INTERNAL_LABEL in <elfos.h>.  Compare these with the
122    ones in pa.h and note the lack of dollar signs in these.  FIXME:
123    shouldn't we fix pa.h to use ASM_GENERATE_INTERNAL_LABEL instead? */
124
125 #undef ASM_OUTPUT_ADDR_VEC_ELT
126 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
127   if (TARGET_BIG_SWITCH)                                        \
128     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);              \
129   else                                                          \
130     fprintf (FILE, "\tb .L%d\n\tnop\n", VALUE)
131
132 #undef ASM_OUTPUT_ADDR_DIFF_ELT
133 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
134   if (TARGET_BIG_SWITCH)                                        \
135     fprintf (FILE, "\tstw %%r1,-16(%%r30)\n\tldw T'.L%d(%%r19),%%r1\n\tbv %%r0(%%r1)\n\tldw -16(%%r30),%%r1\n", VALUE);                         \
136   else                                                          \
137     fprintf (FILE, "\tb .L%d\n\tnop\n", VALUE)
138
139 /* This is how to output the definition of a user-level label named NAME,
140    such as the label on a static function or variable NAME.  */
141
142 #undef ASM_OUTPUT_LABEL
143 #define ASM_OUTPUT_LABEL(FILE, NAME) \
144   do                                                            \
145     {                                                           \
146       assemble_name (FILE, NAME);                               \
147       fputs (":\n", FILE);                                      \
148     }                                                           \
149   while (0)
150
151 /* NOTE: ASM_OUTPUT_INTERNAL_LABEL() is defined for us by elfos.h, and
152    does what we want (i.e. uses colons).  It must be compatible with
153    ASM_GENERATE_INTERNAL_LABEL(), so do not define it here.  */
154
155 #undef ASM_GLOBALIZE_LABEL
156 #define ASM_GLOBALIZE_LABEL(FILE, NAME) \
157   (fputs (".globl ", FILE), assemble_name (FILE, NAME), fputs ("\n", FILE))
158
159 /* FIXME: Hacked from the <elfos.h> one so that we avoid multiple
160    labels in a function declaration (since pa.c seems determined to do
161    it differently)  */
162
163 #undef ASM_DECLARE_FUNCTION_NAME
164 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)             \
165   do                                                            \
166     {                                                           \
167       fprintf (FILE, "\t%s\t ", TYPE_ASM_OP);                   \
168       assemble_name (FILE, NAME);                               \
169       putc (',', FILE);                                         \
170       fprintf (FILE, TYPE_OPERAND_FMT, "function");             \
171       putc ('\n', FILE);                                        \
172       ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL));            \
173     }                                                           \
174   while (0)
175
176 /* Linux always uses gas.  */
177 #undef TARGET_GAS
178 #define TARGET_GAS 1