Commit | Line | Data |
---|---|---|
252b5132 | 1 | /* tc-mn10300.h -- Header file for tc-mn10300.c. |
66a4ad42 | 2 | Copyright 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005, 2007 |
ae6063d4 | 3 | Free Software Foundation, Inc. |
252b5132 RH |
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 | |
ec2655a6 | 9 | the Free Software Foundation; either version 3, or (at your option) |
252b5132 RH |
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 the Free | |
4b4da160 NC |
19 | Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA |
20 | 02110-1301, USA. */ | |
252b5132 RH |
21 | |
22 | #define TC_MN10300 | |
23 | ||
24 | #define TARGET_BYTES_BIG_ENDIAN 0 | |
25 | ||
bf6f0d0c AO |
26 | #define DIFF_EXPR_OK |
27 | #define GLOBAL_OFFSET_TABLE_NAME "_GLOBAL_OFFSET_TABLE_" | |
28 | ||
b5f5fd96 NC |
29 | #define TC_FORCE_RELOCATION(FIX) mn10300_force_relocation (FIX) |
30 | extern bfd_boolean mn10300_force_relocation (struct fix *); | |
66a4ad42 AM |
31 | |
32 | #define TC_FORCE_RELOCATION_LOCAL(FIX) \ | |
33 | (!(FIX)->fx_pcrel \ | |
34 | || (FIX)->fx_r_type == BFD_RELOC_32_PLT_PCREL \ | |
35 | || (FIX)->fx_r_type == BFD_RELOC_MN10300_GOT32 \ | |
36 | || (FIX)->fx_r_type == BFD_RELOC_32_GOT_PCREL \ | |
37 | || TC_FORCE_RELOCATION (FIX)) | |
bf6f0d0c | 38 | |
b5f5fd96 NC |
39 | #define md_parse_name(NAME, EXPRP, MODE, NEXTCHARP) \ |
40 | mn10300_parse_name ((NAME), (EXPRP), (MODE), (NEXTCHARP)) | |
41 | int mn10300_parse_name (char const *, expressionS *, enum expr_mode, char *); | |
bf6f0d0c AO |
42 | |
43 | #define TC_CONS_FIX_NEW(FRAG, OFF, LEN, EXP) \ | |
44 | mn10300_cons_fix_new ((FRAG), (OFF), (LEN), (EXP)) | |
b5f5fd96 | 45 | void mn10300_cons_fix_new (fragS *, int, int, expressionS *); |
bf6f0d0c AO |
46 | |
47 | /* This is used to construct expressions out of @GOTOFF, @PLT and @GOT | |
48 | symbols. The relocation type is stored in X_md. */ | |
49 | #define O_PIC_reloc O_md1 | |
50 | ||
252b5132 RH |
51 | /* The target BFD architecture. */ |
52 | #define TARGET_ARCH bfd_arch_mn10300 | |
53 | ||
2ce28d43 AO |
54 | #ifdef TE_LINUX |
55 | #define TARGET_FORMAT "elf32-am33lin" | |
56 | #else | |
252b5132 | 57 | #define TARGET_FORMAT "elf32-mn10300" |
2ce28d43 | 58 | #endif |
252b5132 | 59 | |
a161fe53 | 60 | |
a161fe53 AM |
61 | /* Do not adjust relocations involving symbols in code sections, |
62 | because it breaks linker relaxations. This could be fixed in the | |
63 | linker, but this fix is simpler, and it pretty much only affects | |
64 | object size a little bit. */ | |
ae6063d4 AM |
65 | #define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEC) \ |
66 | (((SEC)->flags & SEC_CODE) != 0 \ | |
67 | || ! SEG_NORMAL (SEC) \ | |
569006e5 | 68 | || (FIX)->fx_r_type == BFD_RELOC_MN10300_ALIGN \ |
ae6063d4 | 69 | || TC_FORCE_RELOCATION (FIX)) |
58a77e41 | 70 | |
074d08b0 AO |
71 | /* We validate subtract arguments within tc_gen_reloc(), so don't |
72 | report errors at this point. */ | |
73 | #define TC_VALIDATE_FIX_SUB(FIX) 1 | |
74 | ||
75 | /* Fixup debug sections since we will never relax them. Ideally, we | |
76 | could do away with this and instead check every single fixup with | |
77 | TC_FORCE_RELOCATION and TC_FORCE_RELOCATION_SUB_NAME, verifying | |
78 | that the sections of the referenced symbols (and not the sections | |
79 | in which the fixup appears) may be subject to relaxation. We'd | |
80 | still have to check the section in which the fixup appears, because | |
81 | we want to do some simplifications in debugging info that might | |
82 | break in real code. | |
83 | ||
84 | Using the infrastructure in write.c to simplify subtraction fixups | |
85 | would enable us to remove a lot of code from tc_gen_reloc(), but | |
86 | this is simpler, faster, and produces almost the same effect. | |
87 | Also, in the macros above, we can't check whether the fixup is in a | |
88 | debugging section or not, so we have to use this for now. */ | |
58a77e41 EC |
89 | #define TC_LINKRELAX_FIXUP(seg) (seg->flags & SEC_ALLOC) |
90 | ||
252b5132 RH |
91 | #define md_operand(x) |
92 | ||
93 | /* Permit temporary numeric labels. */ | |
94 | #define LOCAL_LABELS_FB 1 | |
95 | ||
96 | /* We don't need to handle .word strangely. */ | |
97 | #define WORKING_DOT_WORD | |
98 | ||
99 | #define md_number_to_chars number_to_chars_littleendian | |
100 | ||
53cb0362 | 101 | #define tc_fix_adjustable(FIX) mn10300_fix_adjustable (FIX) |
bfff1642 | 102 | extern bfd_boolean mn10300_fix_adjustable (struct fix *); |
252b5132 RH |
103 | |
104 | /* We do relaxing in the assembler as well as the linker. */ | |
105 | extern const struct relax_type md_relax_table[]; | |
106 | #define TC_GENERIC_RELAX_TABLE md_relax_table | |
e8b1cae5 | 107 | |
c0bd0db2 | 108 | #define DWARF2_LINE_MIN_INSN_LENGTH 1 |
bfff1642 NC |
109 | |
110 | /* The difference between same-section symbols may be affected by linker | |
111 | relaxation, so do not resolve such expressions in the assembler. */ | |
112 | #define md_allow_local_subtract(l,r,s) mn10300_allow_local_subtract (l, r, s) | |
113 | extern bfd_boolean mn10300_allow_local_subtract (expressionS *, expressionS *, segT); | |
114 | ||
115 | #define RELOC_EXPANSION_POSSIBLE | |
116 | #define MAX_RELOC_EXPANSION 2 | |
117 | ||
118 | #define TC_FRAG_TYPE bfd_boolean | |
569006e5 NC |
119 | |
120 | #define HANDLE_ALIGN(frag) mn10300_handle_align (frag) | |
121 | extern void mn10300_handle_align (fragS *); | |
8c750480 NC |
122 | |
123 | /* Only allow call frame debug info optimization when linker relaxation is | |
124 | not enabled as otherwise we could generate the DWARF directives without | |
125 | the relocs necessary to patch them up. */ | |
126 | #define md_allow_eh_opt (linkrelax == 0) |