https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118114
--- Comment #3 from Xi Ruoyao <xry111 at gcc dot gnu.org> --- Hmm... This seems like a ld bug: a.out: file format elf64-loongarch DYNAMIC RELOCATION RECORDS OFFSET TYPE VALUE 0000000000007d90 R_LARCH_RELATIVE *ABS*+0x0000000000000d88 0000000000007d98 R_LARCH_RELATIVE *ABS*+0x0000000000000d30 0000000000007fa8 R_LARCH_RELATIVE *ABS*+0x0000000000000e50 0000000000008060 R_LARCH_RELATIVE *ABS*+0x0000000000008060 0000000000000000 R_LARCH_NONE *ABS* 0000000000000000 R_LARCH_NONE *ABS* 0000000000000000 R_LARCH_NONE *ABS* 0000000000007fa0 R_LARCH_TLS_TPREL64 _ZSt15__once_callable@GLIBCXX_3.4.11 0000000000007fc0 R_LARCH_TLS_TPREL64 _ZSt11__once_call@GLIBCXX_3.4.11 ... ... So it's doing a desc => IE relaxation. But the code sequence isn't changed and still expects TLS desc: 0000000000000e58 <_ZZNSt9once_flag18_Prepare_executionC4IZSt9call_onceIRFvvEJEEvRS_OT_DpOT0_EUlvE_EERS6_ENUlvE_4_FUNEv>: e58: 02ffc063 addi.d $sp, $sp, -16 e5c: 29c02061 st.d $ra, $sp, 8 e60: 1a000104 pcalau12i $a0, 8 e64: 02fe8084 addi.d $a0, $a0, -96 e68: 28c00081 ld.d $ra, $a0, 0 e6c: 4c000021 jirl $ra, $ra, 0