diff --git a/tccelf.c b/tccelf.c index f92021c5..568b40fc 100644 --- a/tccelf.c +++ b/tccelf.c @@ -1173,6 +1173,13 @@ static unsigned long put_got_entry(TCCState *s1, put_elf_reloc(s1->dynsym, s1->got, s1->got->data_offset, reloc_type, index); + } else { + /* Without .dynsym (i.e. static link or memory output) we + still need relocs against the generated got, so as to fill + the entries with the symbol values (determined later). */ + put_elf_reloc(symtab_section, s1->got, + s1->got->data_offset, + reloc_type, sym_index); } /* And now create the GOT slot itself. */ ptr = section_ptr_add(s1->got, PTR_SIZE);