aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tccelf.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/tccelf.c b/tccelf.c
index fad23b8..9a7aa91 100644
--- a/tccelf.c
+++ b/tccelf.c
@@ -679,7 +679,8 @@ static void sort_syms(TCCState *s1, Section *s)
p++;
}
/* save the number of local symbols in section header */
- s->sh_info = q - new_syms;
+ if( s->sh_size ) /* this 'if' makes IDA happy */
+ s->sh_info = q - new_syms;
/* then second pass for non local symbols */
p = (ElfW(Sym) *)s->data;
@@ -1985,10 +1986,11 @@ static void tidy_section_headers(TCCState *s1, int *sec_order)
for_each_elem(symtab_section, 1, sym, ElfW(Sym))
if (sym->st_shndx != SHN_UNDEF && sym->st_shndx < SHN_LORESERVE)
sym->st_shndx = backmap[sym->st_shndx];
- for_each_elem(s1->dynsym, 1, sym, ElfW(Sym))
- if (sym->st_shndx != SHN_UNDEF && sym->st_shndx < SHN_LORESERVE)
- sym->st_shndx = backmap[sym->st_shndx];
-
+ if( !s1->static_link ) {
+ for_each_elem(s1->dynsym, 1, sym, ElfW(Sym))
+ if (sym->st_shndx != SHN_UNDEF && sym->st_shndx < SHN_LORESERVE)
+ sym->st_shndx = backmap[sym->st_shndx];
+ }
for (i = 0; i < s1->nb_sections; i++)
sec_order[i] = i;
tcc_free(s1->sections);