Commit | Line | Data |
---|---|---|
adde6300 | 1 | /* This file is tc-avr.h |
a1836728 AM |
2 | Copyright 1999, 2000, 2001, 2002, 2005, 2006, 2007 |
3 | Free Software Foundation, Inc. | |
adde6300 AM |
4 | |
5 | Contributed by Denis Chertykov <denisc@overta.ru> | |
6 | ||
7 | This file is part of GAS, the GNU Assembler. | |
8 | ||
9 | GAS is free software; you can redistribute it and/or modify | |
10 | it under the terms of the GNU General Public License as published by | |
ec2655a6 | 11 | the Free Software Foundation; either version 3, or (at your option) |
adde6300 AM |
12 | any later version. |
13 | ||
14 | GAS is distributed in the hope that it will be useful, | |
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | GNU General Public License for more details. | |
18 | ||
19 | You should have received a copy of the GNU General Public License | |
20 | along with GAS; see the file COPYING. If not, write to the Free | |
4b4da160 NC |
21 | Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA |
22 | 02110-1301, USA. */ | |
adde6300 | 23 | |
a161fe53 AM |
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. */ | |
adde6300 | 28 | #define TC_AVR |
adde6300 | 29 | |
a161fe53 AM |
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. */ | |
adde6300 | 32 | #define TARGET_FORMAT "elf32-avr" |
adde6300 | 33 | |
a161fe53 | 34 | /* This macro is the BFD architecture to pass to `bfd_set_arch_mach'. */ |
adde6300 | 35 | #define TARGET_ARCH bfd_arch_avr |
adde6300 | 36 | |
a161fe53 AM |
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. */ | |
adde6300 | 39 | #define TARGET_MACH 0 |
adde6300 | 40 | |
a161fe53 AM |
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. */ | |
adde6300 | 43 | #define TARGET_BYTES_BIG_ENDIAN 0 |
adde6300 | 44 | |
a161fe53 AM |
45 | /* If you define this macro, GAS will warn about the use of |
46 | nonstandard escape sequences in a string. */ | |
adde6300 | 47 | #define ONLY_STANDARD_ESCAPES |
adde6300 | 48 | |
a161fe53 AM |
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. */ | |
adde6300 | 52 | #define md_operand(x) |
adde6300 | 53 | |
a161fe53 AM |
54 | /* You may define this macro to parse an expression used in a data |
55 | allocation pseudo-op such as `.word'. You can use this to | |
56 | recognize relocation directives that may appear in such directives. */ | |
dc191a8f NC |
57 | #define TC_PARSE_CONS_EXPRESSION(EXPR,N) avr_parse_cons_expression (EXPR, N) |
58 | extern void avr_parse_cons_expression (expressionS *, int); | |
adde6300 | 59 | |
a161fe53 AM |
60 | /* You may define this macro to generate a fixup for a data |
61 | allocation pseudo-op. */ | |
dc191a8f NC |
62 | #define TC_CONS_FIX_NEW(FRAG,WHERE,N,EXP) avr_cons_fix_new (FRAG, WHERE, N, EXP) |
63 | extern void avr_cons_fix_new (fragS *,int, int, expressionS *); | |
adde6300 | 64 | |
a161fe53 AM |
65 | /* This should just call either `number_to_chars_bigendian' or |
66 | `number_to_chars_littleendian', whichever is appropriate. On | |
67 | targets like the MIPS which support options to change the | |
68 | endianness, which function to call is a runtime decision. On | |
69 | other targets, `md_number_to_chars' can be a simple macro. */ | |
adde6300 | 70 | #define md_number_to_chars number_to_chars_littleendian |
adde6300 | 71 | |
a161fe53 AM |
72 | /* `md_short_jump_size' |
73 | `md_long_jump_size' | |
74 | `md_create_short_jump' | |
75 | `md_create_long_jump' | |
76 | If `WORKING_DOT_WORD' is defined, GAS will not do broken word | |
77 | processing (*note Broken words::.). Otherwise, you should set | |
78 | `md_short_jump_size' to the size of a short jump (a jump that is | |
79 | just long enough to jump around a long jmp) and | |
80 | `md_long_jump_size' to the size of a long jump (a jump that can go | |
81 | anywhere in the function), You should define | |
82 | `md_create_short_jump' to create a short jump around a long jump, | |
83 | and define `md_create_long_jump' to create a long jump. */ | |
adde6300 | 84 | #define WORKING_DOT_WORD |
adde6300 | 85 | |
a161fe53 AM |
86 | /* If you define this macro, it means that `tc_gen_reloc' may return |
87 | multiple relocation entries for a single fixup. In this case, the | |
88 | return value of `tc_gen_reloc' is a pointer to a null terminated | |
89 | array. */ | |
adde6300 | 90 | #undef RELOC_EXPANSION_POSSIBLE |
adde6300 | 91 | |
a161fe53 AM |
92 | /* No shared lib support, so we don't need to ensure externally |
93 | visible symbols can be overridden. */ | |
94 | #define EXTERN_FORCE_RELOC 0 | |
95 | ||
55cf6793 | 96 | /* Values passed to md_apply_fix don't include the symbol value. */ |
a161fe53 AM |
97 | #define MD_APPLY_SYM_VALUE(FIX) 0 |
98 | ||
99 | /* If you define this macro, it should return the offset between the | |
100 | address of a PC relative fixup and the position from which the PC | |
101 | relative adjustment should be made. On many processors, the base | |
102 | of a PC relative instruction is the next instruction, so this | |
103 | macro would return the length of an instruction. */ | |
dc191a8f NC |
104 | #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC) |
105 | extern long md_pcrel_from_section (struct fix *, segT); | |
00d2865b | 106 | |
a161fe53 AM |
107 | /* The number of bytes to put into a word in a listing. This affects |
108 | the way the bytes are clumped together in the listing. For | |
109 | example, a value of 2 might print `1234 5678' where a value of 1 | |
110 | would print `12 34 56 78'. The default value is 4. */ | |
adde6300 | 111 | #define LISTING_WORD_SIZE 2 |
adde6300 | 112 | |
73160847 | 113 | /* AVR port uses `$' as a logical line separator. */ |
a161fe53 | 114 | #define LEX_DOLLAR 0 |
70a516ef | 115 | |
a161fe53 AM |
116 | /* An `.lcomm' directive with no explicit alignment parameter will |
117 | use this macro to set P2VAR to the alignment that a request for | |
118 | SIZE bytes will have. The alignment is expressed as a power of | |
119 | two. If no alignment should take place, the macro definition | |
120 | should do nothing. Some targets define a `.bss' directive that is | |
121 | also affected by this macro. The default definition will set | |
122 | P2VAR to the truncated power of two of sizes up to eight bytes. */ | |
70a516ef | 123 | #define TC_IMPLICIT_LCOMM_ALIGNMENT(SIZE, P2VAR) (P2VAR) = 0 |
73160847 NC |
124 | |
125 | /* We don't want gas to fixup the following program memory related relocations. | |
126 | We will need them in case that we want to do linker relaxation. | |
127 | We could in principle keep these fixups in gas when not relaxing. | |
128 | However, there is no serious performance penilty when making the linker | |
28c9d252 NC |
129 | make the fixup work. Check also that fx_addsy is not NULL, in order to make |
130 | sure that the fixup refers to some sort of lable. */ | |
131 | #define TC_VALIDATE_FIX(FIXP,SEG,SKIP) \ | |
132 | if ( (FIXP->fx_r_type == BFD_RELOC_AVR_7_PCREL \ | |
133 | || FIXP->fx_r_type == BFD_RELOC_AVR_13_PCREL \ | |
134 | || FIXP->fx_r_type == BFD_RELOC_AVR_LO8_LDI_PM \ | |
135 | || FIXP->fx_r_type == BFD_RELOC_AVR_LO8_LDI_GS \ | |
136 | || FIXP->fx_r_type == BFD_RELOC_AVR_HI8_LDI_PM \ | |
137 | || FIXP->fx_r_type == BFD_RELOC_AVR_HI8_LDI_GS \ | |
138 | || FIXP->fx_r_type == BFD_RELOC_AVR_HH8_LDI_PM \ | |
139 | || FIXP->fx_r_type == BFD_RELOC_AVR_LO8_LDI_PM_NEG \ | |
140 | || FIXP->fx_r_type == BFD_RELOC_AVR_HI8_LDI_PM_NEG \ | |
141 | || FIXP->fx_r_type == BFD_RELOC_AVR_HH8_LDI_PM_NEG \ | |
142 | || FIXP->fx_r_type == BFD_RELOC_AVR_16_PM) \ | |
143 | && (FIXP->fx_addsy)) \ | |
144 | { \ | |
145 | goto SKIP; \ | |
cce7653b | 146 | } |
a1836728 AM |
147 | |
148 | /* This target is buggy, and sets fix size too large. */ | |
149 | #define TC_FX_SIZE_SLACK(FIX) 2 |