-
Notifications
You must be signed in to change notification settings - Fork 15.7k
Description
Using [[gnu::weak]] function declarations as is done in the following places results in GOT entries:
llvm-project/libc/src/stdlib/atexit.cpp
Line 19 in da98be1
| [[gnu::weak]] extern void teardown_main_tls(); |
llvm-project/libc/src/stdlib/atexit.cpp
Lines 30 to 31 in da98be1
| if (teardown_main_tls) | |
| teardown_main_tls(); |
llvm-project/libc/src/stdlib/exit.cpp
Line 23 in da98be1
| extern "C" [[gnu::weak]] void __cxa_thread_finalize(); |
llvm-project/libc/src/stdlib/exit.cpp
Lines 30 to 31 in da98be1
| if (__cxa_thread_finalize) | |
| __cxa_thread_finalize(); |
| [[gnu::weak]] extern void teardown_main_tls(); |
llvm-project/libc/src/stdlib/quick_exit.cpp
Lines 23 to 24 in da98be1
| if (teardown_main_tls) | |
| teardown_main_tls(); |
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.