| @@ -1874,7 +1874,6 @@ static int tcc_load_object_file(TCCState *s1, · 1873 unmodified lines |
| 1874 | | 1874 | |
| 1875 | /* second short pass to update sh_link and sh_info fields of new | 1875 | /* second short pass to update sh_link and sh_info fields of new |
| 1876 | sections */ | 1876 | sections */ |
| 1877 | sm = sm_table; | | |
| 1878 | for(i = 1; i < ehdr.e_shnum; i++) { | 1877 | for(i = 1; i < ehdr.e_shnum; i++) { |
| 1879 | s = sm_table[i].s; | 1878 | s = sm_table[i].s; |
| 1880 | if (!s || !sm_table[i].new_section) | 1879 | if (!s || !sm_table[i].new_section) |
| @@ -1888,6 +1887,7 @@ static int tcc_load_object_file(TCCState *s1, · 7 unmodified lines |
| 1888 | s1->sections[s->sh_info]->reloc = s; | 1887 | s1->sections[s->sh_info]->reloc = s; |
| 1889 | } | 1888 | } |
| 1890 | } | 1889 | } |
| | 1890 | sm = sm_table; |
| 1891 | | 1891 | |
| 1892 | /* resolve symbols */ | 1892 | /* resolve symbols */ |
| 1893 | old_to_new_syms = tcc_mallocz(nb_syms * sizeof(int)); | 1893 | old_to_new_syms = tcc_mallocz(nb_syms * sizeof(int)); |
| @@ -1949,9 +1949,11 @@ static int tcc_load_object_file(TCCState *s1, · 55 unmodified lines |
| 1949 | if (sym_index >= nb_syms) | 1949 | if (sym_index >= nb_syms) |
| 1950 | goto invalid_reloc; | 1950 | goto invalid_reloc; |
| 1951 | sym_index = old_to_new_syms[sym_index]; | 1951 | sym_index = old_to_new_syms[sym_index]; |
| 1952 | if (!sym_index) { | 1952 | /* ignore link_once in rel section. */ |
| | 1953 | if (!sym_index && !sm->link_once) { |
| 1953 | invalid_reloc: | 1954 | invalid_reloc: |
| 1954 | error_noabort("Invalid relocation entry"); | 1955 | error_noabort("Invalid relocation entry [%2d] '%s' @ %.8x", |
| | 1956 | i, strsec + sh->sh_name, rel->r_offset); |
| 1955 | goto fail; | 1957 | goto fail; |
| 1956 | } | 1958 | } |
| 1957 | rel->r_info = ELF32_R_INFO(sym_index, type); | 1959 | rel->r_info = ELF32_R_INFO(sym_index, type); |