This commit was generated by cvs2svn to track changes on a CVS vendor
[deliverable/binutils-gdb.git] / gas / config / tc-sh64.h
1 /* This file is tc-sh64.h
2 Copyright (C) 2000, 2001 Free Software Foundation, Inc.
3
4 This file is part of GAS, the GNU Assembler.
5
6 GAS is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 GAS is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GAS; see the file COPYING. If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
20
21 #define TC_SH64
22 #include "config/tc-sh.h"
23 #include "elf/sh.h"
24
25 /* We need to override the tc-sh.h settings of HANDLE_ALIGN and
26 MAX_MEM_FOR_RS_ALIGN_CODE; we might need to put in SHmedia NOP:s, not
27 SHcompact NOP:s. */
28 #undef HANDLE_ALIGN
29 #define HANDLE_ALIGN(frag) sh64_handle_align (frag)
30 extern void sh64_handle_align PARAMS ((fragS *));
31
32 #undef MAX_MEM_FOR_RS_ALIGN_CODE
33 #define MAX_MEM_FOR_RS_ALIGN_CODE sh64_max_mem_for_rs_align_code ()
34 extern int sh64_max_mem_for_rs_align_code PARAMS ((void));
35
36 #undef LISTING_HEADER
37 #define LISTING_HEADER \
38 (target_big_endian ? \
39 "Hitachi SHcompact/SHmedia Big Endian GAS" \
40 : "Hitachi SHcompact/SHmedia Little Endian GAS")
41
42 /* We need to record the new frag position after an .align. */
43 extern void sh64_do_align PARAMS ((int, const char *, int, int));
44 #define md_do_align(n, fill, len, max, l) \
45 do { sh64_do_align (n, fill, len, max); goto l; } while (0)
46
47 struct sh64_segment_info_type
48 {
49 /* The type of the section is initialized when the range_start_symbol
50 member is non-NULL. */
51 symbolS *mode_start_symbol;
52 subsegT mode_start_subseg;
53
54 /* A stored symbol indicating location of last call of
55 "md_flush_pending_output". It is NULLed when we actually use it;
56 otherwise the contents is just filled in with segment, frag and
57 offset within frag. */
58 symbolS *last_contents_mark;
59
60 unsigned int emitted_ranges;
61 enum sh64_elf_cr_type contents_type;
62
63 /* This is used by the SH1-4 parts; we set it to 0 for SHmedia code and
64 data. */
65 unsigned int in_code : 1;
66 };
67
68 #undef TC_SEGMENT_INFO_TYPE
69 #define TC_SEGMENT_INFO_TYPE struct sh64_segment_info_type
70
71 #undef TARGET_FORMAT
72 #define TARGET_FORMAT sh64_target_format ()
73 extern const char *sh64_target_format PARAMS ((void));
74
75 #define TARGET_MACH sh64_target_mach ()
76 extern int sh64_target_mach PARAMS ((void));
77
78 #undef TC_RELOC_RTSYM_LOC_FIXUP
79 #define TC_RELOC_RTSYM_LOC_FIXUP(FIX) \
80 ((FIX)->fx_r_type != BFD_RELOC_32_PLT_PCREL \
81 && (FIX)->fx_r_type != BFD_RELOC_SH_PLT_LOW16 \
82 && (FIX)->fx_r_type != BFD_RELOC_SH_PLT_MEDLOW16 \
83 && (FIX)->fx_r_type != BFD_RELOC_SH_PLT_MEDHI16 \
84 && (FIX)->fx_r_type != BFD_RELOC_SH_PLT_HI16 \
85 && (FIX)->fx_r_type != BFD_RELOC_32_GOT_PCREL \
86 && (FIX)->fx_r_type != BFD_RELOC_SH_GOT_LOW16 \
87 && (FIX)->fx_r_type != BFD_RELOC_SH_GOT_MEDLOW16 \
88 && (FIX)->fx_r_type != BFD_RELOC_SH_GOT_MEDHI16 \
89 && (FIX)->fx_r_type != BFD_RELOC_SH_GOT_HI16 \
90 && (FIX)->fx_r_type != BFD_RELOC_SH_GOT10BY4 \
91 && (FIX)->fx_r_type != BFD_RELOC_SH_GOT10BY8 \
92 && (FIX)->fx_r_type != BFD_RELOC_SH_GOTPLT32 \
93 && (FIX)->fx_r_type != BFD_RELOC_SH_GOTPLT_LOW16 \
94 && (FIX)->fx_r_type != BFD_RELOC_SH_GOTPLT_MEDLOW16 \
95 && (FIX)->fx_r_type != BFD_RELOC_SH_GOTPLT_MEDHI16 \
96 && (FIX)->fx_r_type != BFD_RELOC_SH_GOTPLT_HI16 \
97 && (FIX)->fx_r_type != BFD_RELOC_SH_GOTPLT10BY4 \
98 && (FIX)->fx_r_type != BFD_RELOC_SH_GOTPLT10BY8 \
99 && (FIX)->fx_r_type != BFD_RELOC_SH_GOTPC \
100 && (FIX)->fx_r_type != BFD_RELOC_SH_GOTPC_LOW16 \
101 && (FIX)->fx_r_type != BFD_RELOC_SH_GOTPC_MEDLOW16 \
102 && (FIX)->fx_r_type != BFD_RELOC_SH_GOTPC_MEDHI16 \
103 && (FIX)->fx_r_type != BFD_RELOC_SH_GOTPC_HI16 \
104 && ((FIX)->fx_addsy == NULL \
105 || (! S_IS_EXTERNAL ((FIX)->fx_addsy) \
106 && ! S_IS_WEAK ((FIX)->fx_addsy) \
107 && S_IS_DEFINED ((FIX)->fx_addsy) \
108 && ! S_IS_COMMON ((FIX)->fx_addsy))))
109
110 /* Note the kludge: we want to put back C, and we also want to consume the
111 expression, since we have handled it ourselves. FIXME: What we really
112 need is a new GAS infrastructure feature: md_qualifier. */
113 #undef md_parse_name
114 #define md_parse_name(NAME, EXP, CP) \
115 sh64_consume_datalabel (NAME, EXP, CP, operand)
116 extern int sh64_consume_datalabel
117 PARAMS ((const char *, expressionS *, char *, segT (*) (expressionS *)));
118
119 /* Saying "$" is the same as saying ".". */
120 #define DOLLAR_DOT
121
122 #undef MD_PCREL_FROM_SECTION
123 #define MD_PCREL_FROM_SECTION(FIXP, SEC) \
124 shmedia_md_pcrel_from_section (FIXP, SEC)
125
126 extern valueT shmedia_md_pcrel_from_section PARAMS ((struct fix *, segT));
127
128 /* We need to mark this symbol as a BranchTarget; setting st_other for it
129 and adding 1 to its value (temporarily). */
130 extern void sh64_frob_label PARAMS ((symbolS *));
131
132 #undef tc_frob_label
133 #define tc_frob_label(sym) \
134 do { sh_frob_label (); sh64_frob_label (sym); } while (0)
135
136 #define tc_symbol_new_hook(s) sh64_frob_label (s)
137
138 /* We use this to mark our "datalabel" symbol copies. The "mark" is NULL
139 for an ordinary symbol, and the pointer to the "ordinary" symbol for a
140 datalabel symbol. */
141 #define TC_SYMFIELD_TYPE symbolS *
142
143 #define tc_frob_symbol(symp, punt) \
144 do \
145 { \
146 punt = sh64_exclude_symbol (symp); \
147 } \
148 while (0)
149
150 extern int sh64_exclude_symbol PARAMS ((symbolS *));
151
152 extern void sh64_adjust_symtab PARAMS ((void));
153 #define tc_adjust_symtab sh64_adjust_symtab
154
155 #undef md_flush_pending_output
156 #define md_flush_pending_output() sh64_flush_pending_output ()
157 extern void sh64_flush_pending_output PARAMS ((void));
158
159 /* Note that tc-sh.c has a sh_frob_section, but it's called from
160 tc_frob_file_before_adjust. */
161 #define tc_frob_section(sec) shmedia_frob_section_type (sec)
162 extern void shmedia_frob_section_type PARAMS ((asection *));
163
164 #define ELF_TC_SPECIAL_SECTIONS \
165 { ".cranges", SHT_PROGBITS, 0 },
166
167 /* We need to emit fixups relative to the frag in which the instruction
168 resides. Safest way without calculating max fragment growth or making
169 it a fixed number is to provide a pointer to the opcode frag.
170
171 We also need to emit the right NOP pattern in .align frags. This is
172 done after the text-to-bits assembly pass, so we need to mark it with
173 the ISA setting at the time the .align was assembled. */
174 #define TC_FRAG_TYPE struct sh64_tc_frag_data
175
176 enum sh64_isa_values
177 {
178 sh64_isa_unspecified,
179 sh64_isa_shcompact,
180 sh64_isa_shmedia,
181
182 /* Special guard value used in contexts when we don't know which ISA it
183 is, just that it's specified (not sh64_isa_unspecified). */
184 sh64_isa_sh5_guard
185 };
186
187 struct sh64_tc_frag_data
188 {
189 fragS *opc_frag;
190 enum sh64_isa_values isa;
191 };
192
193 extern enum sh64_isa_values sh64_isa_mode;
194
195 #define TC_FRAG_INIT(FRAGP) \
196 do \
197 { \
198 (FRAGP)->tc_frag_data.opc_frag = sh64_last_insn_frag; \
199 (FRAGP)->tc_frag_data.isa = sh64_isa_mode; \
200 } \
201 while (0)
202
203 /* This variable is set whenever we generate (or grow) a new opcode frag
204 in shmedia_build_Mytes. */
205 extern fragS *sh64_last_insn_frag;
206
207 #define md_end() shmedia_md_end ()
208 void shmedia_md_end PARAMS ((void));
209
210 /* Because we make .debug_line hold the SHmedia instruction address | 1,
211 we have to say we only have minimum byte-size insns. */
212 #undef DWARF2_LINE_MIN_INSN_LENGTH
213 #define DWARF2_LINE_MIN_INSN_LENGTH 1
This page took 0.059234 seconds and 5 git commands to generate.