Unified · Split
| @@ -1034,6 +1034,8 @@ ST_FUNC void build_got_entries(TCCState *s1) · 1033 unmodified lines | ||
| 1034 | 1034 | type = ELFW(R_TYPE)(rel->r_info); |
| 1035 | 1035 | switch(type) { |
| 1036 | 1036 | #if defined(TCC_TARGET_I386) |
| 1037 | + case R_386_PC16: | |
| 1038 | + case R_386_PC32: | |
| 1037 | 1039 | case R_386_GOT32: |
| 1038 | 1040 | case R_386_GOT32X: |
| 1039 | 1041 | case R_386_GOTOFF: |
| @@ -1046,7 +1048,8 @@ ST_FUNC void build_got_entries(TCCState *s1) · 6 unmodified lines | ||
| 1046 | 1048 | sym_index = ELFW(R_SYM)(rel->r_info); |
| 1047 | 1049 | sym = &((ElfW(Sym) *)symtab_section->data)[sym_index]; |
| 1048 | 1050 | /* look at the symbol got offset. If none, then add one */ |
| 1049 | − if (type == R_386_GOT32 || type == R_386_GOT32X) | |
| 1051 | + if (type == R_386_GOT32 || type == R_386_GOT32X || | |
| 1052 | + type == R_386_16 || type == R_386_32) | |
| 1050 | 1053 | reloc_type = R_386_GLOB_DAT; |
| 1051 | 1054 | else |
| 1052 | 1055 | reloc_type = R_386_JMP_SLOT; |
| @@ -1058,10 +1061,19 @@ ST_FUNC void build_got_entries(TCCState *s1) · 5 unmodified lines | ||
| 1058 | 1061 | case R_ARM_PC24: |
| 1059 | 1062 | case R_ARM_CALL: |
| 1060 | 1063 | case R_ARM_JUMP24: |
| 1061 | − case R_ARM_GOT32: | |
| 1062 | − case R_ARM_GOTOFF: | |
| 1063 | − case R_ARM_GOTPC: | |
| 1064 | 1064 | case R_ARM_PLT32: |
| 1065 | + case R_ARM_THM_PC22: | |
| 1066 | + case R_ARM_MOVT_ABS: | |
| 1067 | + case R_ARM_MOVW_ABS_NC: | |
| 1068 | + case R_ARM_THM_MOVT_ABS: | |
| 1069 | + case R_ARM_THM_MOVW_ABS_NC: | |
| 1070 | + case R_ARM_PREL31: | |
| 1071 | + case R_ARM_REL32: | |
| 1072 | + case R_ARM_GOTPC: | |
| 1073 | + case R_ARM_GOTOFF: | |
| 1074 | + case R_ARM_GOT32: | |
| 1075 | + case R_ARM_V4BX: | |
| 1076 | + | |
| 1065 | 1077 | if (!s1->got) |
| 1066 | 1078 | build_got(s1); |
| 1067 | 1079 | sym_index = ELFW(R_SYM)(rel->r_info); |
| @@ -1071,7 +1083,11 @@ ST_FUNC void build_got_entries(TCCState *s1) · 3 unmodified lines | ||
| 1071 | 1083 | || s1->output_type == TCC_OUTPUT_MEMORY)) { |
| 1072 | 1084 | unsigned long ofs; |
| 1073 | 1085 | /* look at the symbol got offset. If none, then add one */ |
| 1074 | − if (type == R_ARM_GOT32) | |
| 1086 | + if (type == R_ARM_GOT32 || type == R_ARM_MOVT_ABS || | |
| 1087 | + type == R_ARM_MOVW_ABS_NC || | |
| 1088 | + type == R_ARM_THM_MOVT_ABS || | |
| 1089 | + type == R_ARM_THM_MOVW_ABS_NC || type == R_ARM_ABS32 || | |
| 1090 | + type == R_ARM_REL32) | |
| 1075 | 1091 | reloc_type = R_ARM_GLOB_DAT; |
| 1076 | 1092 | else |
| 1077 | 1093 | reloc_type = R_ARM_JUMP_SLOT; |
| @@ -1082,7 +1098,8 @@ ST_FUNC void build_got_entries(TCCState *s1) · 4 unmodified lines | ||
| 1082 | 1098 | (char *) symtab_section->link->data + sym->st_name, |
| 1083 | 1099 | type, sym->st_shndx, ofs); |
| 1084 | 1100 | #endif |
| 1085 | − if (type != R_ARM_GOT32) { | |
| 1101 | + if (type == R_ARM_PC24 || type == R_ARM_CALL || | |
| 1102 | + type == R_ARM_JUMP24 || type == R_ARM_PLT32) { | |
| 1086 | 1103 | addr_t *ptr = (addr_t*)(s1->sections[s->sh_info]->data |
| 1087 | 1104 | + rel->r_offset); |
| 1088 | 1105 | /* x must be signed! */ |
| @@ -1177,11 +1194,15 @@ ST_FUNC void build_got_entries(TCCState *s1) · 88 unmodified lines | ||
| 1177 | 1194 | } |
| 1178 | 1195 | break; |
| 1179 | 1196 | #elif defined(TCC_TARGET_X86_64) |
| 1197 | + case R_X86_64_32: | |
| 1198 | + case R_X86_64_32S: | |
| 1199 | + case R_X86_64_64: | |
| 1200 | + case R_X86_64_PC32: | |
| 1180 | 1201 | case R_X86_64_GOT32: |
| 1181 | 1202 | case R_X86_64_GOTTPOFF: |
| 1182 | 1203 | case R_X86_64_GOTPCREL: |
| 1183 | − case R_X86_64_GOTPCRELX: | |
| 1184 | − case R_X86_64_REX_GOTPCRELX: | |
| 1204 | + case R_X86_64_GOTPCRELX: | |
| 1205 | + case R_X86_64_REX_GOTPCRELX: | |
| 1185 | 1206 | case R_X86_64_PLT32: |
| 1186 | 1207 | sym_index = ELFW(R_SYM)(rel->r_info); |
| 1187 | 1208 | sym = &((ElfW(Sym) *)symtab_section->data)[sym_index]; |
| @@ -1202,16 +1223,20 @@ ST_FUNC void build_got_entries(TCCState *s1) · 14 unmodified lines | ||
| 1202 | 1223 | type == R_X86_64_PLT32) { |
| 1203 | 1224 | unsigned long ofs; |
| 1204 | 1225 | /* look at the symbol got offset. If none, then add one */ |
| 1205 | − if (type == R_X86_64_PLT32) | |
| 1206 | − reloc_type = R_X86_64_JUMP_SLOT; | |
| 1207 | − else | |
| 1226 | + if (type == R_X86_64_GOT32 || type == R_X86_64_GOTPCREL || | |
| 1227 | + type == R_X86_64_GOTPCRELX || | |
| 1228 | + type == R_X86_64_REX_GOTPCRELX || | |
| 1229 | + type == R_X86_64_32 || type == R_X86_64_32S || | |
| 1230 | + type == R_X86_64_64) | |
| 1208 | 1231 | reloc_type = R_X86_64_GLOB_DAT; |
| 1232 | + else | |
| 1233 | + reloc_type = R_X86_64_JUMP_SLOT; | |
| 1209 | 1234 | ofs = put_got_entry(s1, reloc_type, sym->st_size, |
| 1210 | − sym->st_info, sym_index); | |
| 1211 | − if (type == R_X86_64_PLT32) | |
| 1212 | − /* We store the place of the generated PLT slot | |
| 1213 | − in our addend. */ | |
| 1214 | − rel->r_addend += ofs; | |
| 1235 | + sym->st_info, sym_index); | |
| 1236 | + if (type == R_X86_64_PLT32) | |
| 1237 | + /* We store the place of the generated PLT slot | |
| 1238 | + in our addend. */ | |
| 1239 | + rel->r_addend += ofs; | |
| 1215 | 1240 | } |
| 1216 | 1241 | break; |
| 1217 | 1242 | #else |