From: Juergen Perlinger Date: Fri, 3 Jan 2014 23:11:38 +0000 (+0100) Subject: [Bug 2332] Force reference to 'libgcc_s' when using GCC, because threading+restricted... X-Git-Tag: NTP_4_2_7P410~3^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=55591bc9a00577391159b7dfa0e0d74bd59e74e4;p=thirdparty%2Fntp.git [Bug 2332] Force reference to 'libgcc_s' when using GCC, because threading+restricted user+locked memory otherwise fails on Linux. bk: 52c743aatSh58iMpciUeJ4vU4ZBckg --- diff --git a/ChangeLog b/ChangeLog index 6cce57c2d..39d987dbf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,5 @@ +* [Bug 2332] Force reference to 'libgcc_s' when using GCC, because + threading+restricted user+locked memory otherwise fails on Linux. * [Bug 2060] Warn about restrictions with "kod" but not "limited". (4.2.7p408) 2013/12/29 Released by Harlan Stenn * [Bug 2187] Update version number generation scripts. diff --git a/sntp/m4/ntp_libntp.m4 b/sntp/m4/ntp_libntp.m4 index 004f491cd..cf29992ce 100644 --- a/sntp/m4/ntp_libntp.m4 +++ b/sntp/m4/ntp_libntp.m4 @@ -338,6 +338,16 @@ case "$enable_thread_support" in yes) PTHREAD_LIBS="$LTHREAD_LIBS" have_pthreads=yes + # bug 2332: With GCC we need to force a reference to libgcc_s, or the + # combination threads + setuid + mlockall does not work on linux + # because thread cancellation fails to load libgcc_s with dlopen(). + # We have to pass this all as linker options to avoid argument + # reordering by libtool. + case "$GCC" in + yes) + PTHREAD_LIBS="$LTHREAD_LIBS -Wl,--no-as-needed,-lgcc_s,--as-needed" + ;; + esac esac esac esac