https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85492
--- Comment #1 from Jim Wilson <wilson at gcc dot gnu.org> --- The testcase fails with default dynamic linking. It works with static linking. It also works if runtime_error is removed and we have just a plain throw. Using github riscv/riscv-gnu-toolchain project, which has older versions of binutils, gcc, and glibc, it works both static and dynamic. If I update binutils and/or gcc to FSF mainline, it still works. If I update glibc to FSF glibc-2.27, it fails dynamic but works static. So apparently the problem was triggered by a glibc change when it was upstreamed. I tried adding aborts to libgcc and libstdc++ unwind/exception routines. They aren't hit. qemu traces suggest it is looping inside the dynamic linker. LD_DEBUG=all isn't helpful. It prints a lot of messages for binding symbols, and then no messages when it gets stuck looping (assuming it is looping inside ld.so). Unfortunately, we don't have gdb support yet. I can't use gdb sim to generate a trace as gdb sim doesn't support dynamic linked binaries. It isn't clear how to debug this. Maybe I can find a clue in the gcc testsuite. I haven't tried running that natively yet. It will likely take a while to run though and may not trigger the same failure.