Iain Sandoe
2018-12-03 00:37:07 UTC
Hi,
GCC does not export construction vtable symbols from shared libraries**.
The symbols are marked hidden in the objects; for Darwin that makes them also external (“private_extern” is Darwin’s hidden) which means that they show up in the list of possible symbols for export from libstdc++, and there are sufficiently relaxed match conditions that they reach the exports list. When Darwin’s static linker encounters them it generates a warning that they cannot be exported. This patch prunes them from the list of symbols to be considered, thus eliminating the warnings.
OK for trunk?
Iain
** This seems a design decision, rather than an ABI mandate - note that, on Darwin at least, these symbols *are* visible in libc++.
libstdc++-v3/
* scripts/make_exports.pl (check names): Don’t try to export construction
vtable symbols.
diff --git a/libstdc++-v3/scripts/make_exports.pl b/libstdc++-v3/scripts/make_exports.pl
index 7c9e4e31d4..93100e17dd 100644
--- a/libstdc++-v3/scripts/make_exports.pl
+++ b/libstdc++-v3/scripts/make_exports.pl
@@ -103,6 +103,14 @@ NAME: while (<NM>) {
# Ignore undefined and local symbols.
next if (/^([^ ]+) [Ua-z] /);
+ # GCC does not export construction vtables from shared libraries.
+ # However the symbols are marked hidden, for Darwin that makes them
+ # also external "private_extern", which means that they show up in
+ # this list. When ld64 encounters them it generates a warning that
+ # they cannot be exported, so trim them from the set now.
+ next if (/^construction vtable.*$/);
+ next if (/^__ZTC.*$/);
+
GCC does not export construction vtable symbols from shared libraries**.
The symbols are marked hidden in the objects; for Darwin that makes them also external (“private_extern” is Darwin’s hidden) which means that they show up in the list of possible symbols for export from libstdc++, and there are sufficiently relaxed match conditions that they reach the exports list. When Darwin’s static linker encounters them it generates a warning that they cannot be exported. This patch prunes them from the list of symbols to be considered, thus eliminating the warnings.
OK for trunk?
Iain
** This seems a design decision, rather than an ABI mandate - note that, on Darwin at least, these symbols *are* visible in libc++.
libstdc++-v3/
* scripts/make_exports.pl (check names): Don’t try to export construction
vtable symbols.
diff --git a/libstdc++-v3/scripts/make_exports.pl b/libstdc++-v3/scripts/make_exports.pl
index 7c9e4e31d4..93100e17dd 100644
--- a/libstdc++-v3/scripts/make_exports.pl
+++ b/libstdc++-v3/scripts/make_exports.pl
@@ -103,6 +103,14 @@ NAME: while (<NM>) {
# Ignore undefined and local symbols.
next if (/^([^ ]+) [Ua-z] /);
+ # GCC does not export construction vtables from shared libraries.
+ # However the symbols are marked hidden, for Darwin that makes them
+ # also external "private_extern", which means that they show up in
+ # this list. When ld64 encounters them it generates a warning that
+ # they cannot be exported, so trim them from the set now.
+ next if (/^construction vtable.*$/);
+ next if (/^__ZTC.*$/);
+