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++/115230] New: -fvisibility=hidden does not hide Template Specializations from being exported Date: Sun, 26 May 2024 07:38:24 +0000 [thread overview] Message-ID: <bug-115230-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115230 Bug ID: 115230 Summary: -fvisibility=hidden does not hide Template Specializations from being exported Product: gcc Version: 14.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: tanksherman27 at gmail dot com Target Milestone: --- Consider the following code: #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)
next reply other threads:[~2024-05-26 7:38 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-05-26 7:38 tanksherman27 at gmail dot com [this message] 2024-05-26 7:43 ` [Bug c++/115230] " pinskia at gcc dot gnu.org
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-115230-4@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).