[llvm-bugs] [Bug 38724] New: clang fails to make visible explicit template instantiation.

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Aug 27 10:32:50 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=38724

            Bug ID: 38724
           Summary: clang fails to make visible explicit template
                    instantiation.
           Product: clang
           Version: 6.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: jz.maddock at googlemail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

Created attachment 20779
  --> https://bugs.llvm.org/attachment.cgi?id=20779&action=edit
Preprocessed source to reproduce the issue.

We have a problem in Boost.Regex where compiling with clang++
-fvisibility=hidden results in certain explicit template instantiations not
being visible from the final shared library - while the same code with g++ is
just fine.  Further more the template instances are marked "W" in the object
file, yet somehow still end up being hidden in the final .so regardless of
whether g++ or clang++ is used as the linker.

I've tried pretty hard to boil this down to a simple test case - but miserably
failed as all the simple cases work as expected.  So the attached test case is
our code pre-processed with g++, and can then be compiled with either g++ or
clang.

To reproduce, build with:

clang++ -fvisibility=hidden -DBOOST_REGEX_DYN_LINK -shared -I../../.. -fPIC  -o
t.so instances-gcc-pp.cpp

Or

g++ -fvisibility=hidden -DBOOST_REGEX_DYN_LINK -shared -I../../.. -fPIC  -o
t.so instances-gcc-pp.cpp

Then:

nm -D t.so

And search for "maybe_assign" - the g++ compiled .so will have two such
records, while clang++ has none.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180827/1af8a9a2/attachment.html>


More information about the llvm-bugs mailing list