Skip to content

Commit 537e07c

Browse files
committed
Link pthread using the --whole-archive option
This fixes a SIGSEGV on Ubuntu 16.04 when running z3 compiled with `--staticbin` (issue Z3Prover#2457). It seems that without the --whole-archive option the linker does not statically link all pthread symbols. The fix is described here: https://stackoverflow.com/a/45271521/2491528
1 parent a78f899 commit 537e07c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

scripts/mk_util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2631,7 +2631,7 @@ def mk_config():
26312631
config.write('LINK=%s\n' % CXX)
26322632
config.write('LINK_FLAGS=\n')
26332633
config.write('LINK_OUT_FLAG=-o \n')
2634-
config.write('LINK_EXTRA_FLAGS= -lpthread %s\n' % LDFLAGS)
2634+
config.write('LINK_EXTRA_FLAGS=-Wl,--whole-archive -lpthread -Wl,--no-whole-archive %s\n' % LDFLAGS)
26352635
config.write('SO_EXT=%s\n' % SO_EXT)
26362636
config.write('SLINK=%s\n' % CXX)
26372637
config.write('SLINK_FLAGS=%s\n' % SLIBFLAGS)

0 commit comments

Comments
 (0)