Skip to content

Commit

Permalink
[libc] Fix atexit not getting linked on linux
Browse files Browse the repository at this point in the history
Atexit needs to be linked into exit on linux since atexit defines
__cxa_finalize. This should probably be fixed a different way but this
works for now.
  • Loading branch information
michaelrj-google committed Jul 11, 2024
1 parent b187ecb commit c464f29
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions libc/src/stdlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -497,15 +497,24 @@ add_entrypoint_object(
.exit_handler
)

list(APPEND exit_deps
libc.src.__support.OSUtil.osutil
._Exit
)
if (NOT LIBC_TARGET_OS_IS_BAREMETAL)
# list(APPEND exit_deps
# .atexit
# )
endif()

add_entrypoint_object(
exit
SRCS
exit.cpp
HDRS
exit.h
DEPENDS
._Exit
libc.src.__support.OSUtil.osutil
${exit_deps}
)

add_entrypoint_object(
Expand Down

0 comments on commit c464f29

Please sign in to comment.