]>
Commit | Line | Data |
---|---|---|
93f11b16 | 1 | /* Definitions for TI PRU assembler. |
d87bef3a | 2 | Copyright (C) 2014-2023 Free Software Foundation, Inc. |
93f11b16 DD |
3 | Contributed by Dimitar Dimitrov <dimitar@dinux.eu> |
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 | |
9 | the Free Software Foundation; either version 3, or (at your option) | |
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 | |
19 | Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA | |
20 | 02110-1301, USA. */ | |
21 | ||
22 | #ifndef __TC_PRU__ | |
23 | #define __TC_PRU__ | |
24 | ||
25 | #define TARGET_BYTES_BIG_ENDIAN 0 | |
26 | ||
27 | /* Words are big enough to hold addresses. */ | |
28 | #define WORKING_DOT_WORD 1 | |
29 | ||
30 | extern const char *pru_target_format (void); | |
31 | #define TARGET_FORMAT pru_target_format () | |
32 | #define TARGET_ARCH bfd_arch_pru | |
33 | ||
34 | /* A PRU instruction consists of tokens and separator characters | |
35 | the tokens are things like the instruction name (add, or jmp etc), | |
36 | the register indices ($5, $7 etc), and constant expressions. The | |
37 | separator characters are commas, brackets and space. | |
38 | The instruction name is always separated from other tokens by a space | |
39 | The maximum number of tokens in an instruction is 6 (the instruction name, | |
40 | 4 arguments, and a 4th string representing the expected instruction opcode | |
41 | after assembly. The latter is only used when the assemble is running in | |
42 | self test mode, otherwise its presence will generate an error. */ | |
43 | #define PRU_MAX_INSN_TOKENS 7 | |
44 | ||
45 | /* There are no machine-specific operands so we #define this to nothing. */ | |
46 | #define md_operand(x) | |
47 | ||
48 | /* Function prototypes exported to rest of GAS. */ | |
49 | extern void md_assemble (char *op_str); | |
ed2917de AM |
50 | extern void pru_md_end (void); |
51 | #define md_end pru_md_end | |
93f11b16 DD |
52 | extern void md_begin (void); |
53 | ||
54 | #define tc_fix_adjustable(fixp) pru_fix_adjustable (fixp) | |
55 | extern int pru_fix_adjustable (struct fix *); | |
56 | ||
57 | #define tc_frob_label(lab) pru_frob_label (lab) | |
58 | extern void pru_frob_label (symbolS *); | |
59 | ||
60 | extern void md_convert_frag (bfd * headers, segT sec, fragS * fragP); | |
61 | ||
62 | #define DIFF_EXPR_OK | |
63 | ||
64 | /* FIXME This seems appropriate, given that we intentionally prevent | |
65 | PRU's .text from being used in a DIFF expression with symbols from | |
66 | other sections. Revisit once GDB is ported. */ | |
67 | #define CFI_DIFF_EXPR_OK 0 | |
68 | ||
69 | #define TC_PARSE_CONS_RETURN_TYPE int | |
70 | #define TC_PARSE_CONS_RETURN_NONE 0 | |
71 | ||
72 | #define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) \ | |
73 | pru_parse_cons_expression (EXP, NBYTES) | |
74 | extern int pru_parse_cons_expression (expressionS *exp, int size); | |
75 | ||
76 | #define TC_CONS_FIX_NEW pru_cons_fix_new | |
77 | extern void pru_cons_fix_new (struct frag *frag, int where, | |
78 | unsigned int nbytes, struct expressionS *exp, | |
79 | const int is_pmem); | |
80 | ||
81 | /* If you define this macro, it means that `tc_gen_reloc' may return | |
82 | multiple relocation entries for a single fixup. In this case, the | |
83 | return value of `tc_gen_reloc' is a pointer to a null terminated | |
84 | array. */ | |
85 | #undef RELOC_EXPANSION_POSSIBLE | |
86 | ||
87 | /* No shared lib support, so we don't need to ensure externally | |
88 | visible symbols can be overridden. */ | |
89 | #define EXTERN_FORCE_RELOC 0 | |
90 | ||
91 | /* If defined, this macro allows control over whether fixups for a | |
92 | given section will be processed when the linkrelax variable is | |
93 | set. Define it to zero and handle things in md_apply_fix instead. */ | |
94 | #define TC_LINKRELAX_FIXUP(SEG) 0 | |
95 | ||
96 | /* If this macro returns non-zero, it guarantees that a relocation will be | |
97 | emitted even when the value can be resolved locally. Do that if | |
98 | linkrelax is turned on. */ | |
99 | #define TC_FORCE_RELOCATION(fix) pru_force_relocation (fix) | |
100 | #define TC_FORCE_RELOCATION_SUB_SAME(fix, seg) \ | |
91cb9803 | 101 | (GENERIC_FORCE_RELOCATION_SUB_SAME (fix, seg) || pru_force_relocation (fix)) |
93f11b16 DD |
102 | extern int pru_force_relocation (struct fix *); |
103 | ||
104 | /* Do not use PC relative fixups and relocations for | |
105 | anything but real PCREL relocations. */ | |
106 | #define TC_FORCE_RELOCATION_SUB_LOCAL(FIX, SEG) \ | |
107 | (((FIX)->fx_r_type != BFD_RELOC_PRU_S10_PCREL) \ | |
108 | && ((FIX)->fx_r_type != BFD_RELOC_PRU_U8_PCREL)) | |
109 | ||
110 | /* Values passed to md_apply_fix don't include the symbol value. */ | |
111 | #define MD_APPLY_SYM_VALUE(FIX) 0 | |
112 | ||
113 | /* We don't want gas to fixup the following memory related relocations. | |
114 | We will need them in case that we want to do linker relaxation. | |
115 | We could in principle keep these fixups in gas when not relaxing. | |
116 | However, there is no serious performance penalty when making the linker | |
117 | make the fixup work. Check also that fx_addsy is not NULL, in order to | |
118 | make sure that the fixup refers to some sort of label. */ | |
119 | #define TC_VALIDATE_FIX(FIXP,SEG,SKIP) \ | |
120 | if ((FIXP->fx_r_type == BFD_RELOC_PRU_LDI32 \ | |
121 | || FIXP->fx_r_type == BFD_RELOC_PRU_U16 \ | |
122 | || FIXP->fx_r_type == BFD_RELOC_PRU_U16_PMEMIMM \ | |
123 | || FIXP->fx_r_type == BFD_RELOC_PRU_S10_PCREL \ | |
124 | || FIXP->fx_r_type == BFD_RELOC_PRU_U8_PCREL \ | |
125 | || FIXP->fx_r_type == BFD_RELOC_PRU_32_PMEM \ | |
126 | || FIXP->fx_r_type == BFD_RELOC_PRU_16_PMEM) \ | |
127 | && FIXP->fx_addsy != NULL \ | |
128 | && FIXP->fx_subsy == NULL) \ | |
129 | { \ | |
130 | symbol_mark_used_in_reloc (FIXP->fx_addsy); \ | |
131 | goto SKIP; \ | |
132 | } | |
133 | ||
134 | /* This macro is evaluated for any fixup with a fx_subsy that | |
135 | fixup_segment cannot reduce to a number. If the macro returns | |
136 | false an error will be reported. */ | |
137 | #define TC_VALIDATE_FIX_SUB(fix, seg) pru_validate_fix_sub (fix) | |
138 | extern int pru_validate_fix_sub (struct fix *); | |
139 | ||
140 | /* We want .cfi_* pseudo-ops for generating unwind info. */ | |
141 | #define TARGET_USE_CFIPOP 1 | |
2688aab2 DD |
142 | |
143 | /* Program Counter register number is not defined by TI documents. | |
144 | Pick the virtual number used by GCC. */ | |
145 | #define DWARF2_DEFAULT_RETURN_COLUMN 132 | |
146 | ||
147 | /* The stack grows down, and is only byte aligned. */ | |
148 | #define DWARF2_CIE_DATA_ALIGNMENT -1 | |
149 | ||
93f11b16 DD |
150 | #define tc_regname_to_dw2regnum pru_regname_to_dw2regnum |
151 | extern int pru_regname_to_dw2regnum (char *regname); | |
152 | #define tc_cfi_frame_initial_instructions pru_frame_initial_instructions | |
153 | extern void pru_frame_initial_instructions (void); | |
154 | ||
155 | /* The difference between same-section symbols may be affected by linker | |
156 | relaxation, so do not resolve such expressions in the assembler. */ | |
157 | #define md_allow_local_subtract(l,r,s) pru_allow_local_subtract (l, r, s) | |
5b7c81bd | 158 | extern bool pru_allow_local_subtract (expressionS *, expressionS *, segT); |
93f11b16 DD |
159 | |
160 | #endif /* __TC_PRU__ */ |