aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tccgen.c2
-rw-r--r--tests/tcctest.c3
2 files changed, 4 insertions, 1 deletions
diff --git a/tccgen.c b/tccgen.c
index c3456b7..8a50832 100644
--- a/tccgen.c
+++ b/tccgen.c
@@ -5600,7 +5600,7 @@ ST_FUNC void decl(int l)
sym = external_sym(v, &type, r, asm_label);
if (type.t & VT_WEAK)
- sym->type.t |= VT_WEAK;
+ weaken_symbol(sym);
if (ad.alias_target) {
Section tsec;
diff --git a/tests/tcctest.c b/tests/tcctest.c
index fc2b9ed..1b2fb36 100644
--- a/tests/tcctest.c
+++ b/tests/tcctest.c
@@ -2374,6 +2374,9 @@ int some_lib_func(void);
int dummy_impl_of_slf(void) { return 444; }
int some_lib_func(void) __attribute__((weak, alias("dummy_impl_of_slf")));
+int weak_toolate() { return 0; }
+int weak_toolate() __attribute__((weak));
+
void __attribute__((weak)) weak_test(void)
{
printf("weak_f1=%d\n", weak_f1 ? weak_f1() : 123);