diff mbox series

libbacktrace: configure check linker support for DWARF-5

Message ID AM0PR0202MB3442F043C475197CD3599BC9EA660@AM0PR0202MB3442.eurprd02.prod.outlook.com
State New
Headers show
Series libbacktrace: configure check linker support for DWARF-5 | expand

Commit Message

Li, Pan2 via Gcc-patches July 7, 2020, 1:59 p.m. UTC
Description:
  On AIX, the compiler is able to handle DWARF-5 but not the linker.

Changelog:
2020-07-07 Clement Chigot <clement.chigot@atos.net>
 * configure.ac: Extend check to the linker for DWARF-5 support
 * configure: Regenerate

Please apply for me if approved.
Could it be backported in gcc-10 branch too, please ?

Thanks, 
Clément

Comments

Ian Lance Taylor July 8, 2020, 3:46 a.m. UTC | #1
On Tue, Jul 7, 2020 at 6:59 AM CHIGOT, CLEMENT <clement.chigot@atos.net> wrote:
>
> Description:
>   On AIX, the compiler is able to handle DWARF-5 but not the linker.
>
> Changelog:
> 2020-07-07 Clement Chigot <clement.chigot@atos.net>
>  * configure.ac: Extend check to the linker for DWARF-5 support
>  * configure: Regenerate
>
> Please apply for me if approved.
> Could it be backported in gcc-10 branch too, please ?

Thanks.  Committed to trunk and GCC 10 branch.

Ian
diff mbox series

Patch

From 35f784cf22b9f5432c805782d12177189ec68dda Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cl=C3=A9ment=20Chigot?= <clement.chigot@atos.net>
Date: Wed, 10 Jun 2020 14:37:03 -0500
Subject: [PATCH] libbacktrace: configure check linker support for DWARF-5

On AIX, the compiler is able to handle DWARF-5 but not the linker.

Changelog:
2020-07-07 Clement Chigot <clement.chigot@atos.net>
 * configure.ac: Extend check to the linker for DWARF-5 support
 * configure: Regenerate
---
 libbacktrace/configure    | 7 ++++---
 libbacktrace/configure.ac | 4 ++--
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/libbacktrace/configure b/libbacktrace/configure
index b453bae5ae6..8149b7c6508 100755
--- a/libbacktrace/configure
+++ b/libbacktrace/configure
@@ -13577,14 +13577,15 @@  else
 CFLAGS="$CFLAGS -gdwarf-5"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-int i;
+int main(){return 0;}
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+if ac_fn_c_try_link "$LINENO"; then :
   libbacktrace_cv_lib_dwarf5=yes
 else
   libbacktrace_cv_lib_dwarf5=no
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 CFLAGS=$CFLAGS_hold
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libbacktrace_cv_lib_dwarf5" >&5
diff --git a/libbacktrace/configure.ac b/libbacktrace/configure.ac
index bd16f20fd0e..21feaf36294 100644
--- a/libbacktrace/configure.ac
+++ b/libbacktrace/configure.ac
@@ -465,12 +465,12 @@  AC_SUBST(PTHREAD_CFLAGS)
 
 AM_CONDITIONAL(HAVE_PTHREAD, test "$libgo_cv_lib_pthread" = yes)
 
-dnl Test whether the compiler supports the -gdwarf-5 option.
+dnl Test whether the compiler and the linker support the -gdwarf-5 option.
 AC_CACHE_CHECK([whether -gdwarf-5 is supported],
 [libbacktrace_cv_lib_dwarf5],
 [CFLAGS_hold=$CFLAGS
 CFLAGS="$CFLAGS -gdwarf-5"
-AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
+AC_LINK_IFELSE([AC_LANG_SOURCE([int main(){return 0;}])],
 [libbacktrace_cv_lib_dwarf5=yes],
 [libbacktrace_cv_lib_dwarf5=no])
 CFLAGS=$CFLAGS_hold])
-- 
2.25.0