This reverts commit fef838db2d124db3f1357385972371ccba7af2c6, should not be necessary anymore.
Unified · Split
| @@ -2270,7 +2270,6 @@ static void *load_data(int fd, unsigned long file_offset, unsigned long size) · 2269 unmodified lines | ||
| 2270 | 2270 | typedef struct SectionMergeInfo { |
| 2271 | 2271 | Section *s; /* corresponding existing section */ |
| 2272 | 2272 | unsigned long offset; /* offset of the new section in the existing section */ |
| 2273 | − unsigned long oldlen; /* size of existing section before adding this one */ | |
| 2274 | 2273 | uint8_t new_section; /* true if section 's' was added */ |
| 2275 | 2274 | uint8_t link_once; /* true if link once section */ |
| 2276 | 2275 | } SectionMergeInfo; |
| @@ -2421,7 +2420,6 @@ ST_FUNC int tcc_load_object_file(TCCState *s1, · 144 unmodified lines | ||
| 2421 | 2420 | } |
| 2422 | 2421 | |
| 2423 | 2422 | /* align start of section */ |
| 2424 | − sm_table[i].oldlen = s->data_offset; | |
| 2425 | 2423 | offset = s->data_offset; |
| 2426 | 2424 | |
| 2427 | 2425 | if (0 == strcmp(sh_name, ".stab")) { |
| @@ -2479,15 +2477,9 @@ ST_FUNC int tcc_load_object_file(TCCState *s1, · 51 unmodified lines | ||
| 2479 | 2477 | if (sh->sh_link > 0) |
| 2480 | 2478 | s->link = sm_table[sh->sh_link].s; |
| 2481 | 2479 | if (sh->sh_type == SHT_RELX) { |
| 2482 | − if (sm_table[sh->sh_info].s) { | |
| 2483 | − s->sh_info = sm_table[sh->sh_info].s->sh_num; | |
| 2484 | − /* update backward link */ | |
| 2485 | − s1->sections[s->sh_info]->reloc = s; | |
| 2486 | − } else { | |
| 2487 | − /* we haven't read the target of relocs, so cancel them */ | |
| 2488 | − s->data_offset = sm_table[i].oldlen; | |
| 2489 | − sm_table[i].s = NULL; | |
| 2490 | − } | |
| 2480 | + s->sh_info = sm_table[sh->sh_info].s->sh_num; | |
| 2481 | + /* update backward link */ | |
| 2482 | + s1->sections[s->sh_info]->reloc = s; | |
| 2491 | 2483 | } |
| 2492 | 2484 | } |
| 2493 | 2485 | sm = sm_table; |