Skip to content

Commit c678854

Browse files
committed
boards: native_sim: Workaround race condition in glibc
Explicitly link with libgcc_s to work around a race condition in glibc when dynamically loading libgcc_s in multiple threads. The race condition was observed when running native_sim with CONFIG_REBOOT=y and CONFIG_NATIVE_SIM_REBOOT=y and rebooting quickly from main(). Signed-off-by: Tim Pambor <[email protected]>
1 parent 4a69c1b commit c678854

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

boards/native/native_sim/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ zephyr_library_sources(
1616
if(CONFIG_NATIVE_SIM_REBOOT)
1717
zephyr_library_sources(reboot.c)
1818
target_sources(native_simulator INTERFACE reboot_bottom.c)
19+
20+
# Explicitly link with libgcc_s to work around a race condition in glibc when
21+
# dynamically loading libgcc_s in multiple threads.
22+
target_link_options(native_simulator INTERFACE "-lgcc_s")
1923
endif()
2024

2125
zephyr_include_directories(

0 commit comments

Comments
 (0)