Issue 173409
Summary [libc] Using `[[gnu::weak]]` declarations generates GOT entries
Labels libc
Assignees
Reporter petrhosek
    Using `[[gnu::weak]]` function declarations as is done in the following places results in GOT entries:

https://github.com/llvm/llvm-project/blob/da98be133e2f15cceb2c3982119490f6cd304eff/libc/src/stdlib/atexit.cpp#L19

https://github.com/llvm/llvm-project/blob/da98be133e2f15cceb2c3982119490f6cd304eff/libc/src/stdlib/atexit.cpp#L30-L31

https://github.com/llvm/llvm-project/blob/da98be133e2f15cceb2c3982119490f6cd304eff/libc/src/stdlib/exit.cpp#L23

https://github.com/llvm/llvm-project/blob/da98be133e2f15cceb2c3982119490f6cd304eff/libc/src/stdlib/exit.cpp#L30-L31

https://github.com/llvm/llvm-project/blob/da98be133e2f15cceb2c3982119490f6cd304eff/libc/src/stdlib/quick_exit.cpp#L19

https://github.com/llvm/llvm-project/blob/da98be133e2f15cceb2c3982119490f6cd304eff/libc/src/stdlib/quick_exit.cpp#L23-L24

This is a problem for baremetal targets which use static linking.

We need to either restructure the code to avoid the use of weak symbols altogether, or provide empty weak definitions.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to