[LLVMbugs] [Bug 18730] New: clang produces different typeinfo than MinGW 4.8.2

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Feb 4 14:22:13 PST 2014


http://llvm.org/bugs/show_bug.cgi?id=18730

            Bug ID: 18730
           Summary: clang produces different typeinfo than MinGW 4.8.2
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: yaron.keren at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 12008
  --> http://llvm.org/bugs/attachment.cgi?id=12008&action=edit
batch file to compile

I have a problem when linking C++ DLLs compiled with MinGW 4.8.2 with
clang-produced object file. The linker complains about multiple definitions for
several typeinfos. The scenario is rather complex but I had reduced the issue
to differences between the typeinfos emitted for a simple testcase.

The same include files and libraries were used, MinGW 4.8.2 MinGW-w64 rev2 with
trivial compilation flags. Attached is a simple batch file to reproduce the
issue. Clang is svn few days old, gcc is MinGW-w64 rev2, the latest.

The source code is:

 #include <stdexcept>
 int main() { throw std::exception(); return 0; }

When compiling with clang, nm --demangle e_clang.o =
00000000 d .eh_frame
00000000 t .text
00000000 t .text
00000001 a @feat.00
         U __cxa_allocate_exception
         U __cxa_throw
         U __main
00000000 T std::exception::exception()
         U std::exception::~exception()
         U typeinfo for std::exception
         U vtable for std::exception
00000000 T main

but with gcc, nm --demangle e_gcc.o
00000000 b .bss
00000000 d .data
00000000 r .eh_frame
00000000 r .eh_frame$_ZNSt9exceptionC1Ev
00000000 r .rdata$_ZTISt9exception
00000000 r .rdata$_ZTSSt9exception
00000000 r .rdata$zzz
00000000 t .text
00000000 t .text$_ZNSt9exceptionC1Ev
         U __cxa_allocate_exception
         U __cxa_throw
         U __main
00000000 T std::exception::exception()
         U std::exception::~exception()
00000000 R typeinfo for std::exception
00000000 R typeinfo name for std::exception
         U vtable for __cxxabiv1::__class_type_info
         U vtable for std::exception
00000000 T main

there are couple of differences:

* clang producing U typeinfo for std::exception whereas gcc produces R typeinfo
for std::exception. 
* The R typeinfo name for std::exception is not produced by clang.
* r .rdata$ records are also not produced by clang.

One or more of these differences causes typeinfos merging failure while linking
the above object files with C++ DLLs compiled with MinGW.
I suspect the first difference is the critical one.
In any case, clang output of typeinfos should match gcc.

-- 
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/20140204/99d71daa/attachment.html>


More information about the llvm-bugs mailing list