Skip to content

[libc] Using [[gnu::weak]] declarations generates GOT entries #173409

@petrhosek

Description

@petrhosek

Using [[gnu::weak]] function declarations as is done in the following places results in GOT entries:

[[gnu::weak]] extern void teardown_main_tls();

if (teardown_main_tls)
teardown_main_tls();

extern "C" [[gnu::weak]] void __cxa_thread_finalize();

if (__cxa_thread_finalize)
__cxa_thread_finalize();

[[gnu::weak]] extern void teardown_main_tls();

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions