9d46c24dd5a2ecffb04089b40158c59c2fe3ce66
[deliverable/binutils-gdb.git] / gas / config / tc-ppc.h
1 /* tc-ppc.h -- Header file for tc-ppc.c.
2 Copyright (C) 1994 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
19 the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
20
21 #define TC_PPC
22
23 #ifndef BFD_ASSEMBLER
24 #error PowerPC support requires BFD_ASSEMBLER
25 #endif
26
27 /* The target BFD architecture. */
28 #define TARGET_ARCH (ppc_arch ())
29 extern enum bfd_architecture ppc_arch PARAMS ((void));
30
31 /* Whether or not the target is big endian */
32 extern int target_big_endian;
33
34 /* The target BFD format. */
35 #ifdef OBJ_COFF
36 #ifdef TE_PE
37 #define TARGET_FORMAT (target_big_endian) ? "pe-powerpc" : "pe-powerpcle"
38 #elif defined(PPC)
39 #define TARGET_FORMAT (target_big_endian) ? "coff-powerpc" : "coff-powerpcle"
40 #else
41 #define TARGET_FORMAT "aixcoff-rs6000"
42 #endif
43 #endif
44
45 #ifdef OBJ_ELF
46 #define TARGET_FORMAT (target_big_endian) ? "elf32-powerpc" : "elf32-powerpcle"
47 #endif
48
49 /* Permit temporary numeric labels. */
50 #define LOCAL_LABELS_FB 1
51
52 /* $ is used to refer to the current location. */
53 #define DOLLAR_DOT
54
55 /* Strings do not use backslash escapes under COFF. */
56 #ifdef OBJ_COFF
57 #define NO_STRING_ESCAPES
58 #endif
59
60 /* When using COFF, we determine whether or not to output a symbol
61 based on sy_tc.output, not on the name. */
62 #ifdef OBJ_COFF
63 #define LOCAL_LABEL(name) 0
64 #endif
65 #ifdef OBJ_ELF
66 /* When using ELF, local labels start with '.'. */
67 #define LOCAL_LABEL(name) (name[0] == '.' \
68 && (name[1] == 'L' || name[1] == '.'))
69 #define FAKE_LABEL_NAME ".L0\001"
70 #define DIFF_EXPR_OK /* .-foo gets turned into PC relative relocs */
71 #endif
72
73 /* Set the endianness we are using. Default to big endian. */
74 #ifndef TARGET_BYTES_BIG_ENDIAN
75 #ifndef TARGET_BYTES_LITTLE_ENDIAN
76 #define TARGET_BYTES_BIG_ENDIAN 1
77 #endif
78 #endif
79
80 #ifdef TARGET_BYTES_BIG_ENDIAN
81 #define PPC_BIG_ENDIAN 1
82 #else
83 #define PPC_BIG_ENDIAN 0
84 #endif
85
86 /* We don't need to handle .word strangely. */
87 #define WORKING_DOT_WORD
88
89 /* We set the fx_done field appropriately in md_apply_fix. */
90 #define TC_HANDLES_FX_DONE
91 \f
92 #ifdef OBJ_COFF
93
94 /* Declarations needed when generating XCOFF code. XCOFF is an
95 extension of COFF, used only on the RS/6000. Rather than create an
96 obj-xcoff, we just use obj-coff, and handle the extensions here in
97 tc-ppc. */
98
99 /* We need to keep some information for symbols. */
100 struct ppc_tc_sy
101 {
102 /* We keep a few linked lists of symbols. */
103 struct symbol *next;
104 /* Non-zero if the symbol should be output. The RS/6000 assembler
105 only outputs symbols that are external or are mentioned in a
106 .globl or .lglobl statement. */
107 int output;
108 /* The symbol class. */
109 int class;
110 /* The real name, if the symbol was renamed. */
111 char *real_name;
112 /* For a csect symbol, the subsegment we are using. This is zero
113 for symbols that are not csects. */
114 subsegT subseg;
115 /* For a csect or common symbol, the alignment to use. */
116 int align;
117 /* For a function symbol, a symbol whose value is the size. The
118 field is NULL if there is no size. */
119 struct symbol *size;
120 /* For a csect symbol, the last symbol which has been defined in
121 this csect, or NULL if none have been defined so far. For a .bs
122 symbol, the referenced csect symbol. */
123 struct symbol *within;
124 };
125
126 #define TC_SYMFIELD_TYPE struct ppc_tc_sy
127
128 /* We need an additional auxent for function symbols. */
129 #define OBJ_COFF_MAX_AUXENTRIES 2
130
131 /* Square and curly brackets are permitted in symbol names. */
132 #define LEX_BR 3
133
134 /* Canonicalize the symbol name. */
135 #define tc_canonicalize_symbol_name(name) ppc_canonicalize_symbol_name (name)
136 extern char *ppc_canonicalize_symbol_name PARAMS ((char *));
137
138 /* Get the symbol class from the name. */
139 #define tc_symbol_new_hook(sym) ppc_symbol_new_hook (sym)
140 extern void ppc_symbol_new_hook PARAMS ((struct symbol *));
141
142 /* Set the symbol class of a label based on the csect. */
143 #define tc_frob_label(sym) ppc_frob_label (sym)
144 extern void ppc_frob_label PARAMS ((struct symbol *));
145
146 /* TOC relocs requires special handling. */
147 #define tc_fix_adjustable(fixp) ppc_fix_adjustable (fixp)
148 extern int ppc_fix_adjustable PARAMS ((struct fix *));
149
150 /* We need to set the section VMA. */
151 #define tc_frob_section(sec) ppc_frob_section (sec)
152 extern void ppc_frob_section PARAMS ((asection *));
153
154 /* Finish up the symbol. */
155 #define tc_frob_symbol(sym, punt) punt = ppc_frob_symbol (sym)
156 extern int ppc_frob_symbol PARAMS ((struct symbol *));
157
158 /* Niclas Andersson <nican@ida.liu.se> says this is needed. */
159 #define SUB_SEGMENT_ALIGN(SEG) 2
160
161 /* Finish up the file. */
162 #define tc_frob_file() ppc_frob_file ()
163 extern void ppc_frob_file PARAMS ((void));
164
165 #endif /* OBJ_COFF */
166
167 #ifdef OBJ_ELF
168 /* The name of the global offset table generated by the compiler. Allow
169 this to be overridden if need be. */
170 #ifndef GLOBAL_OFFSET_TABLE_NAME
171 #define GLOBAL_OFFSET_TABLE_NAME "_GLOBAL_OFFSET_TABLE_"
172 #endif
173
174 /* Branch prediction relocations must force relocation */
175 #define TC_FORCE_RELOCATION(FIXP) \
176 ((FIXP)->fx_r_type == BFD_RELOC_PPC_B16_BRTAKEN \
177 || (FIXP)->fx_r_type == BFD_RELOC_PPC_B16_BRNTAKEN \
178 || (FIXP)->fx_r_type == BFD_RELOC_PPC_BA16_BRTAKEN \
179 || (FIXP)->fx_r_type == BFD_RELOC_PPC_BA16_BRNTAKEN)
180
181 #endif /* OBJ_ELF */
182
183 /* call md_apply_fix3 with segment instead of md_apply_fix */
184 #define MD_APPLY_FIX3
185
186 #define md_operand(x)
This page took 0.064554 seconds and 4 git commands to generate.