From c181f898c2fecd7d2985d0753d0b99ad35860920 Mon Sep 17 00:00:00 2001 From: Nikolaj Bjorner Date: Wed, 6 Nov 2019 10:25:38 +0100 Subject: [PATCH] enable static linking pthreads, conditionally, #2683 Signed-off-by: Nikolaj Bjorner --- scripts/mk_util.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/mk_util.py b/scripts/mk_util.py index 6829b7251..d853481c4 100644 --- a/scripts/mk_util.py +++ b/scripts/mk_util.py @@ -2631,7 +2631,10 @@ def mk_config(): config.write('LINK=%s\n' % CXX) config.write('LINK_FLAGS=\n') config.write('LINK_OUT_FLAG=-o \n') - config.write('LINK_EXTRA_FLAGS= -lpthread %s\n' % LDFLAGS) + if build_static_lib() or build_static_bin(): + config.write('LINK_EXTRA_FLAGS=-Wl,--whole-archive -lpthread -Wl,--no-whole-archive %s\n' % LDFLAGS) + else: + config.write('LINK_EXTRA_FLAGS= -lpthread %s\n' % LDFLAGS) config.write('SO_EXT=%s\n' % SO_EXT) config.write('SLINK=%s\n' % CXX) config.write('SLINK_FLAGS=%s\n' % SLIBFLAGS)