Commit | Line | Data |
---|---|---|
3bcbcc3d | 1 | /* tc-cris.h -- Header file for tc-cris.c, the CRIS GAS port. |
20ee54e8 | 2 | Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2007 |
f17c130b | 3 | Free Software Foundation, Inc. |
3bcbcc3d HPN |
4 | |
5 | Contributed by Axis Communications AB, Lund, Sweden. | |
6 | Originally written for GAS 1.38.1 by Mikael Asker. | |
08caf3f8 | 7 | Updates, BFDizing, GNUifying and ELF by Hans-Peter Nilsson. |
3bcbcc3d HPN |
8 | |
9 | This file is part of GAS, the GNU Assembler. | |
10 | ||
11 | GAS is free software; you can redistribute it and/or modify | |
12 | it under the terms of the GNU General Public License as published by | |
ec2655a6 | 13 | the Free Software Foundation; either version 3, or (at your option) |
3bcbcc3d HPN |
14 | any later version. |
15 | ||
16 | GAS is distributed in the hope that it will be useful, | |
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 | GNU General Public License for more details. | |
20 | ||
21 | You should have received a copy of the GNU General Public License | |
22 | along with GAS; see the file COPYING. If not, write to the | |
4b4da160 NC |
23 | Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, |
24 | MA 02110-1301, USA. */ | |
3bcbcc3d HPN |
25 | |
26 | /* See the GAS "internal" document for general documentation on this. | |
27 | It is called internals.texi (internals.info when makeinfo:d), but is | |
28 | not installed or makeinfo:d by "make info". */ | |
29 | ||
30 | /* Functions and variables that aren't declared in tc.h are declared here, | |
31 | with the type/prototype that is used in the local extern-declaration of | |
32 | their usage. */ | |
33 | ||
34 | #ifndef TC_CRIS | |
35 | #define TC_CRIS | |
36 | ||
37 | /* Multi-target support is always on. */ | |
695a4822 | 38 | extern const char *cris_target_format (void); |
3bcbcc3d HPN |
39 | #define TARGET_FORMAT cris_target_format () |
40 | ||
41 | #define TARGET_ARCH bfd_arch_cris | |
42 | ||
695a4822 | 43 | extern unsigned int cris_mach (void); |
ae57792d HPN |
44 | #define TARGET_MACH (cris_mach ()) |
45 | ||
3bcbcc3d HPN |
46 | #define TARGET_BYTES_BIG_ENDIAN 0 |
47 | ||
48 | extern const char *md_shortopts; | |
49 | extern struct option md_longopts[]; | |
50 | extern size_t md_longopts_size; | |
51 | ||
52 | extern const pseudo_typeS md_pseudo_table[]; | |
53 | ||
54 | #define tc_comment_chars cris_comment_chars | |
55 | extern const char cris_comment_chars[]; | |
56 | extern const char line_comment_chars[]; | |
57 | extern const char line_separator_chars[]; | |
58 | extern const char EXP_CHARS[]; | |
59 | extern const char FLT_CHARS[]; | |
60 | ||
61 | /* This should be optional, since it is ignored as an escape (assumed to | |
62 | be itself) if it is not recognized. */ | |
63 | #define ONLY_STANDARD_ESCAPES | |
64 | ||
65 | /* Note that we do not define TC_EQUAL_IN_INSN, since its current use is | |
66 | in the instruction rather than the operand, and thus does not come to | |
67 | use for side-effect assignments such as "and.d [r0 = r1 + 42], r3". */ | |
68 | #define md_operand(x) | |
69 | ||
70 | #define md_number_to_chars number_to_chars_littleendian | |
3bcbcc3d HPN |
71 | extern const struct relax_type md_cris_relax_table[]; |
72 | #define TC_GENERIC_RELAX_TABLE md_cris_relax_table | |
73 | ||
695a4822 | 74 | long cris_relax_frag (segT, fragS *, long); |
1c971160 HPN |
75 | |
76 | /* GAS only handles relaxations for pc-relative data targeting addresses | |
77 | in the same segment, so we have to handle the rest on our own. */ | |
78 | #define md_relax_frag(SEG, FRAGP, STRETCH) \ | |
79 | ((FRAGP)->fr_symbol != NULL \ | |
80 | && S_GET_SEGMENT ((FRAGP)->fr_symbol) == (SEG) \ | |
81 | ? relax_frag (SEG, FRAGP, STRETCH) \ | |
82 | : cris_relax_frag (SEG, FRAGP, STRETCH)) | |
83 | ||
a161fe53 | 84 | #define TC_FORCE_RELOCATION(FIX) md_cris_force_relocation (FIX) |
695a4822 | 85 | extern int md_cris_force_relocation (struct fix *); |
3bcbcc3d | 86 | |
a161fe53 AM |
87 | #define IS_CRIS_PIC_RELOC(RTYPE) \ |
88 | ((RTYPE) == BFD_RELOC_CRIS_16_GOT \ | |
89 | || (RTYPE) == BFD_RELOC_CRIS_32_GOT \ | |
90 | || (RTYPE) == BFD_RELOC_CRIS_16_GOTPLT \ | |
91 | || (RTYPE) == BFD_RELOC_CRIS_32_GOTPLT \ | |
92 | || (RTYPE) == BFD_RELOC_CRIS_32_GOTREL \ | |
93 | || (RTYPE) == BFD_RELOC_CRIS_32_PLT_GOTREL \ | |
94 | || (RTYPE) == BFD_RELOC_CRIS_32_PLT_PCREL) | |
95 | ||
96 | /* Make sure we don't resolve fixups for which we want to emit dynamic | |
20ee54e8 | 97 | relocations. */ |
a161fe53 AM |
98 | #define TC_FORCE_RELOCATION_LOCAL(FIX) \ |
99 | (!(FIX)->fx_pcrel \ | |
a161fe53 AM |
100 | || IS_CRIS_PIC_RELOC ((FIX)->fx_r_type) \ |
101 | || TC_FORCE_RELOCATION (FIX)) | |
102 | ||
103 | /* For some reloc types, don't adjust fixups by reducing to a section | |
104 | symbol. */ | |
105 | #define tc_fix_adjustable(FIX) \ | |
106 | ((FIX)->fx_r_type != BFD_RELOC_VTABLE_INHERIT \ | |
107 | && (FIX)->fx_r_type != BFD_RELOC_VTABLE_ENTRY \ | |
108 | && (! IS_CRIS_PIC_RELOC ((FIX)->fx_r_type) \ | |
109 | || (FIX)->fx_r_type == BFD_RELOC_CRIS_32_GOTREL)) | |
3bcbcc3d | 110 | |
d8b19f1a HPN |
111 | /* FIXME: This *should* be a redundant definition, as the |
112 | TC_FORCE_RELOCATION* definitions already told about the cases where | |
113 | we *don't* want the symbol value calculated. Here we seem to answer | |
114 | the "are you sure" question. It certainly has very little to do with | |
115 | whether the symbol value is passed to md_apply_fix. */ | |
116 | #define MD_APPLY_SYM_VALUE(FIX) 0 | |
117 | ||
3bcbcc3d HPN |
118 | /* When we have fixups against constant expressions, we get a GAS-specific |
119 | section symbol at no extra charge for obscure reasons in | |
120 | adjust_reloc_syms. Since ELF outputs section symbols, it gladly | |
08caf3f8 HPN |
121 | outputs this "*ABS*" symbol in every object. Avoid that. |
122 | Also, don't emit undefined symbols (that aren't used in relocations). | |
123 | They pop up when tentatively parsing register names as symbols. */ | |
3bcbcc3d HPN |
124 | #define tc_frob_symbol(symp, punt) \ |
125 | do { \ | |
08caf3f8 HPN |
126 | if ((OUTPUT_FLAVOR == bfd_target_elf_flavour \ |
127 | && (symp) == section_symbol (absolute_section)) \ | |
128 | || ! S_IS_DEFINED (symp)) \ | |
3bcbcc3d HPN |
129 | (punt) = 1; \ |
130 | } while (0) | |
131 | ||
132 | #define LISTING_HEADER "GAS for CRIS" | |
133 | ||
134 | #if 0 | |
135 | /* The testsuite does not let me define these, although they IMHO should | |
136 | be preferred over the default. */ | |
137 | #define LISTING_WORD_SIZE 2 | |
138 | #define LISTING_LHS_WIDTH 4 | |
139 | #define LISTING_LHS_WIDTH_SECOND 4 | |
140 | #endif | |
141 | ||
142 | /* END of declaration and definitions described in the "internals" | |
143 | document. */ | |
144 | ||
145 | /* Do this, or we will never know what hit us when the | |
146 | broken-word-fixes break. Do _not_ use WARN_SIGNED_OVERFLOW_WORD, | |
147 | it is only for use with WORKING_DOT_WORD and warns about most stuff. | |
148 | (still in 2.9.1). */ | |
149 | struct broken_word; | |
695a4822 HPN |
150 | extern void tc_cris_check_adjusted_broken_word (offsetT, |
151 | struct broken_word *); | |
3bcbcc3d HPN |
152 | #define TC_CHECK_ADJUSTED_BROKEN_DOT_WORD(new_offset, brokw) \ |
153 | tc_cris_check_adjusted_broken_word ((offsetT) (new_offset), brokw) | |
154 | ||
155 | /* We don't want any implicit alignment, so we do nothing. */ | |
f17c130b | 156 | #define TC_IMPLICIT_LCOMM_ALIGNMENT(SIZE, P2VAR) do { } while (0) |
3bcbcc3d | 157 | |
fcdc20a4 HPN |
158 | /* CRIS instructions, with operands and prefixes included, are a multiple |
159 | of two bytes long. */ | |
160 | #define DWARF2_LINE_MIN_INSN_LENGTH 2 | |
161 | ||
399f703e HPN |
162 | /* Make port immune to unwanted difference in te-generic.h vs. te-linux.h. */ |
163 | #define LOCAL_LABELS_DOLLAR 1 | |
164 | ||
3bcbcc3d HPN |
165 | #endif /* TC_CRIS */ |
166 | /* | |
167 | * Local variables: | |
168 | * eval: (c-set-style "gnu") | |
169 | * indent-tabs-mode: t | |
170 | * End: | |
171 | */ |