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

Complement commit b932f770f70d ("x86_64 frame unwind info"), SVN r46374, 
<https://gcc.gnu.org/ml/gcc-patches/2001-10/msg00860.html>, and replace 
`-fexceptions -fnon-call-exceptions' with `-fasynchronous-unwind-tables' 
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.

	gcc/
	* testsuite/gcc.target/arm/div64-unwinding.c: Rename to...
	* testsuite/gcc.dg/div64-unwinding.c: ... this.

	libgcc/
	* Makefile.in [!LIB2_DIVMOD_EXCEPTION_FLAGS]
	(LIB2_DIVMOD_EXCEPTION_FLAGS): Replace `-fexceptions
	-fnon-call-exceptions' with `-fasynchronous-unwind-tables'.
---
Hi,

 No change from v2 except for the removal of the ARM parts; hence no need 
to retest.  OK to apply?

  Maciej

Changes from v2:

- Removal of the ARM overrides removed.

Changes from v1:

- ChangeLog entries added.
---
 gcc/testsuite/gcc.dg/div64-unwinding.c         |   25 +++++++++++++++++++++++++
 gcc/testsuite/gcc.target/arm/div64-unwinding.c |   25 -------------------------
 libgcc/Makefile.in                             |    2 +-
 3 files changed, 26 insertions(+), 26 deletions(-)

gcc-libgcc-divmod-asynchronous-unwind-tables.diff
Index: gcc/gcc/testsuite/gcc.dg/div64-unwinding.c
===================================================================
--- /dev/null
+++ gcc/gcc/testsuite/gcc.dg/div64-unwinding.c
@@ -0,0 +1,25 @@
+/* Performing a 64-bit division should not pull in the unwinder.  */
+
+/* { dg-do run { target { { ! *-*-linux* } && { ! *-*-uclinux* } } } } */
+/* { dg-skip-if "load causes weak symbol resolution" { vxworks_kernel } } */
+/* { dg-options "-O0" } */
+
+#include <stdlib.h>
+
+long long
+foo (long long c, long long d)
+{
+  return c/d;
+}
+
+long long x = 0;
+long long y = 1;
+
+extern int (*_Unwind_RaiseException) (void *) __attribute__((weak));
+
+int main(void)
+{
+  if (&_Unwind_RaiseException != NULL)
+    abort ();;
+  return foo (x, y);
+}
Index: gcc/gcc/testsuite/gcc.target/arm/div64-unwinding.c
===================================================================
--- gcc.orig/gcc/testsuite/gcc.target/arm/div64-unwinding.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Performing a 64-bit division should not pull in the unwinder.  */
-
-/* { dg-do run { target { { ! *-*-linux* } && { ! *-*-uclinux* } } } } */
-/* { dg-skip-if "load causes weak symbol resolution" { vxworks_kernel } } */
-/* { dg-options "-O0" } */
-
-#include <stdlib.h>
-
-long long
-foo (long long c, long long d)
-{
-  return c/d;
-}
-
-long long x = 0;
-long long y = 1;
-
-extern int (*_Unwind_RaiseException) (void *) __attribute__((weak));
-
-int main(void)
-{
-  if (&_Unwind_RaiseException != NULL)
-    abort ();;
-  return foo (x, y);
-}
Index: gcc/libgcc/Makefile.in
===================================================================
--- gcc.orig/libgcc/Makefile.in
+++ gcc/libgcc/Makefile.in
@@ -533,7 +533,7 @@ endif
 ifeq ($(LIB2_DIVMOD_EXCEPTION_FLAGS),)
 # Provide default flags for compiling divmod functions, if they haven't been
 # set already by a target-specific Makefile fragment.
-LIB2_DIVMOD_EXCEPTION_FLAGS := -fexceptions -fnon-call-exceptions
+LIB2_DIVMOD_EXCEPTION_FLAGS := -fasynchronous-unwind-tables
 endif
 
 # Build LIB2_DIVMOD_FUNCS.

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

end of thread, other threads:[~2020-08-31 15:27 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-20 18:45 [PATCH v3] libgcc: Use `-fasynchronous-unwind-tables' for LIB2_DIVMOD_FUNCS Maciej W. Rozycki
2020-08-25  1:41 ` Kito Cheng
2020-08-25  9:29   ` Kito Cheng
2020-08-25 16:32     ` Maciej W. Rozycki
2020-08-26  3:42       ` Kito Cheng
2020-08-26 11:08       ` Richard Biener
2020-08-26 11:33         ` Jakub Jelinek
2020-08-28 15:40           ` Maciej W. Rozycki
2020-08-28 17:04             ` Jakub Jelinek
2020-08-31 15:26               ` Maciej W. Rozycki
2020-08-28 15:47         ` Ramana Radhakrishnan
2020-08-31  8:04           ` Richard Biener

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).