public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "tanksherman27 at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/105645] Template specializations are not hidden with fvisibility=hidden Date: Fri, 23 Feb 2024 13:40:57 +0000 [thread overview] Message-ID: <bug-105645-4-IPvDuaN7OR@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-105645-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105645 Julian Waters <tanksherman27 at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tanksherman27 at gmail dot com --- Comment #3 from Julian Waters <tanksherman27 at gmail dot com> --- I can confirm this on gcc 11 and higher: #include <cstdlib> template<typename T> void method(T* src, T* dst, size_t length); template<> void method<short>(short* src, short* dst, size_t length) { } template<> void method<int>(int* src, int* dst, size_t length) { } Compiled using command line: g++ -O3 -fvisibility=hidden -std=c++14 -pedantic -Wpedantic -Wall -Werror templates.cpp Linked using: g++ -shared -o libtemplates.so templates.o When nm is run over it using nm -gDC libtemplates.so, the following symbols are seen: w _ITM_deregisterTMCloneTable w _ITM_registerTMCloneTable 0000000000001110 T void method<int>(int*, int*, unsigned long) 0000000000001100 T void method<short>(short*, short*, unsigned long) w __cxa_finalize w __gmon_start__ T void method<int>(int*, int*, unsigned long) and T void method<short>(short*, short*, unsigned long) should not be in the symbol table, but they are even with -fvisibility=hidden. Strangely, marking both methods with [[gnu::visibility("hidden")]] works and results in both not being exported. This was recently observed in the JDK, inside the Java HotSpot VM (see https://github.com/openjdk/jdk/pull/17955/files#r1498933843) Is this enough of a reproducer to get this confirmed?
next prev parent reply other threads:[~2024-02-23 13:41 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-05-18 14:02 [Bug c++/105645] New: " kndevl at outlook dot com 2022-05-18 14:25 ` [Bug c++/105645] " pinskia at gcc dot gnu.org 2022-05-19 6:10 ` kndevl at outlook dot com 2024-02-23 13:40 ` tanksherman27 at gmail dot com [this message] 2024-05-26 7:43 ` pinskia at gcc dot gnu.org 2024-05-26 7:48 ` tanksherman27 at gmail dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-105645-4-IPvDuaN7OR@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).