public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] RISC-V/libgcc: Use `-fasynchronous-unwind-tables' for LIB2_DIVMOD_FUNCS
@ 2020-08-29 13:18 Maciej W. Rozycki
  2020-08-31  6:38 ` Kito Cheng
  0 siblings, 1 reply; 4+ messages in thread
From: Maciej W. Rozycki @ 2020-08-29 13:18 UTC (permalink / raw)
  To: gcc-patches
  Cc: Richard Biener, Andreas Schwab, Kito Cheng, Palmer Dabbelt,
	Andrew Waterman, Jim Wilson, Maciej W. Rozycki

Use `-fasynchronous-unwind-tables' rather than `-fexceptions 
-fnon-call-exceptions' in LIB2_DIVMOD_FUNCS compilation flags so as to 
provide unwind tables for the affected functions while not pulling the 
unwinder proper, which is not required here.

Beyond saving program space it fixes a RISC-V glibc build error due to 
unsatisfied `malloc' and `free' references from the unwinder causing 
link errors with `ld.so' where libgcc has been built at -O0.

	libgcc/
	* config/riscv/t-elf (LIB2_DIVMOD_EXCEPTION_FLAGS): New 
	variable.
---
Hi,

 As Mon, Aug 31st (a bank holiday in England) will be my last day at 
Western Digital and I won't be able to submit patches on behalf of the 
company afterwards here is a replacement change for RISC-V only in case 
the generic one discussed here:

<https://gcc.gnu.org/pipermail/gcc-patches/2020-August/552327.html

does not go through.  While I won't be able to submit changes I will 
continue watching the discussion and I will be able to commit either 
change once there is the final outcome, just as anyone would.

 This change has passed full GCC regression testing with the 
`riscv64-linux-gnu' target, RV64/lp64d and RV32/ilp32d multilibs, using 
QEMU in the Linux user emulation mode.

  Maciej
---
 libgcc/config/riscv/t-elf |    2 ++
 1 file changed, 2 insertions(+)

gcc-riscv-libgcc-divmod-asynchronous-unwind-tables.diff
Index: gcc/libgcc/config/riscv/t-elf
===================================================================
--- gcc.orig/libgcc/config/riscv/t-elf
+++ gcc/libgcc/config/riscv/t-elf
@@ -4,3 +4,5 @@ LIB2ADD += $(srcdir)/config/riscv/save-r
 	   $(srcdir)/config/riscv/div.S \
 	   $(srcdir)/config/riscv/atomic.c \
 
+# Avoid the full unwinder being pulled along with the division libcalls.
+LIB2_DIVMOD_EXCEPTION_FLAGS := -fasynchronous-unwind-tables

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] RISC-V/libgcc: Use `-fasynchronous-unwind-tables' for LIB2_DIVMOD_FUNCS
  2020-08-29 13:18 [PATCH] RISC-V/libgcc: Use `-fasynchronous-unwind-tables' for LIB2_DIVMOD_FUNCS Maciej W. Rozycki
@ 2020-08-31  6:38 ` Kito Cheng
  2020-09-28 19:38   ` Jim Wilson
  0 siblings, 1 reply; 4+ messages in thread
From: Kito Cheng @ 2020-08-31  6:38 UTC (permalink / raw)
  To: Maciej W. Rozycki
  Cc: GCC Patches, Andrew Waterman, Andreas Schwab, Jim Wilson

Hi Maciej:

LGTM, thanks for your patch!

On Sat, Aug 29, 2020 at 9:19 PM Maciej W. Rozycki via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> Use `-fasynchronous-unwind-tables' rather than `-fexceptions
> -fnon-call-exceptions' in LIB2_DIVMOD_FUNCS compilation flags so as to
> provide unwind tables for the affected functions while not pulling the
> unwinder proper, which is not required here.
>
> Beyond saving program space it fixes a RISC-V glibc build error due to
> unsatisfied `malloc' and `free' references from the unwinder causing
> link errors with `ld.so' where libgcc has been built at -O0.
>
>         libgcc/
>         * config/riscv/t-elf (LIB2_DIVMOD_EXCEPTION_FLAGS): New
>         variable.
> ---
> Hi,
>
>  As Mon, Aug 31st (a bank holiday in England) will be my last day at
> Western Digital and I won't be able to submit patches on behalf of the
> company afterwards here is a replacement change for RISC-V only in case
> the generic one discussed here:
>
> <https://gcc.gnu.org/pipermail/gcc-patches/2020-August/552327.html
>
> does not go through.  While I won't be able to submit changes I will
> continue watching the discussion and I will be able to commit either
> change once there is the final outcome, just as anyone would.
>
>  This change has passed full GCC regression testing with the
> `riscv64-linux-gnu' target, RV64/lp64d and RV32/ilp32d multilibs, using
> QEMU in the Linux user emulation mode.
>
>   Maciej
> ---
>  libgcc/config/riscv/t-elf |    2 ++
>  1 file changed, 2 insertions(+)
>
> gcc-riscv-libgcc-divmod-asynchronous-unwind-tables.diff
> Index: gcc/libgcc/config/riscv/t-elf
> ===================================================================
> --- gcc.orig/libgcc/config/riscv/t-elf
> +++ gcc/libgcc/config/riscv/t-elf
> @@ -4,3 +4,5 @@ LIB2ADD += $(srcdir)/config/riscv/save-r
>            $(srcdir)/config/riscv/div.S \
>            $(srcdir)/config/riscv/atomic.c \
>
> +# Avoid the full unwinder being pulled along with the division libcalls.
> +LIB2_DIVMOD_EXCEPTION_FLAGS := -fasynchronous-unwind-tables

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] RISC-V/libgcc: Use `-fasynchronous-unwind-tables' for LIB2_DIVMOD_FUNCS
  2020-08-31  6:38 ` Kito Cheng
@ 2020-09-28 19:38   ` Jim Wilson
  2020-09-29  0:26     ` Maciej W. Rozycki
  0 siblings, 1 reply; 4+ messages in thread
From: Jim Wilson @ 2020-09-28 19:38 UTC (permalink / raw)
  To: Kito Cheng, Maciej W. Rozycki
  Cc: Maciej W. Rozycki, GCC Patches, Andrew Waterman, Andreas Schwab

On Sun, Aug 30, 2020 at 11:39 PM Kito Cheng <kito.cheng@gmail.com> wrote
> Hi Maciej:
> LGTM, thanks for your patch!

I don't see this patch in the FSF GCC tree.  Maciej are you going to
commit it?  Or do you want us to commit it for you?

Jim

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] RISC-V/libgcc: Use `-fasynchronous-unwind-tables' for LIB2_DIVMOD_FUNCS
  2020-09-28 19:38   ` Jim Wilson
@ 2020-09-29  0:26     ` Maciej W. Rozycki
  0 siblings, 0 replies; 4+ messages in thread
From: Maciej W. Rozycki @ 2020-09-29  0:26 UTC (permalink / raw)
  To: Jim Wilson; +Cc: Kito Cheng, GCC Patches, Andrew Waterman, Andreas Schwab

Hi Jim,

> On Sun, Aug 30, 2020 at 11:39 PM Kito Cheng <kito.cheng@gmail.com> wrote
> > Hi Maciej:
> > LGTM, thanks for your patch!
> 
> I don't see this patch in the FSF GCC tree.  Maciej are you going to
> commit it?  Or do you want us to commit it for you?

 Since my departure from WDC I have been largely away, travelling and 
doing all kinds of personal stuff.  I hoped someone would pick it up and 
make some progress with the generic change I proposed earlier:

<https://gcc.gnu.org/pipermail/gcc-patches/2020-August/552327.html>

which would make the RISC-V-specific hack redundant, but clearly no one 
could be bothered enough.  I have pushed this change then so as not to 
hinder RISC-V support in GCC.

 Thanks, Kito, for your review!

  Maciej

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-09-29  0:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-29 13:18 [PATCH] RISC-V/libgcc: Use `-fasynchronous-unwind-tables' for LIB2_DIVMOD_FUNCS Maciej W. Rozycki
2020-08-31  6:38 ` Kito Cheng
2020-09-28 19:38   ` Jim Wilson
2020-09-29  0:26     ` Maciej W. Rozycki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).