https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118114
chenglulu <chenglulu at loongson dot cn> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |chenglulu at loongson dot cn Xi Ruoyao <xry111 at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |xry111 at gcc dot gnu.org --- Comment #1 from chenglulu <chenglulu at loongson dot cn> --- (In reply to Icenowy Zheng from comment #0) > Created attachment 59911 [details] > The source code, available as a cpp file > > When building the following quite minimal program with the flags described > in the title on LoongArch, the program cannot be executed and will crash: > > ``` > // build with `g++ -fPIC test.cpp -mtls-dialect=desc` > #include <mutex> > #include <iostream> > > std::once_flag flag; > > void co() > { > std::cout << "co" << std::endl; > } > > int main() > { > std::call_once(flag, co); > std::call_once(flag, co); > } > ``` > > Removing either flag can make the built program runs successfully and output > `co` as expected. TLS desc requires glibc version 2.40 and above when running. Have you confirmed your environment? --- Comment #2 from Xi Ruoyao <xry111 at gcc dot gnu.org> --- (In reply to chenglulu from comment #1) > TLS desc requires glibc version 2.40 and above when running. Have you > confirmed your environment? I can reproduce the crash on cfarm400.cfarm.net which has glibc 2.40. And IIRC glibc will emit "unknown reloc type" error message instead of just crashing if it doesn't support TLSDESC but the program is using TLSDESC.