ELT-patches/aixrtl: fix exclude_expsyms for C++ exceptions
authorMichael Haubenwallner <haubi@gentoo.org>
Mon, 13 Mar 2017 16:54:29 +0000 (17:54 +0100)
committerMichael Haubenwallner <haubi@gentoo.org>
Mon, 13 Mar 2017 17:11:05 +0000 (18:11 +0100)
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.

eclass/ELT-patches/aixrtl/1.5.0-expsym-c
eclass/ELT-patches/aixrtl/1.5.0-expsym-cxx
eclass/ELT-patches/aixrtl/2.2.0-expsym-c
eclass/ELT-patches/aixrtl/2.2.0-expsym-cxx
eclass/ELT-patches/aixrtl/2.4.0-expsym-c
eclass/ELT-patches/aixrtl/2.4.0-expsym-cxx
eclass/ELT-patches/aixrtl/2.4.4-expsym-c [new file with mode: 0644]
eclass/ELT-patches/aixrtl/2.4.4-expsym-cxx [new file with mode: 0644]

index 2b54887d8fcd496c054b10ed79ae3ffec21612dd..13419b205da1d7f02d1e97331e0ce07dd29f3ace 100644 (file)
@@ -1,14 +1,16 @@
 --- configure
 +++ configure
-@@ -7113,9 +7113,9 @@
+@@ -7113,9 +7113,11 @@
        # If we're using GNU nm, then we don't want the "-C" option.
        # -C means demangle to AIX nm, but means don't demangle with GNU nm
        if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
 -        export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
 +        export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols'
++        exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__.*'
        else
 -        export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
 +        export_symbols_cmds='`echo $NM | sed -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 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'
++        exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__.*'
        fi
        aix_use_runtimelinking=no
  
index 9b6bdc2f95264e71d2bb727f73e54bb8d3a78344..561bc54d76c984bb9ca320be65c8996f7bf45e5f 100644 (file)
@@ -1,14 +1,16 @@
 --- configure
 +++ configure
-@@ -11217,9 +11217,9 @@
+@@ -11217,9 +11217,11 @@
      # If we're using GNU nm, then we don't want the "-C" option.
      # -C means demangle to AIX nm, but means don't demangle with GNU nm
      if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
 -      export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
 +      export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols'
++      exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__.*'
      else
 -      export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
 +      export_symbols_cmds_CXX='`echo $NM | sed -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 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'
++      exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__.*'
      fi
      ;;
    pw32*)
index 196a5a36e60c9401bd479b6f20b4cc30156d55ac..c74cee20c128e21f566bd1b5f7ba532ffd7d015f 100644 (file)
@@ -1,14 +1,16 @@
 --- configure
 +++ configure
-@@ -8475,9 +8475,9 @@
+@@ -8475,9 +8475,11 @@
        # If we're using GNU nm, then we don't want the "-C" option.
        # -C means demangle to AIX nm, but means don't demangle with GNU nm
        if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
 -        export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
 +        export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols'
++        exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__.*'
        else
 -        export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
 +        export_symbols_cmds='`echo $NM | sed -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 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'
++        exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__.*'
        fi
        aix_use_runtimelinking=no
  
index ee4d163989dd75aa4cae883489d4eafdaea8c654..1b7e9b8ee0a2ca9ed5461713442857e6acfe945f 100644 (file)
@@ -1,14 +1,16 @@
 --- configure
 +++ configure
-@@ -15506,9 +15506,9 @@
+@@ -15506,9 +15506,11 @@
      # If we're using GNU nm, then we don't want the "-C" option.
      # -C means demangle to AIX nm, but means don't demangle with GNU nm
      if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
 -      export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
 +      export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols'
++      exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__.*'
      else
 -      export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
 +      export_symbols_cmds_CXX='`echo $NM | sed -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 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'
++      exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__.*'
      fi
      ;;
    pw32*)
index 6860317739a70689e6980e0de70412d291484b7d..1538a6225dc751d3d7bc5a167fe2e3675995048d 100644 (file)
@@ -1,14 +1,16 @@
 --- configure
 +++ configure
-@@ -9660,9 +9660,9 @@
+@@ -9660,9 +9660,11 @@
        # Also, AIX nm treats weak defined symbols like other global
        # defined symbols, whereas GNU nm marks them as "W".
        if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
 -        export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
 +        export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols'
++        exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__.*'
        else
 -        export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
 +        export_symbols_cmds='`echo $NM | sed -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 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'
++        exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__.*'
        fi
        aix_use_runtimelinking=no
  
index ca9fd97be522f73e52333b063909ba7c299c1bdf..1fba0b9405e7e3a1670044886822ef691015c9ae 100644 (file)
@@ -1,14 +1,16 @@
 --- configure
 +++ configure
-@@ -15711,9 +15711,9 @@
+@@ -15711,9 +15711,11 @@
      # Also, AIX nm treats weak defined symbols like other global defined
      # symbols, whereas GNU nm marks them as "W".
      if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
 -      export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
 +      export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols'
++      exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__.*'
      else
 -      export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
 +      export_symbols_cmds_CXX='`echo $NM | sed -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 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'
++      exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__.*'
      fi
      ;;
    pw32*)
diff --git a/eclass/ELT-patches/aixrtl/2.4.4-expsym-c b/eclass/ELT-patches/aixrtl/2.4.4-expsym-c
new file mode 100644 (file)
index 0000000..f79c0f6
--- /dev/null
@@ -0,0 +1,21 @@
+commit 2dfd834840a9de8ce3866af1cf8f3aff9b1a15e8
+Author: Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
+Date:   Wed Mar 2 15:06:48 2016 +0100
+
+    AIX: Stop exporting any _GLOBAL__ symbol.
+    
+    * 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.
+
+--- configure
++++ configure
+@@ -5446,6 +5447,7 @@ _LT_EOF
+       # symbols only, and the '-p' flag disables sorting to improve
+       # performance.  For the weak symbol handling see the CXX tag.
+       export_symbols_cmds='$NM -gp $libobjs $convenience | $global_symbol_pipe | $EGREP -v " ($exclude_expsyms)$" | awk '\''{ kw = "" } /^([[CVWZ]]|[[BDLT]]\*) / { kw = " weak" } { print $ 3 kw }'\'' | sort -u > $export_symbols'
++      exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__.*'
+       aix_use_runtimelinking=no
+       # Test if we are trying to use run time linking or normal
diff --git a/eclass/ELT-patches/aixrtl/2.4.4-expsym-cxx b/eclass/ELT-patches/aixrtl/2.4.4-expsym-cxx
new file mode 100644 (file)
index 0000000..abb41e6
--- /dev/null
@@ -0,0 +1,21 @@
+commit 2dfd834840a9de8ce3866af1cf8f3aff9b1a15e8
+Author: Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
+Date:   Wed Mar 2 15:06:48 2016 +0100
+
+    AIX: Stop exporting any _GLOBAL__ symbol.
+    
+    * 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.
+
+--- configure
++++ configure
+@@ -5000,6 +5000,7 @@ m4_if([$1], [CXX], [
+     # '[[BDLT]]*' with AIX nm in default mode (POSIX like)
+     # '[[CVW]]'   with GNU nm in either BSD or POSIX mode
+     export_symbols_cmds_CXX='$NM -gp $libobjs $convenience | $global_symbol_pipe | $EGREP -v " ($exclude_expsyms)$" | awk '\''{ kw = "" } /^([[CVWZ]]|[[BDLT]]\*) / { kw = " weak" } { print $ 3 kw }'\'' | sort -u > $export_symbols'
++    exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__.*'
+     ;;
+   pw32*)
+     export_symbols_cmds_CXX=$ltdll_cmds