| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
#define TC_SH64 |
| 22 |
#include "config/tc-sh.h" |
| 23 |
#include "elf/sh.h" |
| 24 |
#include "elf32-sh64.h" |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
#undef HANDLE_ALIGN |
| 30 |
#define HANDLE_ALIGN(frag) sh64_handle_align (frag) |
| 31 |
extern void sh64_handle_align (fragS *); |
| 32 |
|
| 33 |
#undef MAX_MEM_FOR_RS_ALIGN_CODE |
| 34 |
#define MAX_MEM_FOR_RS_ALIGN_CODE sh64_max_mem_for_rs_align_code () |
| 35 |
extern int sh64_max_mem_for_rs_align_code (void); |
| 36 |
|
| 37 |
#undef LISTING_HEADER |
| 38 |
#define LISTING_HEADER \ |
| 39 |
(target_big_endian ? \ |
| 40 |
"SuperH SHcompact/SHmedia Big Endian GAS" \ |
| 41 |
: "SuperH SHcompact/SHmedia Little Endian GAS") |
| 42 |
|
| 43 |
|
| 44 |
extern void sh64_do_align (int, const char *, int, int); |
| 45 |
#define md_do_align(n, fill, len, max, l) \ |
| 46 |
do { sh64_do_align (n, fill, len, max); goto l; } while (0) |
| 47 |
|
| 48 |
struct sh64_segment_info_type |
| 49 |
{ |
| 50 |
|
| 51 |
|
| 52 |
symbolS *mode_start_symbol; |
| 53 |
subsegT mode_start_subseg; |
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
symbolS *last_contents_mark; |
| 60 |
|
| 61 |
unsigned int emitted_ranges; |
| 62 |
enum sh64_elf_cr_type contents_type; |
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
unsigned int in_code : 1; |
| 67 |
}; |
| 68 |
|
| 69 |
#undef TC_SEGMENT_INFO_TYPE |
| 70 |
#define TC_SEGMENT_INFO_TYPE struct sh64_segment_info_type |
| 71 |
|
| 72 |
#undef TARGET_FORMAT |
| 73 |
#define TARGET_FORMAT sh64_target_format () |
| 74 |
extern const char *sh64_target_format (void); |
| 75 |
|
| 76 |
#define TARGET_MACH sh64_target_mach () |
| 77 |
extern int sh64_target_mach (void); |
| 78 |
|
| 79 |
#undef TC_FORCE_RELOCATION_LOCAL |
| 80 |
#define TC_FORCE_RELOCATION_LOCAL(FIX) \ |
| 81 |
(!(FIX)->fx_pcrel \ |
| 82 |
|| (FIX)->fx_plt \ |
| 83 |
|| (FIX)->fx_r_type == BFD_RELOC_32_PLT_PCREL \ |
| 84 |
|| (FIX)->fx_r_type == BFD_RELOC_SH_PLT_LOW16 \ |
| 85 |
|| (FIX)->fx_r_type == BFD_RELOC_SH_PLT_MEDLOW16 \ |
| 86 |
|| (FIX)->fx_r_type == BFD_RELOC_SH_PLT_MEDHI16 \ |
| 87 |
|| (FIX)->fx_r_type == BFD_RELOC_SH_PLT_HI16 \ |
| 88 |
|| (FIX)->fx_r_type == BFD_RELOC_32_GOT_PCREL \ |
| 89 |
|| (FIX)->fx_r_type == BFD_RELOC_SH_GOT_LOW16 \ |
| 90 |
|| (FIX)->fx_r_type == BFD_RELOC_SH_GOT_MEDLOW16 \ |
| 91 |
|| (FIX)->fx_r_type == BFD_RELOC_SH_GOT_MEDHI16 \ |
| 92 |
|| (FIX)->fx_r_type == BFD_RELOC_SH_GOT_HI16 \ |
| 93 |
|| (FIX)->fx_r_type == BFD_RELOC_SH_GOT10BY4 \ |
| 94 |
|| (FIX)->fx_r_type == BFD_RELOC_SH_GOT10BY8 \ |
| 95 |
|| (FIX)->fx_r_type == BFD_RELOC_SH_GOTPLT32 \ |
| 96 |
|| (FIX)->fx_r_type == BFD_RELOC_SH_GOTPLT_LOW16 \ |
| 97 |
|| (FIX)->fx_r_type == BFD_RELOC_SH_GOTPLT_MEDLOW16 \ |
| 98 |
|| (FIX)->fx_r_type == BFD_RELOC_SH_GOTPLT_MEDHI16 \ |
| 99 |
|| (FIX)->fx_r_type == BFD_RELOC_SH_GOTPLT_HI16 \ |
| 100 |
|| (FIX)->fx_r_type == BFD_RELOC_SH_GOTPLT10BY4 \ |
| 101 |
|| (FIX)->fx_r_type == BFD_RELOC_SH_GOTPLT10BY8 \ |
| 102 |
|| (FIX)->fx_r_type == BFD_RELOC_SH_GOTPC \ |
| 103 |
|| (FIX)->fx_r_type == BFD_RELOC_SH_GOTPC_LOW16 \ |
| 104 |
|| (FIX)->fx_r_type == BFD_RELOC_SH_GOTPC_MEDLOW16 \ |
| 105 |
|| (FIX)->fx_r_type == BFD_RELOC_SH_GOTPC_MEDHI16 \ |
| 106 |
|| (FIX)->fx_r_type == BFD_RELOC_SH_GOTPC_HI16 \ |
| 107 |
|| TC_FORCE_RELOCATION (FIX)) |
| 108 |
|
| 109 |
#undef TC_FORCE_RELOCATION_SUB_SAME |
| 110 |
#define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEC) \ |
| 111 |
(! SEG_NORMAL (SEC) \ |
| 112 |
|| TC_FORCE_RELOCATION (FIX) \ |
| 113 |
|| (sh_relax && SWITCH_TABLE (FIX)) \ |
| 114 |
|| *symbol_get_tc ((FIX)->fx_addsy) != NULL) |
| 115 |
|
| 116 |
|
| 117 |
#undef TC_VALIDATE_FIX_SUB |
| 118 |
#define TC_VALIDATE_FIX_SUB(FIX) \ |
| 119 |
((FIX)->fx_r_type == BFD_RELOC_32_PLT_PCREL \ |
| 120 |
|| (sh_relax && SWITCH_TABLE (FIX)) \ |
| 121 |
|| *symbol_get_tc ((FIX)->fx_addsy) != NULL) |
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
#undef md_parse_name |
| 127 |
#define md_parse_name(NAME, EXP, CP) \ |
| 128 |
sh64_consume_datalabel (NAME, EXP, CP, operand) |
| 129 |
extern int sh64_consume_datalabel (const char *, expressionS *, char *, |
| 130 |
segT (*) (expressionS *)); |
| 131 |
|
| 132 |
|
| 133 |
#define DOLLAR_DOT |
| 134 |
|
| 135 |
#undef MD_PCREL_FROM_SECTION |
| 136 |
#define MD_PCREL_FROM_SECTION(FIX, SEC) \ |
| 137 |
shmedia_md_pcrel_from_section (FIX, SEC) |
| 138 |
|
| 139 |
extern valueT shmedia_md_pcrel_from_section (struct fix *, segT); |
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
extern void sh64_frob_label (symbolS *); |
| 144 |
|
| 145 |
#undef tc_frob_label |
| 146 |
#define tc_frob_label(sym) \ |
| 147 |
do { sh_frob_label (); sh64_frob_label (sym); } while (0) |
| 148 |
|
| 149 |
#define tc_symbol_new_hook(s) sh64_frob_label (s) |
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
#define TC_SYMFIELD_TYPE symbolS * |
| 155 |
|
| 156 |
#define tc_frob_symbol(symp, punt) \ |
| 157 |
do \ |
| 158 |
{ \ |
| 159 |
punt = sh64_exclude_symbol (symp); \ |
| 160 |
} \ |
| 161 |
while (0) |
| 162 |
|
| 163 |
extern int sh64_exclude_symbol (symbolS *); |
| 164 |
|
| 165 |
extern void sh64_adjust_symtab (void); |
| 166 |
#define tc_adjust_symtab sh64_adjust_symtab |
| 167 |
|
| 168 |
#undef md_flush_pending_output |
| 169 |
#define md_flush_pending_output() sh64_flush_pending_output () |
| 170 |
extern void sh64_flush_pending_output (void); |
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
#define tc_frob_section(sec) shmedia_frob_section_type (sec) |
| 175 |
extern void shmedia_frob_section_type (asection *); |
| 176 |
|
| 177 |
|
| 178 |
|
| 179 |
|
| 180 |
|
| 181 |
|
| 182 |
|
| 183 |
|
| 184 |
#define TC_FRAG_TYPE struct sh64_tc_frag_data |
| 185 |
|
| 186 |
enum sh64_isa_values |
| 187 |
{ |
| 188 |
sh64_isa_unspecified, |
| 189 |
sh64_isa_shcompact, |
| 190 |
sh64_isa_shmedia, |
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
sh64_isa_sh5_guard |
| 195 |
}; |
| 196 |
|
| 197 |
struct sh64_tc_frag_data |
| 198 |
{ |
| 199 |
fragS *opc_frag; |
| 200 |
enum sh64_isa_values isa; |
| 201 |
}; |
| 202 |
|
| 203 |
extern enum sh64_isa_values sh64_isa_mode; |
| 204 |
|
| 205 |
#define TC_FRAG_INIT(FRAGP) \ |
| 206 |
do \ |
| 207 |
{ \ |
| 208 |
(FRAGP)->tc_frag_data.opc_frag = sh64_last_insn_frag; \ |
| 209 |
(FRAGP)->tc_frag_data.isa = sh64_isa_mode; \ |
| 210 |
} \ |
| 211 |
while (0) |
| 212 |
|
| 213 |
|
| 214 |
|
| 215 |
extern fragS *sh64_last_insn_frag; |
| 216 |
|
| 217 |
#define md_end() shmedia_md_end () |
| 218 |
void shmedia_md_end (void); |
| 219 |
|
| 220 |
|
| 221 |
|
| 222 |
#undef DWARF2_LINE_MIN_INSN_LENGTH |
| 223 |
#define DWARF2_LINE_MIN_INSN_LENGTH 1 |