Skip to content

Commit 8901c1c

Browse files
[libc] Fix atexit not getting linked on linux (#98537)
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.
1 parent 7a49d80 commit 8901c1c

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

libc/src/stdlib/CMakeLists.txt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -497,15 +497,24 @@ add_entrypoint_object(
497497
.exit_handler
498498
)
499499

500+
list(APPEND exit_deps
501+
libc.src.__support.OSUtil.osutil
502+
._Exit
503+
)
504+
if (NOT LIBC_TARGET_OS_IS_BAREMETAL)
505+
list(APPEND exit_deps
506+
.atexit
507+
)
508+
endif()
509+
500510
add_entrypoint_object(
501511
exit
502512
SRCS
503513
exit.cpp
504514
HDRS
505515
exit.h
506516
DEPENDS
507-
._Exit
508-
libc.src.__support.OSUtil.osutil
517+
${exit_deps}
509518
)
510519

511520
add_entrypoint_object(

0 commit comments

Comments
 (0)