[llvm-bugs] [Bug 35149] New: msvc2010 linker reports no symbol for COMDAT section with clang compiled object

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Oct 31 07:56:07 PDT 2017


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

            Bug ID: 35149
           Summary: msvc2010 linker reports no symbol for COMDAT section
                    with clang compiled object
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: comicfans44 at gmail.com
                CC: llvm-bugs at lists.llvm.org

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 at ATL@@3PEAUIAtlAutoThreadModule at 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 at 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

-- 
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/20171031/abd6c1bf/attachment.html>


More information about the llvm-bugs mailing list