This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/85492] riscv64: endless loop when throwing an exception from a constructor
- From: "aurelien at aurel32 dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 28 Apr 2018 12:45:03 +0000
- Subject: [Bug target/85492] riscv64: endless loop when throwing an exception from a constructor
- Auto-submitted: auto-generated
- References: <bug-85492-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85492
--- Comment #7 from Aurelien Jarno <aurelien at aurel32 dot net> ---
(In reply to Jim Wilson from comment #3)
Thanks a lot Jim for finding out the issue without using gdb, that was quite a
challenge.
(In reply to Jim Wilson from comment #6)
> I suggest you handle the glibc patch.
Should I just close this bug and open a new one on the glibc side?
> Note that you can probably also fix this by adding unwind direcives to
> _start to say that the return address is in x0. This would avoid the minor
> code size increase, but takes a little more effort to figure out how to add
> the right unwind directives to assembly code to make this work. I haven't
> tried that.
I think this should be done with the cfi_undefined directive, like in the patch
below:
--- a/sysdeps/riscv/start.S
+++ b/sysdeps/riscv/start.S
@@ -43,6 +43,8 @@
__libc_start_main wants this in a5. */
ENTRY (ENTRY_POINT)
+ /* Mark ra as undefined in order to stop unwinding here! */
+ cfi_undefined (ra)
call .Lload_gp
mv a5, a0 /* rtld_fini. */
/* main may be in a shared library. */