Fix core dump in case -static is used

This commit is contained in:
herman ten brugge 2022-05-26 15:41:52 +02:00
parent a4e0f7ef05
commit afc136262e

View File

@ -2541,7 +2541,7 @@ static void elf_patch_global_offset_size(TCCState *s1, Section *s)
{
int sym_index;
if ((sym_index = find_elf_sym(s, "_GLOBAL_OFFSET_TABLE_")))
if (s && (sym_index = find_elf_sym(s, "_GLOBAL_OFFSET_TABLE_")))
((ElfW(Sym) *)s->data)[sym_index].st_size = s1->got->data_offset;
}