Why does linking with pthread cause a segmentation fault?

前端 未结 4 512
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-14 01:15

I have a stripped down simple program with a static variable (\'abc.cpp\'):

#include 

int main(int, char**)
{
  static const std::string a(\         


        
4条回答
  •  伪装坚强ぢ
    2021-01-14 01:31

    The issue is actually a bug in the gold linker your system is probably using by default. Check the name printed by ld --version. The bug appears to still be open: https://sourceware.org/bugzilla/show_bug.cgi?id=16417

    Using the standard bfd linker does not show this problem. The linker used is either defined by gcc -fuse-ld=gold or the symlink in /usr/bin/ld

提交回复
热议问题