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