mirror of
https://github.com/mirror/tinycc.git
synced 2024-12-28 04:00:06 +08:00
weak redefinition of a symbol should weaken the original
This commit is contained in:
parent
38cbb40e90
commit
0f0c2d9c02
3
tccgen.c
3
tccgen.c
@ -5592,6 +5592,9 @@ ST_FUNC void decl(int l)
|
|||||||
extern */
|
extern */
|
||||||
sym = external_sym(v, &type, r, asm_label);
|
sym = external_sym(v, &type, r, asm_label);
|
||||||
|
|
||||||
|
if (type.t & VT_WEAK)
|
||||||
|
sym->type.t |= VT_WEAK;
|
||||||
|
|
||||||
if (ad.alias_target) {
|
if (ad.alias_target) {
|
||||||
Section tsec;
|
Section tsec;
|
||||||
Elf32_Sym *esym;
|
Elf32_Sym *esym;
|
||||||
|
@ -2370,6 +2370,10 @@ extern __typeof(dummy) weak_dummy1 __attribute__((weak, alias("dummy")));
|
|||||||
extern __typeof(dummy) __attribute__((weak, alias("dummy"))) weak_dummy2;
|
extern __typeof(dummy) __attribute__((weak, alias("dummy"))) weak_dummy2;
|
||||||
extern __attribute__((weak, alias("dummy"))) __typeof(dummy) weak_dummy3;
|
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)
|
void __attribute__((weak)) weak_test(void)
|
||||||
{
|
{
|
||||||
printf("weak_f1=%d\n", weak_f1 ? weak_f1() : 123);
|
printf("weak_f1=%d\n", weak_f1 ? weak_f1() : 123);
|
||||||
|
Loading…
Reference in New Issue
Block a user