Issue 183916
Summary [arm32] [bug] Weak Symbols as Function Pointer Fails to be overrided by Strong Symbol
Labels new issue
Assignees
Reporter Zhenhang1213
    test.c
```
#include <stdio.h>

#pragma GCC visibility push(hidden)

void __attribute__((__weak__)) xxx(void)
{
 printf("weak\n");
}

void call_func(void (*f)(void));

int main()
{
        call_func(xxx);
        return 0;
}

```
test1.c

```
#include <stdio.h>

#pragma GCC visibility push(hidden)
void xxx(void)
{
        printf("default\n");
}

void call_func(void (*f)(void))
{
        f();
}
```

opts:
arm32-clang test.c test1.c  -static -fpic
result:
```
weak
```
arm32-gcc test.c test1.c  -static -fpic
result:
```
default
```

godbolt:
https://godbolt.org/z/jrT49YKM1

I believe this issue is closely related to how weak symbol function pointers are loaded. How can we fix this problem to align with GCC's behavior?


_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to