https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86770
Bug ID: 86770 Summary: UNRESOLVED: 30_threads/call_once/call_once1.cc compilation failed to produce executable Product: gcc Version: 9.0 Status: UNCONFIRMED Keywords: link-failure Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: belyshev at depni dot sinp.msu.ru Target Milestone: --- Target: riscv64-unknown-linux-gnu Everything under 30_threads/ fail to link on riscv with -Wl,--gc-sections. Short testcase: $ cat > bug.cc <<EOF namespace std { extern __thread void *__once_callable; } int main (void) { return !!std::__once_callable; } EOF $ g++ bug.cc -Wl,--gc-sections `_ZSt15__once_callable@@GLIBCXX_3.4.11' referenced in section `.text' of /tmp/cc1DaRxp.o: defined in discarded section `.tdata.dyn' of /usr/lib64/lp64d/crt1.o collect2: error: ld returned 1 exit status $ Not a regression, fails also on 8 and 7 branches.