On 04/20/2015 12:59 PM, Szabolcs Nagy wrote:
libgcc/gthr-posix.h uses weak reference logic to determine if libpthread is linked into the application or not. This is broken unless there is special workaround with libc internal knowledge and even then static linking needs further manual link time workaround, so this was disabled for os/generic in libstdc++v3 and for musl in libgfortran.The change minimizes the impact on other setups, but I think the weak ref logic should be disabled by default, it is never entirely correct. Conforming code can crash on a glibc setup too: $ cat a.cpp #include <pthread.h> void(*f)(void) = (void(*)(void))pthread_key_create; int main(){} $ g++ -static a.cpp -lpthread $ ./a.out Segmentation fault I reported this previously at https://gcc.gnu.org/ml/gcc/2014-11/msg00246.html libgfortran/Changelog: 2015-04-16 Szabolcs Nagy <[email protected]> * acinclude.m4 (GTHREAD_USE_WEAK): Define as 0 for *-*-musl*. * configure: Regenerate. libstdc++v3/Changelog: 2015-04-16 Szabolcs Nagy <[email protected]> * config/os/generic/os_defines.h (_GLIBCXX_GTHREAD_USE_WEAK): Define. * configure.host (os_include_dir): Set to "os/generic" for linux-musl*.
OK. Please install on the trunk. jeff
