[Bug target/85492] riscv64: endless loop when throwing an exception from a constructor
andrew at sifive dot com
gcc-bugzilla@gcc.gnu.org
Thu May 17 22:59:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85492
--- Comment #10 from Andrew Waterman <andrew at sifive dot com> ---
Thanks for the suggestion. Let's go with the CFI-directive approach.
On Sat, Apr 28, 2018 at 5:45 AM, aurelien at aurel32 dot net
<gcc-bugzilla@gcc.gnu.org> wrote:
> 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. */
More information about the Gcc-bugs
mailing list