Unified · Split
| @@ -1244,10 +1244,16 @@ static int pe_check_symbols(struct pe_info *pe) · 1243 unmodified lines | ||
| 1244 | 1244 | |
| 1245 | 1245 | offset = text_section->data_offset; |
| 1246 | 1246 | /* add the 'jmp IAT[x]' instruction */ |
| 1247 | +#ifdef TCC_TARGET_ARM | |
| 1248 | + p = section_ptr_add(text_section, 8+4); // room for code and address | |
| 1249 | + (*(DWORD*)(p)) = 0xE59FC000; // arm code ldr ip, [pc] ; PC+8+0 = 0001xxxx | |
| 1250 | + (*(DWORD*)(p+2)) = 0xE59CF000; // arm code ldr pc, [ip] | |
| 1251 | +#else | |
| 1247 | 1252 | p = section_ptr_add(text_section, 8); |
| 1248 | 1253 | *p = 0x25FF; |
| 1249 | 1254 | #ifdef TCC_TARGET_X86_64 |
| 1250 | 1255 | *(DWORD*)(p+1) = (DWORD)-4; |
| 1256 | +#endif | |
| 1251 | 1257 | #endif |
| 1252 | 1258 | /* add a helper symbol, will be patched later in |
| 1253 | 1259 | pe_build_imports */ |
| @@ -1256,8 +1262,13 @@ static int pe_check_symbols(struct pe_info *pe) · 2 unmodified lines | ||
| 1256 | 1262 | symtab_section, 0, sizeof(DWORD), |
| 1257 | 1263 | ELFW_ST_INFO(STB_GLOBAL, STT_OBJECT), |
| 1258 | 1264 | 0, SHN_UNDEF, buffer); |
| 1265 | +#ifdef TCC_TARGET_ARM | |
| 1266 | + put_elf_reloc(symtab_section, text_section, | |
| 1267 | + offset + 8, R_XXX_THUNKFIX, is->iat_index); // offset to IAT position | |
| 1268 | +#else | |
| 1259 | 1269 | put_elf_reloc(symtab_section, text_section, |
| 1260 | 1270 | offset + 2, R_XXX_THUNKFIX, is->iat_index); |
| 1271 | +#endif | |
| 1261 | 1272 | is->thk_offset = offset; |
| 1262 | 1273 | } |
| 1263 | 1274 | |
| @@ -1822,9 +1833,9 @@ ST_FUNC int pe_output_file(TCCState * s1, const char *filename) · 558 unmodified lines | ||
| 1822 | 1833 | pe.subsystem = s1->pe_subsystem; |
| 1823 | 1834 | else |
| 1824 | 1835 | #if defined(TCC_TARGET_ARM) |
| 1825 | − pe.subsystem = 3; | |
| 1826 | −#else | |
| 1827 | 1836 | pe.subsystem = 9; |
| 1837 | +#else | |
| 1838 | + pe.subsystem = 3; | |
| 1828 | 1839 | #endif |
| 1829 | 1840 | /* set default file/section alignment */ |
| 1830 | 1841 | if (pe.subsystem == 1) { |