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