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.
5 This file is part of GAS, the GNU Assembler.
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)
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.
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. */
24 #error PowerPC support requires BFD_ASSEMBLER
27 /* If OBJ_COFF is defined, and TE_PE is not defined, we are assembling
28 XCOFF for AIX or PowerMac. If TE_PE is defined, we are assembling
29 COFF for Windows NT. */
37 /* The target BFD architecture. */
38 #define TARGET_ARCH (ppc_arch ())
39 extern enum bfd_architecture ppc_arch
PARAMS ((void));
41 /* Whether or not the target is big endian */
42 extern int target_big_endian
;
44 /* The target BFD format. */
47 #define TARGET_FORMAT (target_big_endian ? "pe-powerpc" : "pe-powerpcle")
49 #define TARGET_FORMAT "aixcoff-rs6000"
53 /* PowerMac has a BFD slightly different from AIX's. */
58 #define TARGET_FORMAT "xcoff-powermac"
62 #define TARGET_FORMAT (target_big_endian ? "elf32-powerpc" : "elf32-powerpcle")
65 /* Permit temporary numeric labels. */
66 #define LOCAL_LABELS_FB 1
68 /* $ is used to refer to the current location. */
71 /* Strings do not use backslash escapes under COFF. */
73 #define NO_STRING_ESCAPES
76 /* When using COFF, we determine whether or not to output a symbol
77 based on sy_tc.output, not on the name. */
79 #define LOCAL_LABEL(name) 0
82 /* When using ELF, local labels start with '.'. */
83 #define LOCAL_LABEL(name) (name[0] == '.' \
84 && (name[1] == 'L' || name[1] == '.'))
85 #define FAKE_LABEL_NAME ".L0\001"
86 #define DIFF_EXPR_OK /* .-foo gets turned into PC relative relocs */
89 /* Set the endianness we are using. Default to big endian. */
90 #ifndef TARGET_BYTES_BIG_ENDIAN
91 #ifndef TARGET_BYTES_LITTLE_ENDIAN
92 #define TARGET_BYTES_BIG_ENDIAN 1
96 #ifdef TARGET_BYTES_BIG_ENDIAN
97 #define PPC_BIG_ENDIAN 1
99 #define PPC_BIG_ENDIAN 0
102 /* We don't need to handle .word strangely. */
103 #define WORKING_DOT_WORD
105 /* We set the fx_done field appropriately in md_apply_fix. */
106 #define TC_HANDLES_FX_DONE
110 /* Question marks are permitted in symbol names. */
113 /* Don't adjust TOC relocs. */
114 #define tc_fix_adjustable(fixp) ppc_pe_fix_adjustable (fixp)
115 extern int ppc_pe_fix_adjustable
PARAMS ((struct fix
*));
121 /* Declarations needed when generating XCOFF code. XCOFF is an
122 extension of COFF, used only on the RS/6000. Rather than create an
123 obj-xcoff, we just use obj-coff, and handle the extensions here in
126 /* We need to keep some information for symbols. */
129 /* We keep a few linked lists of symbols. */
131 /* Non-zero if the symbol should be output. The RS/6000 assembler
132 only outputs symbols that are external or are mentioned in a
133 .globl or .lglobl statement. */
135 /* The symbol class. */
137 /* The real name, if the symbol was renamed. */
139 /* For a csect symbol, the subsegment we are using. This is zero
140 for symbols that are not csects. */
142 /* For a csect or common symbol, the alignment to use. */
144 /* For a function symbol, a symbol whose value is the size. The
145 field is NULL if there is no size. */
147 /* For a csect symbol, the last symbol which has been defined in
148 this csect, or NULL if none have been defined so far. For a .bs
149 symbol, the referenced csect symbol. */
150 struct symbol
*within
;
153 #define TC_SYMFIELD_TYPE struct ppc_tc_sy
155 /* We need an additional auxent for function symbols. */
156 #define OBJ_COFF_MAX_AUXENTRIES 2
158 /* Square and curly brackets are permitted in symbol names. */
161 /* Canonicalize the symbol name. */
162 #define tc_canonicalize_symbol_name(name) ppc_canonicalize_symbol_name (name)
163 extern char *ppc_canonicalize_symbol_name
PARAMS ((char *));
165 /* Get the symbol class from the name. */
166 #define tc_symbol_new_hook(sym) ppc_symbol_new_hook (sym)
167 extern void ppc_symbol_new_hook
PARAMS ((struct symbol
*));
169 /* Set the symbol class of a label based on the csect. */
170 #define tc_frob_label(sym) ppc_frob_label (sym)
171 extern void ppc_frob_label
PARAMS ((struct symbol
*));
173 /* TOC relocs requires special handling. */
174 #define tc_fix_adjustable(fixp) ppc_fix_adjustable (fixp)
175 extern int ppc_fix_adjustable
PARAMS ((struct fix
*));
177 /* We need to set the section VMA. */
178 #define tc_frob_section(sec) ppc_frob_section (sec)
179 extern void ppc_frob_section
PARAMS ((asection
*));
181 /* Finish up the symbol. */
182 #define tc_frob_symbol(sym, punt) punt = ppc_frob_symbol (sym)
183 extern int ppc_frob_symbol
PARAMS ((struct symbol
*));
185 /* Finish up the entire symtab. */
186 #define tc_adjust_symtab() ppc_adjust_symtab ()
187 extern void ppc_adjust_symtab
PARAMS ((void));
189 /* Niclas Andersson <nican@ida.liu.se> says this is needed. */
190 #define SUB_SEGMENT_ALIGN(SEG) 2
192 #endif /* OBJ_XCOFF */
195 /* The name of the global offset table generated by the compiler. Allow
196 this to be overridden if need be. */
197 #ifndef GLOBAL_OFFSET_TABLE_NAME
198 #define GLOBAL_OFFSET_TABLE_NAME "_GLOBAL_OFFSET_TABLE_"
201 /* Branch prediction relocations must force relocation */
202 #define TC_FORCE_RELOCATION_SECTION(FIXP,SEC) \
203 ((FIXP)->fx_r_type == BFD_RELOC_PPC_B16_BRTAKEN \
204 || (FIXP)->fx_r_type == BFD_RELOC_PPC_B16_BRNTAKEN \
205 || (FIXP)->fx_r_type == BFD_RELOC_PPC_BA16_BRTAKEN \
206 || (FIXP)->fx_r_type == BFD_RELOC_PPC_BA16_BRNTAKEN \
207 || ((FIXP)->fx_addsy && !(FIXP)->fx_subsy && (FIXP)->fx_addsy->bsym \
208 && (FIXP)->fx_addsy->bsym->section != SEC))
210 /* Support for SHF_EXCLUDE and SHT_ORDERED */
211 extern int ppc_section_letter
PARAMS ((int, char **));
212 extern int ppc_section_type
PARAMS ((char **));
213 extern int ppc_section_word
PARAMS ((char **));
214 extern int ppc_section_flags
PARAMS ((int, int, int));
216 #define md_elf_section_letter(LETTER, PTR_MSG) ppc_section_letter (LETTER, PTR_MSG)
217 #define md_elf_section_type(PTR_STR) ppc_section_type (PTR_STR)
218 #define md_elf_section_word(PTR_STR) ppc_section_word (PTR_STR)
219 #define md_elf_section_flags(FLAGS, ATTR, TYPE) ppc_section_flags (FLAGS, ATTR, TYPE)
222 /* call md_apply_fix3 with segment instead of md_apply_fix */
223 #define MD_APPLY_FIX3
225 /* call md_pcrel_from_section, not md_pcrel_from */
226 #define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section(FIXP, SEC)
228 #define md_operand(x)