public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] [PR build/21187] Static linking of libstdc++ and libgcc with GDB leads to broken exception handling on AIX platform
@ 2017-03-07 12:12 Nitish Kumar Mishra
  2017-03-14 11:03 ` Nitish Kumar Mishra
  0 siblings, 1 reply; 4+ messages in thread
From: Nitish Kumar Mishra @ 2017-03-07 12:12 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 3102 bytes --]

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

[-- Attachment #2: ChangeLog.txt --]
[-- Type: text/plain, Size: 174 bytes --]

2016-03-01  Nitish K Mishra  <nitismis@in.ibm.com>

        * configure.ac: Include one more option "--disable-staticlib"
        to link libstdc++ and libgcc dynamically.

[-- Attachment #3: disable_static_linking.patch --]
[-- Type: text/x-patch, Size: 3150 bytes --]

diff --git a/configure.ac b/configure.ac
index 3ec86c1..c400251 100644
--- a/configure.ac
+++ b/configure.ac
@@ -140,7 +140,7 @@ host_libs="intl libiberty opcodes bfd readline tcl tk itcl libgui zlib libbacktr
 # binutils, gas and ld appear in that order because it makes sense to run
 # "make check" in that particular order.
 # If --enable-gold is used, "gold" may replace "ld".
-host_tools="texinfo flex bison binutils gas ld fixincludes gcc cgen sid sim gdb gprof etc expect dejagnu m4 utils guile fastjar gnattools libcc1 gotools"
+host_tools="flex bison binutils gas ld fixincludes gcc cgen sid sim gdb gprof etc expect dejagnu m4 utils guile fastjar gnattools libcc1 gotools"
 
 # libgcj represents the runtime libraries only used by gcj.
 libgcj="target-libffi \
@@ -337,7 +337,7 @@ case "${ENABLE_GOLD}" in
       *-*-elf* | *-*-sysv4* | *-*-unixware* | *-*-eabi* | hppa*64*-*-hpux* \
       | *-*-linux* | *-*-gnu* | frv-*-uclinux* | *-*-irix5* | *-*-irix6* \
       | *-*-netbsd* | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* \
-      | *-*-solaris2* | *-*-nto* | *-*-nacl* | *-*-fuchsia*)
+      | *-*-solaris2* | *-*-nto* | *-*-nacl*)
         case "${target}" in
           *-*-linux*aout* | *-*-linux*oldld*)
             ;;
@@ -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, default is static linking]),
+ENABLE_STATICLIB=$enableval,
+ENABLE_STATICLIB=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.
+# If ENABLE_STATICLIB is set for configuration, check whether -static-libstdc++ -static-libgcc is supported
 have_static_libs=no
-if test "$GCC" = yes; then
+if test "$ENABLE_STATICLIB" = 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_libs" = yes; then
    poststage1_ldflags="-static-libstdc++ -static-libgcc"
+   else
+   # If static library linking is disabled.
+   poststage1_ldflags=""
  fi])
 AC_SUBST(poststage1_ldflags)
 

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

* Re: [PATCH] [PR build/21187] Static linking of libstdc++ and libgcc with GDB leads to broken exception handling on AIX platform
  2017-03-07 12:12 [PATCH] [PR build/21187] Static linking of libstdc++ and libgcc with GDB leads to broken exception handling on AIX platform Nitish Kumar Mishra
@ 2017-03-14 11:03 ` Nitish Kumar Mishra
  2017-03-20 19:55   ` Joel Brobecker
  0 siblings, 1 reply; 4+ messages in thread
From: Nitish Kumar Mishra @ 2017-03-14 11:03 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 3776 bytes --]

Hi,
This defect is marked for GDB-8.0 branching.
I have sent the patches earlier and got some review comments, changed
the patch accordingly and sent again, but didn't get any feedback.
I have uploaded the patch to the defect 21187 as well on bugzilla.
Defect: https://sourceware.org/bugzilla/show_bug.cgi?id=21187
Consider this mail as reminder and I am attaching the proposed patch once again.


Thanks and Regards,
Nitish K Mishra

On Tue, Mar 7, 2017 at 5:41 PM, Nitish Kumar Mishra
<mishra.nitish.88@gmail.com> wrote:
> 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

[-- Attachment #2: ChangeLog.txt --]
[-- Type: text/plain, Size: 174 bytes --]

2016-03-01  Nitish K Mishra  <nitismis@in.ibm.com>

        * configure.ac: Include one more option "--disable-staticlib"
        to link libstdc++ and libgcc dynamically.

[-- Attachment #3: disable_static_linking.patch --]
[-- Type: text/x-patch, Size: 2018 bytes --]

diff --git a/configure.ac b/configure.ac
index 3ec86c1..c400251 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, default is static linking]),
+ENABLE_STATICLIB=$enableval,
+ENABLE_STATICLIB=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.
+# If ENABLE_STATICLIB is set for configuration, check whether -static-libstdc++ -static-libgcc is supported
 have_static_libs=no
-if test "$GCC" = yes; then
+if test "$ENABLE_STATICLIB" = 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_libs" = yes; then
    poststage1_ldflags="-static-libstdc++ -static-libgcc"
+   else
+   # If static library linking is disabled.
+   poststage1_ldflags=""
  fi])
 AC_SUBST(poststage1_ldflags)
 

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

* Re: [PATCH] [PR build/21187] Static linking of libstdc++ and libgcc with GDB leads to broken exception handling on AIX platform
  2017-03-14 11:03 ` Nitish Kumar Mishra
@ 2017-03-20 19:55   ` Joel Brobecker
  2017-03-21 19:39     ` Nitish Kumar Mishra
  0 siblings, 1 reply; 4+ messages in thread
From: Joel Brobecker @ 2017-03-20 19:55 UTC (permalink / raw)
  To: Nitish Kumar Mishra; +Cc: gdb-patches

> This defect is marked for GDB-8.0 branching.
> I have sent the patches earlier and got some review comments, changed
> the patch accordingly and sent again, but didn't get any feedback.
> I have uploaded the patch to the defect 21187 as well on bugzilla.
> Defect: https://sourceware.org/bugzilla/show_bug.cgi?id=21187
> Consider this mail as reminder and I am attaching the proposed patch once again.

Where did you send the patches? I thought you'd have sent them to
gcc-patches, but I couldn't find it in the gcc-patches mailing-list
archives...

> 2016-03-01  Nitish K Mishra  <nitismis@in.ibm.com>
> 
>         * configure.ac: Include one more option "--disable-staticlib"
>         to link libstdc++ and libgcc dynamically.

Your ChangeLog will need to include the following piece of info:

        * configure: Regenerate.

Can you send us an update on the patch submission process?

Thank you,
-- 
Joel

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

* Re: [PATCH] [PR build/21187] Static linking of libstdc++ and libgcc with GDB leads to broken exception handling on AIX platform
  2017-03-20 19:55   ` Joel Brobecker
@ 2017-03-21 19:39     ` Nitish Kumar Mishra
  0 siblings, 0 replies; 4+ messages in thread
From: Nitish Kumar Mishra @ 2017-03-21 19:39 UTC (permalink / raw)
  To: Joel Brobecker, gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1555 bytes --]

Hi,
Yeah I did send the patch to the gcc-patches mailing list, link:
https://gcc.gnu.org/ml/gcc-patches/2017-03/msg00352.html
But I missed sending changeLog.
I hope the patch is fine now, updating the changeLog content as per
your instruction and attaching, please find.
I thought first I need approval from the community for the patch, and
then do I need to submit/commit it anywhere ? Can you please guide me
through
the submission process ?
Do I need to send this changeLog to gcc-patches as well ?

Thanks and Regards,
Nitish

On Tue, Mar 21, 2017 at 1:25 AM, Joel Brobecker <brobecker@adacore.com> wrote:
>> This defect is marked for GDB-8.0 branching.
>> I have sent the patches earlier and got some review comments, changed
>> the patch accordingly and sent again, but didn't get any feedback.
>> I have uploaded the patch to the defect 21187 as well on bugzilla.
>> Defect: https://sourceware.org/bugzilla/show_bug.cgi?id=21187
>> Consider this mail as reminder and I am attaching the proposed patch once again.
>
> Where did you send the patches? I thought you'd have sent them to
> gcc-patches, but I couldn't find it in the gcc-patches mailing-list
> archives...
>
>> 2016-03-01  Nitish K Mishra  <nitismis@in.ibm.com>
>>
>>         * configure.ac: Include one more option "--disable-staticlib"
>>         to link libstdc++ and libgcc dynamically.
>
> Your ChangeLog will need to include the following piece of info:
>
>         * configure: Regenerate.
>
> Can you send us an update on the patch submission process?
>
> Thank you,
> --
> Joel

[-- Attachment #2: ChangeLog.txt --]
[-- Type: text/plain, Size: 202 bytes --]

2016-03-01  Nitish K Mishra  <nitismis@in.ibm.com>

        * configure.ac: Include one more option "--disable-staticlib"
        to link libstdc++ and libgcc dynamically.
		* configure: Regenerate.

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

end of thread, other threads:[~2017-03-21 19:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-07 12:12 [PATCH] [PR build/21187] Static linking of libstdc++ and libgcc with GDB leads to broken exception handling on AIX platform Nitish Kumar Mishra
2017-03-14 11:03 ` Nitish Kumar Mishra
2017-03-20 19:55   ` Joel Brobecker
2017-03-21 19:39     ` Nitish Kumar Mishra

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