Mercurial > hg > qcc
changeset 396:928147ea8ab6
Fix "invalid relocation entry" problem on ubuntu. Fix from Bernhard
Fischer: http://lists.gnu.org/archive/html/tinycc-devel/2005-09/msg00051.html
author | landley@driftwood |
---|---|
date | Sat, 07 Oct 2006 23:00:13 -0400 |
parents | f357b2f8add5 |
children | 1236f720862e |
files | tccelf.c |
diffstat | 1 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/tccelf.c Mon Feb 20 21:16:10 2006 +0000 +++ b/tccelf.c Sat Oct 07 23:00:13 2006 -0400 @@ -1874,7 +1874,6 @@ /* second short pass to update sh_link and sh_info fields of new sections */ - sm = sm_table; for(i = 1; i < ehdr.e_shnum; i++) { s = sm_table[i].s; if (!s || !sm_table[i].new_section) @@ -1888,6 +1887,7 @@ s1->sections[s->sh_info]->reloc = s; } } + sm = sm_table; /* resolve symbols */ old_to_new_syms = tcc_mallocz(nb_syms * sizeof(int)); @@ -1949,9 +1949,11 @@ if (sym_index >= nb_syms) goto invalid_reloc; sym_index = old_to_new_syms[sym_index]; - if (!sym_index) { + /* ignore link_once in rel section. */ + if (!sym_index && !sm->link_once) { invalid_reloc: - error_noabort("Invalid relocation entry"); + error_noabort("Invalid relocation entry [%2d] '%s' @ %.8x", + i, strsec + sh->sh_name, rel->r_offset); goto fail; } rel->r_info = ELF32_R_INFO(sym_index, type);