aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgrischka <grischka>2010-06-30 20:25:04 +0200
committergrischka <grischka>2010-06-30 20:25:04 +0200
commit82c5edb31cd0bb2ee699992c45557006f1681e0e (patch)
treece3a2d21b077f0c1fd469bee66e156670768dcb3
parent5e6fabefd7ae6d6fa84c965ad45f7b15d42a2970 (diff)
downloadtinycc-82c5edb31cd0bb2ee699992c45557006f1681e0e.tar.gz
tinycc-82c5edb31cd0bb2ee699992c45557006f1681e0e.tar.bz2
Avoid crash with "Avoid a crash with weak symbols for "make test""
This fixes commit 197a6acb30940068d1dc3d0fa53c9f0863309885 which fixed commit 95b9a477b6743004e0e9bf728b25bf63d2908777 Also remove useless example files
-rwxr-xr-xexamples/ex_weak.c11
-rw-r--r--examples/weak_f.c6
-rw-r--r--libtcc.c2
3 files changed, 1 insertions, 18 deletions
diff --git a/examples/ex_weak.c b/examples/ex_weak.c
deleted file mode 100755
index 2a2bd19..0000000
--- 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 e744531..0000000
--- 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 5f064dd..2575a05 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;