[llvm-bugs] [Bug 26936] New: [ms][dll] clang generates a COFF symbol table that differs from msvc with __declspec(dllimport)

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Mar 14 03:37:47 PDT 2016


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

            Bug ID: 26936
           Summary: [ms][dll] clang generates a COFF symbol table that
                    differs from msvc with __declspec(dllimport)
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: andrey.kuleshov at intel.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

!- Clang is not adding template functions with __declspec(dllimport) to the
COFF symbol table, this behavior differs from a behavior of msvc -!

=========Environment=============
OS: Win 
Lang: c++
Version: trunk

=========Reproducer==============
test.cpp
-----------
template<class _E>
struct basic_string {
        void func(int npos);
        static const int npos;
};

template<class _E> const int
                basic_string<_E>::npos = -1;

typedef basic_string<char> string;
string s;

int main()
{
s.func(basic_string<char>::npos);
return 0;
}

template <class T>
basic_string<T> foo() { return s; }

template class  __declspec(dllimport) basic_string<char> foo();
-----------
$ cl -c test.cpp /Fomstest.obj
$ clang-cl -c test.cpp /Foclangtest.obj

===========Output================
>>> MSVC (vs2015):
$ dumpbin /symbols mstest.obj | grep -i dllimport | cut -f2 -d"|"
 __imp_?func@?$basic_string at D@@QEAAXH at Z (__declspec(dllimport) public: void
__cdecl basic_string<char>::func(int))

>>> clang:
$  dumpbin /symbols clangtest.obj | grep -i dllimport | cut -f2 -d"|"
<empty output>


Andrey Kuleshov
======
Software Engineer
Intel Compiler Team

-- 
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/20160314/acae26ac/attachment-0001.html>


More information about the llvm-bugs mailing list