diff mbox series

[Darwin] Fix build warnings for libstdc++ [NFC]

Message ID 33F6DDD7-3914-4A04-9F43-0411A46A206E@sandoe.co.uk
State New
Headers show
Series [Darwin] Fix build warnings for libstdc++ [NFC] | expand

Commit Message

Iain Sandoe Dec. 3, 2018, 12:37 a.m. 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.

Comments

Jonathan Wakely Dec. 3, 2018, 2:25 p.m. UTC | #1
On 03/12/18 00:37 +0000, Iain Sandoe wrote:
>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?

Yes, OK.

>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.*$/);
>+
>
diff mbox series

Patch

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.*$/);
+