diff mbox

Real fix for AIX exception handling

Message ID 95a50354-a6bd-6c69-ef2b-1bcd91cd9a59@ssi-schaefer.com
State New
Headers show

Commit Message

Michael Haubenwallner March 27, 2017, 9:10 a.m. UTC
Hi,

as far as I have discovered, the real problem with AIX exception handling is
that the exception landing pads are symbols that must not (but still are)
exported from shared libraries - even libstdc++.

I'm wondering if attached libtool(!)-patch would fix even that GDB problem
once applied to each(!) shared library creation procedure.

However, each workaround still applies as long as there's a single shared
library involved that has not stopped exporting these symbols yet.

Thoughts?

Maybe gcc's collect2 should apply this additional symbol filter itself when
calling (AIX) ld, rather than leaving this to each build system?

Thanks!
/haubi/
diff mbox

Patch

From 32ca0e6f7bf8d096cc653ac455d66c270b75fdf0 Mon Sep 17 00:00:00 2001
From: Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
Date: Wed, 2 Mar 2016 15:06:48 +0100
Subject: [PATCH 1/4] AIX: Stop exporting more _GLOBAL__ symbols.

* m4/libtool.m4 (_LT_LINKER_SHLIBS): On AIX, GNU g++ generates
_GLOBAL__ symbols as, amongst others, landing pads for C++ exceptions.
These symbols must not be exported from shared libraries, or exception
handling may break for applications with runtime linking enabled.
---
 m4/libtool.m4 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/m4/libtool.m4 b/m4/libtool.m4
index ee292af..c2e996c 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -4943,6 +4943,7 @@  m4_if([$1], [CXX], [
     else
       _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols'
     fi
+    _LT_TAGVAR(exclude_expsyms, $1)='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*|_GLOBAL__[FID]_.*'
     ;;
   pw32*)
     _LT_TAGVAR(export_symbols_cmds, $1)=$ltdll_cmds
@@ -5398,6 +5399,7 @@  _LT_EOF
 	else
 	  _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols'
 	fi
+	_LT_TAGVAR(exclude_expsyms, $1)='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*|_GLOBAL__[FID]_.*'
 	aix_use_runtimelinking=no
 
 	# Test if we are trying to use run time linking or normal
-- 
2.10.2