Skip to content

Commit 45f1f37

Browse files
committed
arch/posix: 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 45f1f37

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

arch/posix/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ if (CONFIG_GPROF)
133133
target_link_options(native_simulator INTERFACE "-pg")
134134
endif()
135135

136+
# Explicitly link with libgcc_s to work around a race condition in glibc when
137+
# dynamically loading libgcc_s in multiple threads.
138+
target_link_options(native_simulator INTERFACE "-lgcc_s")
139+
136140
#
137141
# Support for the LLVM Sanitizer toolchain instrumentation frameworks
138142
# (supported by current gcc's as well)

0 commit comments

Comments
 (0)