diff --git a/tccelf.c b/tccelf.c
index e5f6c42..6ddfb9f 100644
--- a/tccelf.c
+++ b/tccelf.c
@@ -1098,8 +1098,10 @@ ST_FUNC void build_got_entries(TCCState *s1)
             } else
                 reloc_type = R_GLOB_DAT;
 
-            if (!s1->got)
+            if (!s1->got) {
                 build_got(s1);
+                sym = &((ElfW(Sym) *)symtab_section->data)[sym_index]; //attempt
+            }
 
             if (gotplt_entry == BUILD_GOT_ONLY)
                 continue;
