* dwarf2dbg.c (dwarf2_gen_line_info): Mirror the section symbol
[deliverable/binutils-gdb.git] / gas / config / tc-ppc.h
CommitLineData
252b5132 1/* tc-ppc.h -- Header file for tc-ppc.c.
49309057 2 Copyright (C) 1994, 95, 96, 97, 98, 1999 Free Software Foundation, Inc.
252b5132
RH
3 Written by Ian Lance Taylor, Cygnus Support.
4
5 This file is part of GAS, the GNU Assembler.
6
7 GAS 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 GAS 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 GAS; see the file COPYING. If not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20 02111-1307, USA. */
21
22#define TC_PPC
23
24#ifdef ANSI_PROTOTYPES
25struct fix;
26#endif
27
28/* Set the endianness we are using. Default to big endian. */
29#ifndef TARGET_BYTES_BIG_ENDIAN
30#define TARGET_BYTES_BIG_ENDIAN 1
31#endif
32
33#ifndef BFD_ASSEMBLER
34 #error PowerPC support requires BFD_ASSEMBLER
35#endif
36
37/* If OBJ_COFF is defined, and TE_PE is not defined, we are assembling
38 XCOFF for AIX or PowerMac. If TE_PE is defined, we are assembling
39 COFF for Windows NT. */
40
41#ifdef OBJ_COFF
42#ifndef TE_PE
43#define OBJ_XCOFF
44#endif
45#endif
46
47/* The target BFD architecture. */
48#define TARGET_ARCH (ppc_arch ())
49extern enum bfd_architecture ppc_arch PARAMS ((void));
50
51/* Whether or not the target is big endian */
52extern int target_big_endian;
53
54/* The target BFD format. */
55#ifdef OBJ_COFF
56#ifdef TE_PE
57#define TARGET_FORMAT (target_big_endian ? "pe-powerpc" : "pe-powerpcle")
58#else
59#define TARGET_FORMAT "aixcoff-rs6000"
60#endif
61#endif
62
63/* PowerMac has a BFD slightly different from AIX's. */
64#ifdef TE_POWERMAC
65#ifdef TARGET_FORMAT
66#undef TARGET_FORMAT
67#endif
68#define TARGET_FORMAT "xcoff-powermac"
69#endif
70
71#ifdef OBJ_ELF
72#define TARGET_FORMAT (target_big_endian ? "elf32-powerpc" : "elf32-powerpcle")
73#endif
74
75/* Permit temporary numeric labels. */
76#define LOCAL_LABELS_FB 1
77
78/* $ is used to refer to the current location. */
79#define DOLLAR_DOT
80
81/* Strings do not use backslash escapes under COFF. */
82#ifdef OBJ_COFF
83#define NO_STRING_ESCAPES
84#endif
85
86#ifdef OBJ_ELF
87#define DIFF_EXPR_OK /* foo-. gets turned into PC relative relocs */
88#endif
89
90#if TARGET_BYTES_BIG_ENDIAN
91#define PPC_BIG_ENDIAN 1
92#else
93#define PPC_BIG_ENDIAN 0
94#endif
95
96/* We don't need to handle .word strangely. */
97#define WORKING_DOT_WORD
98
99/* We set the fx_done field appropriately in md_apply_fix. */
100#define TC_HANDLES_FX_DONE
101\f
102#ifdef TE_PE
103
104/* Question marks are permitted in symbol names. */
105#define LEX_QM 1
106
107/* Don't adjust TOC relocs. */
108#define tc_fix_adjustable(fixp) ppc_pe_fix_adjustable (fixp)
109extern int ppc_pe_fix_adjustable PARAMS ((struct fix *));
110
111#endif
112
113#ifdef OBJ_XCOFF
114
115/* Declarations needed when generating XCOFF code. XCOFF is an
116 extension of COFF, used only on the RS/6000. Rather than create an
117 obj-xcoff, we just use obj-coff, and handle the extensions here in
118 tc-ppc. */
119
120/* We need to keep some information for symbols. */
121struct ppc_tc_sy
122{
123 /* We keep a few linked lists of symbols. */
49309057 124 symbolS *next;
252b5132
RH
125 /* Non-zero if the symbol should be output. The RS/6000 assembler
126 only outputs symbols that are external or are mentioned in a
127 .globl or .lglobl statement. */
128 int output;
129 /* The symbol class. */
130 int class;
131 /* The real name, if the symbol was renamed. */
132 char *real_name;
133 /* For a csect symbol, the subsegment we are using. This is zero
134 for symbols that are not csects. */
135 subsegT subseg;
136 /* For a csect or common symbol, the alignment to use. */
137 int align;
138 /* For a function symbol, a symbol whose value is the size. The
139 field is NULL if there is no size. */
49309057 140 symbolS *size;
252b5132
RH
141 /* For a csect symbol, the last symbol which has been defined in
142 this csect, or NULL if none have been defined so far. For a .bs
143 symbol, the referenced csect symbol. */
49309057 144 symbolS *within;
252b5132
RH
145};
146
147#define TC_SYMFIELD_TYPE struct ppc_tc_sy
148
149/* We need an additional auxent for function symbols. */
150#define OBJ_COFF_MAX_AUXENTRIES 2
151
152/* Square and curly brackets are permitted in symbol names. */
153#define LEX_BR 3
154
155/* Canonicalize the symbol name. */
156#define tc_canonicalize_symbol_name(name) ppc_canonicalize_symbol_name (name)
157extern char *ppc_canonicalize_symbol_name PARAMS ((char *));
158
159/* Get the symbol class from the name. */
160#define tc_symbol_new_hook(sym) ppc_symbol_new_hook (sym)
49309057 161extern void ppc_symbol_new_hook PARAMS ((symbolS *));
252b5132
RH
162
163/* Set the symbol class of a label based on the csect. */
164#define tc_frob_label(sym) ppc_frob_label (sym)
49309057 165extern void ppc_frob_label PARAMS ((symbolS *));
252b5132
RH
166
167/* TOC relocs requires special handling. */
168#define tc_fix_adjustable(fixp) ppc_fix_adjustable (fixp)
169extern int ppc_fix_adjustable PARAMS ((struct fix *));
170
171/* A relocation from one csect to another must be kept. */
172#define TC_FORCE_RELOCATION(FIXP) ppc_force_relocation (FIXP)
173extern int ppc_force_relocation PARAMS ((struct fix *));
174
175/* We need to set the section VMA. */
176#define tc_frob_section(sec) ppc_frob_section (sec)
177extern void ppc_frob_section PARAMS ((asection *));
178
179/* Finish up the symbol. */
180#define tc_frob_symbol(sym, punt) punt = ppc_frob_symbol (sym)
49309057 181extern int ppc_frob_symbol PARAMS ((symbolS *));
252b5132
RH
182
183/* Finish up the entire symtab. */
184#define tc_adjust_symtab() ppc_adjust_symtab ()
185extern void ppc_adjust_symtab PARAMS ((void));
186
187/* Niclas Andersson <nican@ida.liu.se> says this is needed. */
188#define SUB_SEGMENT_ALIGN(SEG) 2
189
190#endif /* OBJ_XCOFF */
191
192#ifdef OBJ_ELF
193
194/* Branch prediction relocations must force relocation, as must
195 the vtable description relocs. */
196#define TC_FORCE_RELOCATION(FIXP) \
197((FIXP)->fx_r_type == BFD_RELOC_PPC_B16_BRTAKEN \
198 || (FIXP)->fx_r_type == BFD_RELOC_PPC_B16_BRNTAKEN \
199 || (FIXP)->fx_r_type == BFD_RELOC_PPC_BA16_BRTAKEN \
200 || (FIXP)->fx_r_type == BFD_RELOC_PPC_BA16_BRNTAKEN \
201 || (FIXP)->fx_r_type == BFD_RELOC_VTABLE_INHERIT \
202 || (FIXP)->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
203
204#define TC_FORCE_RELOCATION_SECTION(FIXP,SEC) \
205(TC_FORCE_RELOCATION (FIXP) \
49309057
ILT
206 || ((FIXP)->fx_addsy && !(FIXP)->fx_subsy \
207 && S_GET_SEGMENT ((FIXP)->fx_addsy) != SEC))
252b5132
RH
208
209/* Support for SHF_EXCLUDE and SHT_ORDERED */
210extern int ppc_section_letter PARAMS ((int, char **));
9de8d8f1
RH
211extern int ppc_section_type PARAMS ((char *, size_t));
212extern int ppc_section_word PARAMS ((char *, size_t));
252b5132
RH
213extern int ppc_section_flags PARAMS ((int, int, int));
214
215#define md_elf_section_letter(LETTER, PTR_MSG) ppc_section_letter (LETTER, PTR_MSG)
9de8d8f1
RH
216#define md_elf_section_type(STR, LEN) ppc_section_type (STR, LEN)
217#define md_elf_section_word(STR, LEN) ppc_section_word (STR, LEN)
252b5132
RH
218#define md_elf_section_flags(FLAGS, ATTR, TYPE) ppc_section_flags (FLAGS, ATTR, TYPE)
219
220/* Add extra PPC sections -- Note, for now, make .sbss2 and .PPC.EMB.sbss0 a
221 normal section, and not a bss section so that the linker doesn't crater
222 when trying to make more than 2 sections. */
223#define ELF_TC_SPECIAL_SECTIONS \
224 { ".tags", SHT_ORDERED, SHF_ALLOC }, \
225 { ".sdata", SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, \
226 { ".sbss", SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, \
227 { ".sdata2", SHT_PROGBITS, SHF_ALLOC }, \
228 { ".sbss2", SHT_PROGBITS, SHF_ALLOC }, \
229 { ".PPC.EMB.sdata0", SHT_PROGBITS, SHF_ALLOC }, \
230 { ".PPC.EMB.sbss0", SHT_PROGBITS, SHF_ALLOC },
231
232#define tc_comment_chars ppc_comment_chars
233extern const char *ppc_comment_chars;
234
235/* Keep relocations relative to the GOT, or non-PC relative. */
236#define tc_fix_adjustable(FIX) \
237 ((FIX)->fx_r_type != BFD_RELOC_16_GOTOFF \
238 && (FIX)->fx_r_type != BFD_RELOC_LO16_GOTOFF \
239 && (FIX)->fx_r_type != BFD_RELOC_HI16_GOTOFF \
240 && (FIX)->fx_r_type != BFD_RELOC_HI16_S_GOTOFF \
241 && (FIX)->fx_r_type != BFD_RELOC_GPREL16 \
242 && (FIX)->fx_r_type != BFD_RELOC_VTABLE_INHERIT \
243 && (FIX)->fx_r_type != BFD_RELOC_VTABLE_ENTRY \
244 && ! S_IS_EXTERNAL ((FIX)->fx_addsy) \
245 && ! S_IS_WEAK ((FIX)->fx_addsy) \
246 && ((FIX)->fx_pcrel \
247 || ((FIX)->fx_subsy != NULL \
248 && (S_GET_SEGMENT ((FIX)->fx_subsy) \
249 == S_GET_SEGMENT ((FIX)->fx_addsy))) \
250 || strchr (S_GET_NAME ((FIX)->fx_addsy), '\001') != NULL \
251 || strchr (S_GET_NAME ((FIX)->fx_addsy), '\002') != NULL))
252
253/* We must never ever try to resolve references to externally visible
254 symbols in the assembler, because the .o file might go into a shared
255 library, and some other shared library might override that symbol. */
256#define TC_RELOC_RTSYM_LOC_FIXUP(FIX) \
257 ((FIX)->fx_addsy == NULL \
258 || (! S_IS_EXTERNAL ((FIX)->fx_addsy) \
259 && ! S_IS_WEAK ((FIX)->fx_addsy) \
260 && S_IS_DEFINED ((FIX)->fx_addsy) \
261 && ! S_IS_COMMON ((FIX)->fx_addsy)))
262
263#endif /* OBJ_ELF */
264
265/* call md_apply_fix3 with segment instead of md_apply_fix */
266#define MD_APPLY_FIX3
267
268/* call md_pcrel_from_section, not md_pcrel_from */
269#define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section(FIXP, SEC)
270extern long md_pcrel_from_section PARAMS ((struct fix *, segT));
271
272#define md_parse_name(name, exp) ppc_parse_name (name, exp)
273extern int ppc_parse_name PARAMS ((const char *, struct expressionS *));
274
275#define md_operand(x)
276
This page took 0.035934 seconds and 4 git commands to generate.