Avoid crash with "Avoid a crash with weak symbols for "make test""

This fixes commit 197a6acb30
which fixed commit 95b9a477b6

Also remove useless example files
master
grischka 2010-06-30 20:25:04 +02:00
parent 5e6fabefd7
commit 82c5edb31c
3 changed files with 1 additions and 18 deletions

View File

@ -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();
}
}

View File

@ -1,6 +0,0 @@
#include <tcclib.h>
void weak_f (void)
{
printf("Weak\n");
}

View File

@ -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;