diff --git a/tccelf.c b/tccelf.c index 76057275..609a07ab 100644 --- a/tccelf.c +++ b/tccelf.c @@ -2527,6 +2527,8 @@ static int tcc_output_elf(TCCState *s1, FILE *f, int phnum, ElfW(Phdr) *phdr) ElfW(Ehdr) ehdr; ElfW(Shdr) shdr, *sh; + sort_syms(s1, s1->symtab); + file_type = s1->output_type; shnum = s1->nb_sections; @@ -2614,8 +2616,6 @@ static int tcc_output_elf(TCCState *s1, FILE *f, int phnum, ElfW(Phdr) *phdr) offset += fwrite(sh, 1, sizeof(ElfW(Shdr)), f); } - sort_syms(s1, s1->symtab); - /* output sections */ for(i = 1; i < s1->nb_sections; i++) { s = s1->sections[i];