[PATCH] [PR build/21187] Static linking of libstdc++ and libgcc with GDB leads to broken exception handling on AIX platform

Nitish Kumar Mishra mishra.nitish.88@gmail.com
Tue Mar 7 12:12:00 GMT 2017


Hello,

This patch is for the defect 21187 (
https://sourceware.org/bugzilla/show_bug.cgi?id=21187 ). I am
attaching the patch to configure.ac file in which I have
provided a configure option "--disable-staticlib" to link libstdc++
and libgcc library to GCC dynamically.


==== Motivation for the change ====

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)


==== Testing ====

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.

Output on AIX-7.2:

# ./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
The program is not being run.



==== Context ====

The issue came in picture in November and have discussed here:
https://sourceware.org/ml/gdb/2017-02/msg00047.html
I have tested the issue on GDB-7.12.1 built with GCC-4.8.5, both 32
and 64 bit object mode on AIX platform. The 64 bit mode does NOT have
this issue, but 32 bit mode has broken exception handling.
The issue is same with GDB-7.12.1 built with GCC-6.2, 64 bit mode on
AIX platform. GCC is not able to handle the exceptions properly and
GDB is leading to core dump.
On Ubuntu-16.04, and other platforms, there is no such issue. I
believe this issue is specifically for AIX.

Please find the attachment for patch and ChangeLog.


Thanks and Regards,
Nitish K Mishra
-------------- next part --------------
2016-03-01  Nitish K Mishra  <nitismis@in.ibm.com>

        * configure.ac: Include one more option "--disable-staticlib"
        to link libstdc++ and libgcc dynamically.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: disable_static_linking.patch
Type: text/x-patch
Size: 3150 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20170307/c59511bf/attachment.bin>


More information about the Gdb-patches mailing list