|
13 | 13 | #define R_ARC_32_ME 27 |
14 | 14 |
|
15 | 15 | /* clang-format off */ |
| 16 | +#ifndef __CCAC__ |
16 | 17 | void __st_r13_to_r15(); |
17 | 18 | void __st_r13_to_r16(); |
18 | 19 | void __st_r13_to_r17(); |
@@ -41,29 +42,86 @@ void __divdf3(); |
41 | 42 | void __divdi3(); |
42 | 43 | void __divsf3(); |
43 | 44 | void __divsi3(); |
44 | | -void __eqsf2(); |
45 | 45 | void __extendsfdf2(); |
46 | 46 | void __fixdfsi(); |
47 | 47 | void __floatsidf(); |
48 | 48 | void __floatsisf(); |
49 | | -void __gedf2(); |
50 | | -void __gtdf2(); |
51 | | -void __ledf2(); |
52 | | -void __lesf2(); |
53 | | -void __ltdf2(); |
54 | 49 | void __muldf3(); |
55 | 50 | void __mulsf3(); |
56 | 51 | void __subdf3(); |
57 | 52 | void __subsf3(); |
58 | 53 | void __truncdfsf2(); |
| 54 | +#else |
| 55 | +void __ac_push_13_to_13(); |
| 56 | +void __ac_push_13_to_14(); |
| 57 | +void __ac_push_13_to_15(); |
| 58 | +void __ac_push_13_to_16(); |
| 59 | +void __ac_push_13_to_17(); |
| 60 | +void __ac_push_13_to_18(); |
| 61 | +void __ac_push_13_to_19(); |
| 62 | +void __ac_push_13_to_20(); |
| 63 | +void __ac_push_13_to_21(); |
| 64 | +void __ac_push_13_to_22(); |
| 65 | +void __ac_push_13_to_23(); |
| 66 | +void __ac_push_13_to_24(); |
| 67 | +void __ac_push_13_to_25(); |
| 68 | +void __ac_push_13_to_26(); |
| 69 | +void __ac_push_none(); |
| 70 | +void __ac_pop_13_to_26(); |
| 71 | +void __ac_pop_13_to_26v(); |
| 72 | +void __ac_pop_13_to_25(); |
| 73 | +void __ac_pop_13_to_25v(); |
| 74 | +void __ac_pop_13_to_24(); |
| 75 | +void __ac_pop_13_to_24v(); |
| 76 | +void __ac_pop_13_to_23(); |
| 77 | +void __ac_pop_13_to_23v(); |
| 78 | +void __ac_pop_13_to_22(); |
| 79 | +void __ac_pop_13_to_22v(); |
| 80 | +void __ac_pop_13_to_21(); |
| 81 | +void __ac_pop_13_to_21v(); |
| 82 | +void __ac_pop_13_to_20(); |
| 83 | +void __ac_pop_13_to_20v(); |
| 84 | +void __ac_pop_13_to_19(); |
| 85 | +void __ac_pop_13_to_19v(); |
| 86 | +void __ac_pop_13_to_18(); |
| 87 | +void __ac_pop_13_to_18v(); |
| 88 | +void __ac_pop_13_to_17(); |
| 89 | +void __ac_pop_13_to_17v(); |
| 90 | +void __ac_pop_13_to_16(); |
| 91 | +void __ac_pop_13_to_16v(); |
| 92 | +void __ac_pop_13_to_15(); |
| 93 | +void __ac_pop_13_to_15v(); |
| 94 | +void __ac_pop_13_to_14(); |
| 95 | +void __ac_pop_13_to_14v(); |
| 96 | +void __ac_pop_13_to_13(); |
| 97 | +void __ac_pop_13_to_13v(); |
| 98 | +void __ac_pop_none(); |
| 99 | +void __ac_pop_nonev(); |
| 100 | +void __eqdf2(); |
| 101 | +void __nedf2(); |
| 102 | +void __ltsf2(); |
| 103 | +void __nesf2(); |
| 104 | +void __gesf2(); |
| 105 | +void __gtsf2(); |
| 106 | +void __unordsf2(); |
| 107 | +void __truncdfhf2(); |
| 108 | +void __truncsfhf2(); |
| 109 | +#endif /* end of __CCAC__ */ |
| 110 | + |
| 111 | +void __ledf2(); |
| 112 | +void __ltdf2(); |
| 113 | +void __gedf2(); |
| 114 | +void __gtdf2(); |
| 115 | +void __eqsf2(); |
| 116 | +void __lesf2(); |
59 | 117 | void __unorddf2(); |
60 | 118 | /* clang-format on */ |
61 | 119 |
|
62 | 120 | static SymbolMap target_sym_map[] = { |
63 | 121 | /* clang-format off */ |
64 | 122 | REG_COMMON_SYMBOLS |
| 123 | +#ifndef __CCAC__ |
65 | 124 | REG_SYM(__st_r13_to_r15), |
66 | | - /* clang-format on */ |
67 | 125 | REG_SYM(__st_r13_to_r16), |
68 | 126 | REG_SYM(__st_r13_to_r17), |
69 | 127 | REG_SYM(__st_r13_to_r18), |
@@ -91,22 +149,80 @@ static SymbolMap target_sym_map[] = { |
91 | 149 | REG_SYM(__divdi3), |
92 | 150 | REG_SYM(__divsf3), |
93 | 151 | REG_SYM(__divsi3), |
94 | | - REG_SYM(__eqsf2), |
95 | 152 | REG_SYM(__extendsfdf2), |
96 | 153 | REG_SYM(__fixdfsi), |
97 | 154 | REG_SYM(__floatsidf), |
98 | 155 | REG_SYM(__floatsisf), |
99 | | - REG_SYM(__gedf2), |
100 | | - REG_SYM(__gtdf2), |
101 | | - REG_SYM(__ledf2), |
102 | | - REG_SYM(__lesf2), |
103 | | - REG_SYM(__ltdf2), |
104 | 156 | REG_SYM(__muldf3), |
105 | 157 | REG_SYM(__mulsf3), |
106 | 158 | REG_SYM(__subdf3), |
107 | 159 | REG_SYM(__subsf3), |
108 | 160 | REG_SYM(__truncdfsf2), |
| 161 | +#else |
| 162 | + REG_SYM(__ac_push_13_to_13), |
| 163 | + REG_SYM(__ac_push_13_to_14), |
| 164 | + REG_SYM(__ac_push_13_to_15), |
| 165 | + REG_SYM(__ac_push_13_to_16), |
| 166 | + REG_SYM(__ac_push_13_to_17), |
| 167 | + REG_SYM(__ac_push_13_to_18), |
| 168 | + REG_SYM(__ac_push_13_to_19), |
| 169 | + REG_SYM(__ac_push_13_to_20), |
| 170 | + REG_SYM(__ac_push_13_to_21), |
| 171 | + REG_SYM(__ac_push_13_to_22), |
| 172 | + REG_SYM(__ac_push_13_to_23), |
| 173 | + REG_SYM(__ac_push_13_to_24), |
| 174 | + REG_SYM(__ac_push_13_to_25), |
| 175 | + REG_SYM(__ac_push_13_to_26), |
| 176 | + REG_SYM(__ac_push_none), |
| 177 | + REG_SYM(__ac_pop_13_to_26), |
| 178 | + REG_SYM(__ac_pop_13_to_26v), |
| 179 | + REG_SYM(__ac_pop_13_to_25), |
| 180 | + REG_SYM(__ac_pop_13_to_25v), |
| 181 | + REG_SYM(__ac_pop_13_to_24), |
| 182 | + REG_SYM(__ac_pop_13_to_24v), |
| 183 | + REG_SYM(__ac_pop_13_to_23), |
| 184 | + REG_SYM(__ac_pop_13_to_23v), |
| 185 | + REG_SYM(__ac_pop_13_to_22), |
| 186 | + REG_SYM(__ac_pop_13_to_22v), |
| 187 | + REG_SYM(__ac_pop_13_to_21), |
| 188 | + REG_SYM(__ac_pop_13_to_21v), |
| 189 | + REG_SYM(__ac_pop_13_to_20), |
| 190 | + REG_SYM(__ac_pop_13_to_20v), |
| 191 | + REG_SYM(__ac_pop_13_to_19), |
| 192 | + REG_SYM(__ac_pop_13_to_19v), |
| 193 | + REG_SYM(__ac_pop_13_to_18), |
| 194 | + REG_SYM(__ac_pop_13_to_18v), |
| 195 | + REG_SYM(__ac_pop_13_to_17), |
| 196 | + REG_SYM(__ac_pop_13_to_17v), |
| 197 | + REG_SYM(__ac_pop_13_to_16), |
| 198 | + REG_SYM(__ac_pop_13_to_16v), |
| 199 | + REG_SYM(__ac_pop_13_to_15), |
| 200 | + REG_SYM(__ac_pop_13_to_15v), |
| 201 | + REG_SYM(__ac_pop_13_to_14), |
| 202 | + REG_SYM(__ac_pop_13_to_14v), |
| 203 | + REG_SYM(__ac_pop_13_to_13), |
| 204 | + REG_SYM(__ac_pop_13_to_13v), |
| 205 | + REG_SYM(__ac_pop_none), |
| 206 | + REG_SYM(__ac_pop_nonev), |
| 207 | + REG_SYM(__eqdf2), |
| 208 | + REG_SYM(__nedf2), |
| 209 | + REG_SYM(__ltsf2), |
| 210 | + REG_SYM(__nesf2), |
| 211 | + REG_SYM(__gesf2), |
| 212 | + REG_SYM(__gtsf2), |
| 213 | + REG_SYM(__unordsf2), |
| 214 | + REG_SYM(__truncdfhf2), |
| 215 | + REG_SYM(__truncsfhf2), |
| 216 | +#endif /* end of __CCAC__ */ |
| 217 | + |
| 218 | + REG_SYM(__ledf2), |
| 219 | + REG_SYM(__ltdf2), |
| 220 | + REG_SYM(__gedf2), |
| 221 | + REG_SYM(__gtdf2), |
| 222 | + REG_SYM(__eqsf2), |
| 223 | + REG_SYM(__lesf2), |
109 | 224 | REG_SYM(__unorddf2), |
| 225 | + /* clang-format on */ |
110 | 226 | }; |
111 | 227 |
|
112 | 228 | static void |
@@ -168,6 +284,45 @@ apply_relocation(AOTModule *module, uint8 *target_section_addr, |
168 | 284 | int32 symbol_index, char *error_buf, uint32 error_buf_size) |
169 | 285 | { |
170 | 286 | switch (reloc_type) { |
| 287 | + case R_ARC_S25H_PCREL: |
| 288 | + { |
| 289 | + uint32 insn = LOAD_I32(target_section_addr + reloc_offset); |
| 290 | + int32 addend, value; |
| 291 | + uintptr_t S, P; |
| 292 | + intptr_t A; |
| 293 | + |
| 294 | + CHECK_RELOC_OFFSET(sizeof(void *)); |
| 295 | + |
| 296 | + /* Convert from middle endian */ |
| 297 | + insn = middle_endian_convert(insn); |
| 298 | + |
| 299 | + addend = ((insn << 28) >> 28) << 10; |
| 300 | + /* Extract the next 10 bits from Position 6 to 15 in insn */ |
| 301 | + addend |= ((insn << 16) >> 22); |
| 302 | + addend = addend << 10; |
| 303 | + /* Extract the remaining 10 bits from Position 17 to 26 in insn */ |
| 304 | + addend |= ((insn << 5) >> 22); |
| 305 | + /* Fill in 1 bits to get the 25 bit Offset Value */ |
| 306 | + addend = addend << 1; |
| 307 | + |
| 308 | + /* (S + A) - P */ |
| 309 | + S = (uintptr_t)(uint8 *)symbol_addr; |
| 310 | + A = (intptr_t)reloc_addend; |
| 311 | + P = (uintptr_t)(target_section_addr + reloc_offset); |
| 312 | + P &= (uintptr_t)~1; |
| 313 | + value = (int32)(S + A + addend - P); |
| 314 | + |
| 315 | + insn = insn & 0xf8010030; |
| 316 | + insn |= ((((value >> 1) & 0x3ff) << 17) |
| 317 | + | (((value >> 1) & 0xffc00) >> 3) |
| 318 | + | (((value >> 1) & 0xf00000) >> 19)); |
| 319 | + |
| 320 | + /* Convert to middle endian */ |
| 321 | + insn = middle_endian_convert(insn); |
| 322 | + |
| 323 | + STORE_U32(target_section_addr + reloc_offset, insn); |
| 324 | + break; |
| 325 | + } |
171 | 326 | case R_ARC_S25W_PCREL: |
172 | 327 | { |
173 | 328 | uint32 insn = LOAD_I32(target_section_addr + reloc_offset); |
|
0 commit comments