* config/obj-coff.h (TC_SPARC): Don't define TARGET_FORMAT.
[deliverable/binutils-gdb.git] / gas / config / tc-ppc.h
CommitLineData
da8fa3ba 1/* tc-ppc.h -- Header file for tc-ppc.c.
24a3e622 2 Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
da8fa3ba
MM
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
af16e411
FF
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. */
da8fa3ba
MM
21
22#define TC_PPC
23
24a3e622
ILT
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
da8fa3ba
MM
33#ifndef BFD_ASSEMBLER
34 #error PowerPC support requires BFD_ASSEMBLER
35#endif
36
18c9057f 37/* If OBJ_COFF is defined, and TE_PE is not defined, we are assembling
f99d287b
MM
38 XCOFF for AIX or PowerMac. If TE_PE is defined, we are assembling
39 COFF for Windows NT. */
18c9057f
ILT
40
41#ifdef OBJ_COFF
42#ifndef TE_PE
43#define OBJ_XCOFF
44#endif
45#endif
46
da8fa3ba
MM
47/* The target BFD architecture. */
48#define TARGET_ARCH (ppc_arch ())
49extern enum bfd_architecture ppc_arch PARAMS ((void));
50
65c91be5
MM
51/* Whether or not the target is big endian */
52extern int target_big_endian;
53
da8fa3ba
MM
54/* The target BFD format. */
55#ifdef OBJ_COFF
1d854da6 56#ifdef TE_PE
18c9057f 57#define TARGET_FORMAT (target_big_endian ? "pe-powerpc" : "pe-powerpcle")
1d854da6 58#else
da8fa3ba
MM
59#define TARGET_FORMAT "aixcoff-rs6000"
60#endif
1d854da6
KK
61#endif
62
f99d287b
MM
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
da8fa3ba 71#ifdef OBJ_ELF
18c9057f 72#define TARGET_FORMAT (target_big_endian ? "elf32-powerpc" : "elf32-powerpcle")
da8fa3ba
MM
73#endif
74
75/* Permit temporary numeric labels. */
9777b772 76#define LOCAL_LABELS_FB 1
da8fa3ba
MM
77
78/* $ is used to refer to the current location. */
79#define DOLLAR_DOT
80
9777b772
KR
81/* Strings do not use backslash escapes under COFF. */
82#ifdef OBJ_COFF
da8fa3ba 83#define NO_STRING_ESCAPES
9777b772 84#endif
da8fa3ba 85
da8fa3ba 86#ifdef OBJ_ELF
9777b772 87#define DIFF_EXPR_OK /* .-foo gets turned into PC relative relocs */
da8fa3ba
MM
88#endif
89
af16e411 90#if TARGET_BYTES_BIG_ENDIAN
da8fa3ba
MM
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
18c9057f
ILT
102#ifdef TE_PE
103
104/* Question marks are permitted in symbol names. */
105#define LEX_QM 1
106
96fe71e1
MM
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
18c9057f
ILT
111#endif
112
113#ifdef OBJ_XCOFF
da8fa3ba
MM
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. */
124 struct symbol *next;
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. */
140 struct symbol *size;
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. */
144 struct symbol *within;
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)
161extern void ppc_symbol_new_hook PARAMS ((struct symbol *));
162
163/* Set the symbol class of a label based on the csect. */
164#define tc_frob_label(sym) ppc_frob_label (sym)
165extern void ppc_frob_label PARAMS ((struct symbol *));
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
af16e411
FF
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
da8fa3ba
MM
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)
181extern int ppc_frob_symbol PARAMS ((struct symbol *));
182
f99d287b
MM
183/* Finish up the entire symtab. */
184#define tc_adjust_symtab() ppc_adjust_symtab ()
185extern void ppc_adjust_symtab PARAMS ((void));
186
65c91be5
MM
187/* Niclas Andersson <nican@ida.liu.se> says this is needed. */
188#define SUB_SEGMENT_ALIGN(SEG) 2
189
18c9057f 190#endif /* OBJ_XCOFF */
da8fa3ba
MM
191
192#ifdef OBJ_ELF
d006e435
MM
193/* The name of the global offset table generated by the compiler. Allow
194 this to be overridden if need be. */
195#ifndef GLOBAL_OFFSET_TABLE_NAME
196#define GLOBAL_OFFSET_TABLE_NAME "_GLOBAL_OFFSET_TABLE_"
197#endif
198
65c91be5 199/* Branch prediction relocations must force relocation */
96fe71e1 200#define TC_FORCE_RELOCATION_SECTION(FIXP,SEC) \
65c91be5
MM
201((FIXP)->fx_r_type == BFD_RELOC_PPC_B16_BRTAKEN \
202 || (FIXP)->fx_r_type == BFD_RELOC_PPC_B16_BRNTAKEN \
203 || (FIXP)->fx_r_type == BFD_RELOC_PPC_BA16_BRTAKEN \
96fe71e1
MM
204 || (FIXP)->fx_r_type == BFD_RELOC_PPC_BA16_BRNTAKEN \
205 || ((FIXP)->fx_addsy && !(FIXP)->fx_subsy && (FIXP)->fx_addsy->bsym \
206 && (FIXP)->fx_addsy->bsym->section != SEC))
65c91be5 207
f99d287b
MM
208/* Support for SHF_EXCLUDE and SHT_ORDERED */
209extern int ppc_section_letter PARAMS ((int, char **));
210extern int ppc_section_type PARAMS ((char **));
211extern int ppc_section_word PARAMS ((char **));
212extern int ppc_section_flags PARAMS ((int, int, int));
213
214#define md_elf_section_letter(LETTER, PTR_MSG) ppc_section_letter (LETTER, PTR_MSG)
215#define md_elf_section_type(PTR_STR) ppc_section_type (PTR_STR)
216#define md_elf_section_word(PTR_STR) ppc_section_word (PTR_STR)
217#define md_elf_section_flags(FLAGS, ATTR, TYPE) ppc_section_flags (FLAGS, ATTR, TYPE)
af16e411
FF
218
219/* Add extra PPC sections -- Note, for now, make .sbss2 and .PPC.EMB.sbss0 a
220 normal section, and not a bss section so that the linker doesn't crater
221 when trying to make more than 2 sections. */
222#define ELF_TC_SPECIAL_SECTIONS \
223 { ".tags", SHT_ORDERED, SHF_ALLOC }, \
224 { ".sdata", SHT_PROGBITS, SHF_ALLOC + SHF_WRITE }, \
225 { ".sbss", SHT_NOBITS, SHF_ALLOC + SHF_WRITE }, \
226 { ".sdata2", SHT_PROGBITS, SHF_ALLOC }, \
227 { ".sbss2", SHT_PROGBITS, SHF_ALLOC }, \
228 { ".PPC.EMB.sdata0", SHT_PROGBITS, SHF_ALLOC }, \
229 { ".PPC.EMB.sbss0", SHT_PROGBITS, SHF_ALLOC },
230
231#define tc_comment_chars ppc_comment_chars
232extern const char *ppc_comment_chars;
233
d006e435
MM
234/* Keep relocations relative to the GOT. */
235#define tc_fix_adjustable(FIX) \
236 ((FIX)->fx_r_type != BFD_RELOC_16_GOTOFF \
237 && (FIX)->fx_r_type != BFD_RELOC_LO16_GOTOFF \
238 && (FIX)->fx_r_type != BFD_RELOC_HI16_GOTOFF \
239 && (FIX)->fx_r_type != BFD_RELOC_HI16_S_GOTOFF \
240 && (FIX)->fx_r_type != BFD_RELOC_GPREL16)
9777b772
KR
241#endif /* OBJ_ELF */
242
243/* call md_apply_fix3 with segment instead of md_apply_fix */
244#define MD_APPLY_FIX3
245
96fe71e1
MM
246/* call md_pcrel_from_section, not md_pcrel_from */
247#define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section(FIXP, SEC)
24a3e622 248extern long md_pcrel_from_section PARAMS ((struct fix *, segT));
96fe71e1 249
af16e411
FF
250#define md_parse_name(name, exp) ppc_parse_name (name, exp)
251extern int ppc_parse_name PARAMS ((const char *, struct expressionS *));
252
9777b772 253#define md_operand(x)
f99d287b 254
This page took 0.107702 seconds and 4 git commands to generate.