* as.h (LOCAL_LABELS_DOLLAR, LOCAL_LABELS_FB): If not already defined, define
[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, 675 Mass Ave, Cambridge, MA 02139, 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 /* The target BFD format. */
32 #ifdef OBJ_COFF
33 #define TARGET_FORMAT "aixcoff-rs6000"
34 #endif
35 #ifdef OBJ_ELF
36 #define TARGET_FORMAT "elf32-powerpc"
37 #endif
38
39 /* Permit temporary numeric labels. */
40 #define LOCAL_LABELS_FB 1
41
42 /* $ is used to refer to the current location. */
43 #define DOLLAR_DOT
44
45 /* Strings do not use backslash escapes under COFF. */
46 #ifdef OBJ_COFF
47 #define NO_STRING_ESCAPES
48 #endif
49
50 /* When using COFF, we determine whether or not to output a symbol
51 based on sy_tc.output, not on the name. */
52 #ifdef OBJ_COFF
53 #define LOCAL_LABEL(name) 0
54 #endif
55 #ifdef OBJ_ELF
56 /* When using ELF, local labels start with '.'. */
57 #define LOCAL_LABEL(name) (name[0] == '.' \
58 && (name[1] == 'L' || name[1] == '.'))
59 #define FAKE_LABEL_NAME ".L0\001"
60 #define DIFF_EXPR_OK /* .-foo gets turned into PC relative relocs */
61 #endif
62
63 /* Set the endianness we are using. Default to big endian. */
64 #ifndef TARGET_BYTES_BIG_ENDIAN
65 #ifndef TARGET_BYTES_LITTLE_ENDIAN
66 #define TARGET_BYTES_BIG_ENDIAN
67 #endif
68 #endif
69
70 #ifdef TARGET_BYTES_BIG_ENDIAN
71 #define PPC_BIG_ENDIAN 1
72 #else
73 #define PPC_BIG_ENDIAN 0
74 #endif
75
76 /* We don't need to handle .word strangely. */
77 #define WORKING_DOT_WORD
78
79 /* We set the fx_done field appropriately in md_apply_fix. */
80 #define TC_HANDLES_FX_DONE
81 \f
82 #ifdef OBJ_COFF
83
84 /* Declarations needed when generating XCOFF code. XCOFF is an
85 extension of COFF, used only on the RS/6000. Rather than create an
86 obj-xcoff, we just use obj-coff, and handle the extensions here in
87 tc-ppc. */
88
89 /* We need to keep some information for symbols. */
90 struct ppc_tc_sy
91 {
92 /* We keep a few linked lists of symbols. */
93 struct symbol *next;
94 /* Non-zero if the symbol should be output. The RS/6000 assembler
95 only outputs symbols that are external or are mentioned in a
96 .globl or .lglobl statement. */
97 int output;
98 /* The symbol class. */
99 int class;
100 /* The real name, if the symbol was renamed. */
101 char *real_name;
102 /* For a csect symbol, the subsegment we are using. This is zero
103 for symbols that are not csects. */
104 subsegT subseg;
105 /* For a csect or common symbol, the alignment to use. */
106 int align;
107 /* For a function symbol, a symbol whose value is the size. The
108 field is NULL if there is no size. */
109 struct symbol *size;
110 /* For a csect symbol, the last symbol which has been defined in
111 this csect, or NULL if none have been defined so far. For a .bs
112 symbol, the referenced csect symbol. */
113 struct symbol *within;
114 };
115
116 #define TC_SYMFIELD_TYPE struct ppc_tc_sy
117
118 /* We need an additional auxent for function symbols. */
119 #define OBJ_COFF_MAX_AUXENTRIES 2
120
121 /* Square and curly brackets are permitted in symbol names. */
122 #define LEX_BR 3
123
124 /* Canonicalize the symbol name. */
125 #define tc_canonicalize_symbol_name(name) ppc_canonicalize_symbol_name (name)
126 extern char *ppc_canonicalize_symbol_name PARAMS ((char *));
127
128 /* Get the symbol class from the name. */
129 #define tc_symbol_new_hook(sym) ppc_symbol_new_hook (sym)
130 extern void ppc_symbol_new_hook PARAMS ((struct symbol *));
131
132 /* Set the symbol class of a label based on the csect. */
133 #define tc_frob_label(sym) ppc_frob_label (sym)
134 extern void ppc_frob_label PARAMS ((struct symbol *));
135
136 /* TOC relocs requires special handling. */
137 #define tc_fix_adjustable(fixp) ppc_fix_adjustable (fixp)
138 extern int ppc_fix_adjustable PARAMS ((struct fix *));
139
140 /* We need to set the section VMA. */
141 #define tc_frob_section(sec) ppc_frob_section (sec)
142 extern void ppc_frob_section PARAMS ((asection *));
143
144 /* Finish up the symbol. */
145 #define tc_frob_symbol(sym, punt) punt = ppc_frob_symbol (sym)
146 extern int ppc_frob_symbol PARAMS ((struct symbol *));
147
148 /* Finish up the file. */
149 #define tc_frob_file() ppc_frob_file ()
150 extern void ppc_frob_file PARAMS ((void));
151
152 #endif /* OBJ_COFF */
153
154 #ifdef OBJ_ELF
155 /* The name of the global offset table generated by the compiler. Allow
156 this to be overridden if need be. */
157 #ifndef GLOBAL_OFFSET_TABLE_NAME
158 #define GLOBAL_OFFSET_TABLE_NAME "_GLOBAL_OFFSET_TABLE_"
159 #endif
160 #endif /* OBJ_ELF */
161
162 /* call md_apply_fix3 with segment instead of md_apply_fix */
163 #define MD_APPLY_FIX3
164
165 #define md_operand(x)