Hi,
The patch is for the broken exception handling in GDB on AIX platform.
When linked statically with libstdc++ and libgcc on AIX platform, GDB
is facing broken exception handling issues.
Following is the error output when GDB is linked statically with
mentioned libraries: (GDB-7.12.1, built with GCC-6.2, 64 bit mode, AIX
platform):
# ./gdb
GNU gdb (GDB) 7.12.1
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "powerpc64-ibm-aix7.2.0.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb) kill
terminate called after throwing an instance of 'gdb_exception_RETURN_MASK_ERROR'
IOT/Abort trap (core dumped)
The issue has been discussed here:
https://sourceware.org/ml/gdb/2017-02/msg00047.html
I have manually built and tested GDB-7.12.1 with this patch on AIX-7.2
and Ubuntu-16.04 with GCC-6.2 and GCC-4.8.5. On both operating system
GDB is working fine with the patch. I generated configure file using
autoconf-2.64.
The attached patch is for configure.ac file in binutils-gdb, in which
one more option "--disable-staticlib" is implemented to link libstdc++
and libgcc dynamically.
I believe this issue is specific to AIX platform.
Please find the attachment for patch file, and ChangeLog file.
Thanks and Regards,
Nitish K Mishra
2016-03-01 Nitish K Mishra <nitis...@in.ibm.com>
* configure.ac: Include one more option "--disable-staticlib"
to link libstdc++ and libgcc dynamically.
diff --git a/configure.ac b/configure.ac
index 3ec86c1..9bbb024 100644
--- a/configure.ac
+++ b/configure.ac
@@ -471,6 +471,13 @@ ENABLE_LIBSTDCXX=default)
noconfigdirs="$noconfigdirs target-libstdc++-v3"
fi]
+AC_ARG_ENABLE(staticlib,
+AS_HELP_STRING([--disable-staticlib],
+ [do not link libstdc++ and libgcc library statically]),
+have_static_lib=$enableval,
+have_static_lib=yes)
+
+
# If this is accelerator compiler and its target is intelmic we enable
# target liboffloadmic by default. If this is compiler with offloading
# for intelmic we enable host liboffloadmic by default. Otherwise
@@ -1406,9 +1413,10 @@ if test -z "$LD"; then
fi
fi
-# Check whether -static-libstdc++ -static-libgcc is supported.
-have_static_libs=no
-if test "$GCC" = yes; then
+# If enable_staticlib is set for configuration, check whether -static-libstdc++ -static-libgcc is supported
+
+if test "$have_static_lib" = yes; then
+ if test "$GCC" = yes; then
saved_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -static-libstdc++ -static-libgcc"
@@ -1424,6 +1432,7 @@ int main() {}],
AC_LANG_POP(C++)
LDFLAGS="$saved_LDFLAGS"
+ fi
fi
ACX_PROG_GNAT
@@ -1741,6 +1750,9 @@ AC_ARG_WITH(stage1-ldflags,
# trust that they are doing what they want.
if test "$stage1_libs" = "" -a "$have_static_libs" = yes; then
stage1_ldflags="-static-libstdc++ -static-libgcc"
+ else
+ # If static lib is disabled.
+ stage1_ldflags=""
fi])
AC_SUBST(stage1_ldflags)
@@ -1768,8 +1780,11 @@ AC_ARG_WITH(boot-ldflags,
# In stages 2 and 3, default to linking libstdc++ and libgcc
# statically. But if the user explicitly specified the libraries to
# use, trust that they are doing what they want.
- if test "$poststage1_libs" = ""; then
+ if test "$poststage1_libs" = "" -a "$have_static_lib" = yes; then
poststage1_ldflags="-static-libstdc++ -static-libgcc"
+ else
+ # If static lib is disabled.
+ poststage1_ldflags=""
fi])
AC_SUBST(poststage1_ldflags)