Commit | Line | Data |
---|---|---|
2469cfa2 | 1 | /* This file is tc-msp430.h |
6f2750fe | 2 | Copyright (C) 2002-2016 Free Software Foundation, Inc. |
2469cfa2 NC |
3 | |
4 | Contributed by Dmitry Diky <diwil@mail.ru> | |
5 | ||
6 | This file is part of GAS, the GNU Assembler. | |
7 | ||
8 | GAS is free software; you can redistribute it and/or modify | |
9 | it under the terms of the GNU General Public License as published by | |
ec2655a6 | 10 | the Free Software Foundation; either version 3, or (at your option) |
2469cfa2 NC |
11 | any later version. |
12 | ||
13 | GAS is distributed in the hope that it will be useful, | |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | GNU General Public License for more details. | |
17 | ||
18 | You should have received a copy of the GNU General Public License | |
19 | along with GAS; see the file COPYING. If not, write to the Free | |
4b4da160 NC |
20 | Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA |
21 | 02110-1301, USA. */ | |
2469cfa2 | 22 | |
2469cfa2 NC |
23 | #define TC_MSP430 |
24 | /* By convention, you should define this macro in the `.h' file. For | |
25 | example, `tc-m68k.h' defines `TC_M68K'. You might have to use this | |
26 | if it is necessary to add CPU specific code to the object format | |
27 | file. */ | |
28 | ||
29 | #define TARGET_FORMAT "elf32-msp430" | |
30 | /* This macro is the BFD target name to use when creating the output | |
31 | file. This will normally depend upon the `OBJ_FMT' macro. */ | |
32 | ||
33 | #define TARGET_ARCH bfd_arch_msp430 | |
34 | /* This macro is the BFD architecture to pass to `bfd_set_arch_mach'. */ | |
35 | ||
36 | #define TARGET_MACH 0 | |
37 | /* This macro is the BFD machine number to pass to | |
38 | `bfd_set_arch_mach'. If it is not defined, GAS will use 0. */ | |
39 | ||
40 | #define TARGET_BYTES_BIG_ENDIAN 0 | |
41 | /* You should define this macro to be non-zero if the target is big | |
42 | endian, and zero if the target is little endian. */ | |
43 | ||
44 | #define ONLY_STANDARD_ESCAPES | |
45 | /* If you define this macro, GAS will warn about the use of | |
46 | nonstandard escape sequences in a string. */ | |
47 | ||
48 | #define md_operand(x) | |
49 | /* GAS will call this function for any expression that can not be | |
50 | recognized. When the function is called, `input_line_pointer' | |
51 | will point to the start of the expression. */ | |
52 | ||
53 | #define md_number_to_chars number_to_chars_littleendian | |
54 | /* This should just call either `number_to_chars_bigendian' or | |
55 | `number_to_chars_littleendian', whichever is appropriate. On | |
56 | targets like the MIPS which support options to change the | |
57 | endianness, which function to call is a runtime decision. On | |
58 | other targets, `md_number_to_chars' can be a simple macro. */ | |
59 | ||
60 | #define WORKING_DOT_WORD | |
61 | /* | |
62 | `md_short_jump_size' | |
63 | `md_long_jump_size' | |
64 | `md_create_short_jump' | |
65 | `md_create_long_jump' | |
66 | If `WORKING_DOT_WORD' is defined, GAS will not do broken word | |
67 | processing (*note Broken words::.). Otherwise, you should set | |
68 | `md_short_jump_size' to the size of a short jump (a jump that is | |
69 | just long enough to jump around a long jmp) and | |
70 | `md_long_jump_size' to the size of a long jump (a jump that can go | |
71 | anywhere in the function), You should define | |
72 | `md_create_short_jump' to create a short jump around a long jump, | |
73 | and define `md_create_long_jump' to create a long jump. */ | |
74 | ||
75 | #define MD_APPLY_FIX3 | |
586ec8c1 NC |
76 | /* Values passed to md_apply_fix don't include symbol values. */ |
77 | #define MD_APPLY_SYM_VALUE(FIX) 0 | |
2469cfa2 NC |
78 | |
79 | #define TC_HANDLES_FX_DONE | |
80 | ||
81 | #undef RELOC_EXPANSION_POSSIBLE | |
82 | /* If you define this macro, it means that `tc_gen_reloc' may return | |
83 | multiple relocation entries for a single fixup. In this case, the | |
84 | return value of `tc_gen_reloc' is a pointer to a null terminated | |
85 | array. */ | |
86 | ||
87 | #define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section(FIXP, SEC) | |
88 | /* If you define this macro, it should return the offset between the | |
89 | address of a PC relative fixup and the position from which the PC | |
90 | relative adjustment should be made. On many processors, the base | |
91 | of a PC relative instruction is the next instruction, so this | |
92 | macro would return the length of an instruction. */ | |
93 | ||
b18c562e | 94 | extern long md_pcrel_from_section (struct fix *, segT); |
2469cfa2 NC |
95 | |
96 | #define LISTING_WORD_SIZE 2 | |
97 | /* The number of bytes to put into a word in a listing. This affects | |
98 | the way the bytes are clumped together in the listing. For | |
99 | example, a value of 2 might print `1234 5678' where a value of 1 | |
100 | would print `12 34 56 78'. The default value is 4. */ | |
101 | ||
13761a11 NC |
102 | /* Support symbols like: C$$IO$$. */ |
103 | #undef LEX_DOLLAR | |
104 | #define LEX_DOLLAR 1 | |
2469cfa2 NC |
105 | |
106 | #define TC_IMPLICIT_LCOMM_ALIGNMENT(SIZE, P2VAR) (P2VAR) = 0 | |
107 | /* An `.lcomm' directive with no explicit alignment parameter will | |
108 | use this macro to set P2VAR to the alignment that a request for | |
109 | SIZE bytes will have. The alignment is expressed as a power of | |
110 | two. If no alignment should take place, the macro definition | |
111 | should do nothing. Some targets define a `.bss' directive that is | |
112 | also affected by this macro. The default definition will set | |
113 | P2VAR to the truncated power of two of sizes up to eight bytes. */ | |
b18c562e NC |
114 | |
115 | #define md_relax_frag(SEG, FRAGP, STRETCH) \ | |
116 | msp430_relax_frag (SEG, FRAGP, STRETCH) | |
117 | extern long msp430_relax_frag (segT, fragS *, long); | |
77592908 DD |
118 | |
119 | #define TC_FORCE_RELOCATION_LOCAL(FIX) \ | |
13761a11 NC |
120 | msp430_force_relocation_local (FIX) |
121 | extern int msp430_force_relocation_local (struct fix *); | |
77592908 | 122 | |
34b822e3 DD |
123 | /* We need to add reference symbols for .data/.bss. */ |
124 | #define tc_frob_section(sec) msp430_frob_section (sec) | |
125 | extern void msp430_frob_section (asection *); | |
126 | ||
77592908 DD |
127 | extern int msp430_enable_relax; |
128 | extern int msp430_enable_polys; | |
13761a11 NC |
129 | |
130 | #define tc_fix_adjustable(FIX) msp430_fix_adjustable (FIX) | |
131 | extern bfd_boolean msp430_fix_adjustable (struct fix *); | |
132 | ||
133 | /* Allow hexadeciaml numbers with 'h' suffix. Note that if the number | |
134 | starts with a letter it will be interpreted as a symbol name not a | |
135 | constant. Thus "beach" is a symbol not the hex value 0xbeac. So | |
136 | is A5A5h... */ | |
137 | #define NUMBERS_WITH_SUFFIX 1 | |
138 | ||
139 | #define md_end msp430_md_end | |
140 | extern void msp430_md_end (void); | |
141 | ||
142 | /* Do not allow call frame debug info optimization as otherwise we could | |
143 | generate the DWARF directives without the relocs necessary to patch | |
144 | them up. */ | |
145 | #define md_allow_eh_opt 0 | |
146 | ||
147 | /* The difference between same-section symbols may be affected by linker | |
148 | relaxation, so do not resolve such expressions in the assembler. */ | |
149 | #define md_allow_local_subtract(l,r,s) msp430_allow_local_subtract (l, r, s) | |
150 | extern bfd_boolean msp430_allow_local_subtract (expressionS *, expressionS *, segT); | |
151 | ||
152 | #define RELOC_EXPANSION_POSSIBLE | |
153 | #define MAX_RELOC_EXPANSION 2 | |
154 | ||
155 | #define DIFF_EXPR_OK | |
156 | ||
157 | /* Do not adjust relocations involving symbols in code sections, | |
158 | because it breaks linker relaxations. This could be fixed in the | |
159 | linker, but this fix is simpler, and it pretty much only affects | |
160 | object size a little bit. */ | |
161 | #define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEC) \ | |
0f8f0c57 NC |
162 | ( ((SEC)->flags & SEC_CODE) != 0 \ |
163 | || ((SEC)->flags & SEC_DEBUGGING) != 0 \ | |
13761a11 NC |
164 | || ! SEG_NORMAL (SEC) \ |
165 | || TC_FORCE_RELOCATION (FIX)) | |
166 | ||
167 | /* We validate subtract arguments within tc_gen_reloc(), | |
168 | so don't report errors at this point. */ | |
169 | #define TC_VALIDATE_FIX_SUB(FIX, SEG) 1 | |
170 | ||
171 | #define DWARF2_USE_FIXED_ADVANCE_PC 1 | |
172 | ||
0f8f0c57 | 173 | #define TC_LINKRELAX_FIXUP(seg) ((seg->flags & SEC_CODE) || (seg->flags & SEC_DEBUGGING)) |
3d8efabf KB |
174 | |
175 | #define DWARF2_ADDR_SIZE(bfd) 4 |