<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - msvc2010 linker reports no symbol for COMDAT section with clang compiled object"
   href="https://bugs.llvm.org/show_bug.cgi?id=35149">35149</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>msvc2010 linker reports no symbol for COMDAT section with clang compiled object
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>LLVM Codegen
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>comicfans44@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I'm trying to use llvm-project-20170507 c252c437 (Oct 2) clang-cl to build our
codebase (emulate 2010 ,and link with msvc 2010 linker),two objects rejected by
msvc linker,report as :
fatal error LNK1143: invalid or corrupt file: no symbol for COMDAT section
0x87,

seems clang is generating code for code in C:\Program Files (x86)\Microsoft
Visual Studio 10.0\VC\atlmfc\include\statreg.h:


__declspec(selectany) const TCHAR* const CRegParser::rgszNeverDelete[] =
{
        _T("AppID"),
        _T("CLSID"),
        _T("Component Categories"),
        _T("FileType"),
        _T("Interface"),
        _T("Hardware"),
        _T("Mime"),
        _T("SAM"),
        _T("SECURITY"),
        _T("SYSTEM"),
        _T("Software"),
        _T("TypeLib")
};


while dumping with dumpbin /ALL with clang compiled obj, reported section as
following:

SECTION HEADER #86
    .bss name
       0 physical address
       0 virtual address
       8 size of raw data
       0 file pointer to raw data
       0 file pointer to relocation table
       0 file pointer to line numbers
       0 number of relocations
       0 number of line numbers
C0401080 flags
         Uninitialized Data
         COMDAT; sym= "struct ATL::IAtlAutoThreadModule *
ATL::_pAtlAutoThreadModule"
(?_pAtlAutoThreadModule@ATL@@3PEAUIAtlAutoThreadModule@1@EA)
         8 byte align
         Read Write

SECTION HEADER #87       ==============> reported by linker
   .data name
       0 physical address
       0 virtual address
      40 size of raw data
   158C8 file pointer to raw data (000158C8 to 00015907)
       0 file pointer to relocation table
       0 file pointer to line numbers
       0 number of relocations
       0 number of line numbers
C0601040 flags
         Initialized Data
         COMDAT (no symbol)
         32 byte align
         Read Write

RAW DATA #87
  00000000: 41 70 70 49 44 00 00 00 00 00 00 00 00 00 00 00  AppID...........
  00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  00000030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................

SECTION HEADER #88
   .data name
       0 physical address
       0 virtual address
      40 size of raw data
   15908 file pointer to raw data (00015908 to 00015947)
       0 file pointer to relocation table
       0 file pointer to line numbers
       0 number of relocations
       0 number of line numbers
C0601040 flags
         Initialized Data
         COMDAT (no symbol)
         32 byte align
         Read Write

RAW DATA #88
  00000000: 43 4C 53 49 44 00 00 00 00 00 00 00 00 00 00 00  CLSID...........
  00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  00000030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................

SECTION HEADER #89
   .data name
       0 physical address
       0 virtual address
      40 size of raw data
   15948 file pointer to raw data (00015948 to 00015987)
       0 file pointer to relocation table
       0 file pointer to line numbers
       0 number of relocations
       0 number of line numbers
C0601040 flags
         Initialized Data
         COMDAT (no symbol)
         32 byte align
         Read Write

RAW DATA #89
  00000000: 43 6F 6D 70 6F 6E 65 6E 74 20 43 61 74 65 67 6F  Component Catego
  00000010: 72 69 65 73 00 00 00 00 00 00 00 00 00 00 00 00  ries............
  00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  00000030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................

SECTION HEADER #8A
   .data name
       0 physical address
       0 virtual address
      40 size of raw data
   15988 file pointer to raw data (00015988 to 000159C7)
       0 file pointer to relocation table
       0 file pointer to line numbers
       0 number of relocations
       0 number of line numbers
C0601040 flags
         Initialized Data
         COMDAT (no symbol)
         32 byte align
         Read Write

RAW DATA #8A
  00000000: 46 69 6C 65 54 79 70 65 00 00 00 00 00 00 00 00  FileType........
  00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  00000030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................

SECTION HEADER #8B
   .data name
       0 physical address
       0 virtual address
      40 size of raw data
   159C8 file pointer to raw data (000159C8 to 00015A07)
       0 file pointer to relocation table
       0 file pointer to line numbers
       0 number of relocations
       0 number of line numbers
C0601040 flags
         Initialized Data
         COMDAT (no symbol)
         32 byte align
         Read Write

RAW DATA #8B
  00000000: 49 6E 74 65 72 66 61 63 65 00 00 00 00 00 00 00  Interface.......
  00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  00000030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................

SECTION HEADER #8C
   .data name
       0 physical address
       0 virtual address
      40 size of raw data
   15A08 file pointer to raw data (00015A08 to 00015A47)
       0 file pointer to relocation table
       0 file pointer to line numbers
       0 number of relocations
       0 number of line numbers
C0601040 flags
         Initialized Data
         COMDAT (no symbol)
         32 byte align
         Read Write

RAW DATA #8C
  00000000: 48 61 72 64 77 61 72 65 00 00 00 00 00 00 00 00  Hardware........
  00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  00000030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................

SECTION HEADER #8D
   .data name
       0 physical address
       0 virtual address
      40 size of raw data
   15A48 file pointer to raw data (00015A48 to 00015A87)
       0 file pointer to relocation table
       0 file pointer to line numbers
       0 number of relocations
       0 number of line numbers
C0601040 flags
         Initialized Data
         COMDAT (no symbol)
         32 byte align
         Read Write

RAW DATA #8D
  00000000: 4D 69 6D 65 00 00 00 00 00 00 00 00 00 00 00 00  Mime............
  00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  00000030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................

SECTION HEADER #8E
   .data name
       0 physical address
       0 virtual address
      40 size of raw data
   15A88 file pointer to raw data (00015A88 to 00015AC7)
       0 file pointer to relocation table
       0 file pointer to line numbers
       0 number of relocations
       0 number of line numbers
C0601040 flags
         Initialized Data
         COMDAT (no symbol)
         32 byte align
         Read Write

RAW DATA #8E
  00000000: 53 41 4D 00 00 00 00 00 00 00 00 00 00 00 00 00  SAM.............
  00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  00000030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................

SECTION HEADER #8F
   .data name
       0 physical address
       0 virtual address
      40 size of raw data
   15AC8 file pointer to raw data (00015AC8 to 00015B07)
       0 file pointer to relocation table
       0 file pointer to line numbers
       0 number of relocations
       0 number of line numbers
C0601040 flags
         Initialized Data
         COMDAT (no symbol)
         32 byte align
         Read Write

RAW DATA #8F
  00000000: 53 45 43 55 52 49 54 59 00 00 00 00 00 00 00 00  SECURITY........
  00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  00000030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................

SECTION HEADER #90
   .data name
       0 physical address
       0 virtual address
      40 size of raw data
   15B08 file pointer to raw data (00015B08 to 00015B47)
       0 file pointer to relocation table
       0 file pointer to line numbers
       0 number of relocations
       0 number of line numbers
C0601040 flags
         Initialized Data
         COMDAT (no symbol)
         32 byte align
         Read Write

RAW DATA #90
  00000000: 53 59 53 54 45 4D 00 00 00 00 00 00 00 00 00 00  SYSTEM..........
  00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  00000030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................

SECTION HEADER #91
   .data name
       0 physical address
       0 virtual address
      40 size of raw data
   15B48 file pointer to raw data (00015B48 to 00015B87)
       0 file pointer to relocation table
       0 file pointer to line numbers
       0 number of relocations
       0 number of line numbers
C0601040 flags
         Initialized Data
         COMDAT (no symbol)
         32 byte align
         Read Write

RAW DATA #91
  00000000: 53 6F 66 74 77 61 72 65 00 00 00 00 00 00 00 00  Software........
  00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  00000030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................

SECTION HEADER #92
   .data name
       0 physical address
       0 virtual address
      40 size of raw data
   15B88 file pointer to raw data (00015B88 to 00015BC7)
       0 file pointer to relocation table
       0 file pointer to line numbers
       0 number of relocations
       0 number of line numbers
C0601040 flags
         Initialized Data
         COMDAT (no symbol)
         32 byte align
         Read Write

RAW DATA #92
  00000000: 54 79 70 65 4C 69 62 00 00 00 00 00 00 00 00 00  TypeLib.........
  00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  00000030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................

SECTION HEADER #93
  .rdata name
       0 physical address
       0 virtual address
      60 size of raw data
   15BC8 file pointer to raw data (00015BC8 to 00015C27)
   15C28 file pointer to relocation table
       0 file pointer to line numbers
       C number of relocations
       0 number of line numbers
40501040 flags
         Initialized Data
         COMDAT; sym= "protected: static char const * const * const
ATL::CRegParser::rgszNeverDelete" (?rgszNeverDelete@CRegParser@ATL@@1QBQEBDB)
         16 byte align
         Read Only



another object failed to be linked have similar problem (no symbol for COMDAT
section, which is just the "AppID" section)

clang command used to compile the object is 
 /EHsc /Zc:forScope /Zc:wchar_t /fp:precise -Wno-everything /Zi /Zc:forScope
/Zc:wchar_t /fp:precise /Zi /MD /O2 /Ob2 -fsanitize=address /Oi  /GF-  /Gy 
/GS-  /Oy-  /GT  /Gd</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>