diff --git a/examples/ex_weak.c b/examples/ex_weak.c deleted file mode 100755 index 2a2bd19c..00000000 --- a/examples/ex_weak.c +++ /dev/null @@ -1,11 +0,0 @@ -#! /usr/local/bin/tcc -run -#include <tcclib.h> - -extern void weak_f (void) __attribute__ ((weak)); - -int main () -{ - if (weak_f) { - weak_f(); - } -} diff --git a/examples/weak_f.c b/examples/weak_f.c deleted file mode 100644 index e7445317..00000000 --- a/examples/weak_f.c +++ /dev/null @@ -1,6 +0,0 @@ -#include <tcclib.h> - -void weak_f (void) -{ - printf("Weak\n"); -} diff --git a/libtcc.c b/libtcc.c index 5f064ddd..2575a051 100644 --- a/libtcc.c +++ b/libtcc.c @@ -429,7 +429,7 @@ ST_FUNC void put_extern_sym2(Sym *sym, Section *section, if (sym->type.t & VT_STATIC) sym_bind = STB_LOCAL; else { - if (sym->type.ref && FUNC_WEAK(sym->type.ref->r)) + if (sym_type == STT_FUNC && sym->type.ref && FUNC_WEAK(sym->type.ref->r)) sym_bind = STB_WEAK; else sym_bind = STB_GLOBAL;