diff options
| author | Joe Soroka <gits@joesoroka.com> | 2011-03-07 00:25:27 -0800 |
|---|---|---|
| committer | Joe Soroka <gits@joesoroka.com> | 2011-03-07 00:25:27 -0800 |
| commit | 0f0c2d9c02d357c247f7310908124c39b8625d35 (patch) | |
| tree | 66b499cd032abe24607dd078ae94a8d5457ef91c | |
| parent | 38cbb40e904f3113ae117278fbbcda0f71f18c92 (diff) | |
| download | tinycc-0f0c2d9c02d357c247f7310908124c39b8625d35.tar.gz tinycc-0f0c2d9c02d357c247f7310908124c39b8625d35.tar.bz2 | |
weak redefinition of a symbol should weaken the original
| -rw-r--r-- | tccgen.c | 3 | ||||
| -rw-r--r-- | tests/tcctest.c | 4 |
2 files changed, 7 insertions, 0 deletions
@@ -5592,6 +5592,9 @@ ST_FUNC void decl(int l) extern */ sym = external_sym(v, &type, r, asm_label); + if (type.t & VT_WEAK) + sym->type.t |= VT_WEAK; + if (ad.alias_target) { Section tsec; Elf32_Sym *esym; diff --git a/tests/tcctest.c b/tests/tcctest.c index bd1b975..fc2b9ed 100644 --- a/tests/tcctest.c +++ b/tests/tcctest.c @@ -2370,6 +2370,10 @@ extern __typeof(dummy) weak_dummy1 __attribute__((weak, alias("dummy"))); extern __typeof(dummy) __attribute__((weak, alias("dummy"))) weak_dummy2; extern __attribute__((weak, alias("dummy"))) __typeof(dummy) weak_dummy3; +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"))); + void __attribute__((weak)) weak_test(void) { printf("weak_f1=%d\n", weak_f1 ? weak_f1() : 123); |
