<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 - clang on linux produces .pdb for windows target, but windbg won't load it"
   href="https://bugs.llvm.org/show_bug.cgi?id=34303">34303</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang on linux produces .pdb for windows target, but windbg won't load it
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>5.0
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>normal
          </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>rennieallen@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Build a hello world executable like so:

$ clang -v -g -gcodeview -target x86_64-pc-windows-msvc18.0.0 -isystem
/home/rallen/clang/5.0/build/windows/include -isystem
/home/rallen/clang/5.0/build/windows/kits/10.0.10586/noarch/include -L
/home/rallen/clang/5.0/build/windows/amd64 -L
/home/rallen/clang/5.0/build/windows/kits/10.0.10586/win32-x86_64/lib
-fuse-ld=lld -o foo.exe foo.c

Result:

foo.exe and foo.pdb produced.

Run llvm-pdbutil on foo.pdb:

$ llvm-pdbutil dump -summary foo.pdb


                          Summary
============================================================
  Block Size: 4096
  Number of blocks: 1016
  Number of streams: 204
  Signature: 1503524810
  Age: 1
  GUID: {6149EB78-991F-EFD5-2DBE-E79C367E29D5}
  Features: 0x1
  Has Debug Info: true
  Has Types: true
  Has IDs: true
  Has Globals: false
  Has Publics: true
  Is incrementally linked: false
  Has conflicting types: false
  Is stripped: false

So far, nothing looks amiss. 

Copy foo.exe+foo.pdb to a windows volume (/mnt/c/temp) then use WinDbg to load
foo.exe.

CommandLine: C:\temp\foo.exe
Starting directory: c:\temp
DBGHELP: Symbol Search Path:
cache*c:\temp;srv*<a href="https://msdl.microsoft.com/download/symbols">https://msdl.microsoft.com/download/symbols</a>

************* Symbol Path validation summary **************
Response                         Time (ms)     Location
Deferred                                       cache*c:\temp
Deferred                                      
srv*<a href="https://msdl.microsoft.com/download/symbols">https://msdl.microsoft.com/download/symbols</a>
DBGHELP: Symbol Search Path:
cache*c:\temp;srv*<a href="https://msdl.microsoft.com/download/symbols">https://msdl.microsoft.com/download/symbols</a>
DBGHELP: Symbol Search Path:
cache*c:\temp;srv*<a href="https://msdl.microsoft.com/download/symbols">https://msdl.microsoft.com/download/symbols</a>
Symbol search path is:
cache*c:\temp;srv*<a href="https://msdl.microsoft.com/download/symbols">https://msdl.microsoft.com/download/symbols</a>
Executable search path is: 
ModLoad: 00007ff7`35240000 00007ff7`35264400   foo.exe 
ModLoad: 00007ff8`09680000 00007ff8`0985b000   ntdll.dll
ModLoad: 00007ff8`078c0000 00007ff8`0796e000   C:\WINDOWS\System32\KERNEL32.DLL
ModLoad: 00007ff8`06090000 00007ff8`062d9000  
C:\WINDOWS\System32\KERNELBASE.dll
ModLoad: 00007ff8`06c60000 00007ff8`06d01000   C:\WINDOWS\System32\ADVAPI32.dll
ModLoad: 00007ff8`06bc0000 00007ff8`06c5d000   C:\WINDOWS\System32\msvcrt.dll
ModLoad: 00007ff8`07fd0000 00007ff8`08029000   C:\WINDOWS\System32\sechost.dll
ModLoad: 00007ff8`07b70000 00007ff8`07c95000   C:\WINDOWS\System32\RPCRT4.dll
ModLoad: 00007ff8`05580000 00007ff8`0558b000  
C:\WINDOWS\SYSTEM32\CRYPTBASE.DLL
ModLoad: 00007ff8`06b50000 00007ff8`06bba000  
C:\WINDOWS\System32\bcryptPrimitives.dll

Check the sympath:

0:000> .sympath
Symbol search path is:
cache*c:\temp;srv*<a href="https://msdl.microsoft.com/download/symbols">https://msdl.microsoft.com/download/symbols</a>
Expanded Symbol search path is:
cache*c:\temp;srv*<a href="https://msdl.microsoft.com/download/symbols">https://msdl.microsoft.com/download/symbols</a>

************* Symbol Path validation summary **************
Response                         Time (ms)     Location
Deferred                                       cache*c:\temp
Deferred                                      
srv*<a href="https://msdl.microsoft.com/download/symbols">https://msdl.microsoft.com/download/symbols</a>

Module list:

:000> lm
start             end                 module name
00007ff7`35240000 00007ff7`35264400   foo      T (no symbols)           
00007ff8`05580000 00007ff8`0558b000   CRYPTBASE   (deferred)             
00007ff8`06090000 00007ff8`062d9000   KERNELBASE   (deferred)             
00007ff8`06b50000 00007ff8`06bba000   bcryptPrimitives   (deferred)             
00007ff8`06bc0000 00007ff8`06c5d000   msvcrt     (deferred)             
00007ff8`06c60000 00007ff8`06d01000   ADVAPI32   (deferred)             
00007ff8`078c0000 00007ff8`0796e000   KERNEL32   (deferred)             
00007ff8`07b70000 00007ff8`07c95000   RPCRT4     (deferred)             
00007ff8`07fd0000 00007ff8`08029000   sechost    (deferred)             
00007ff8`09680000 00007ff8`0985b000   ntdll      (pdb symbols)         
c:\temp\ntdll.pdb\41D57AE3B178CDF490C0B78265127E9B1\ntdll.pdb

Now attempt to load symbols for foo:

0:000> ld foo
DBGHELP: unrecognized OMF sig: 5a4d MZ*** WARNING: Unable to verify timestamp
for foo.exe
*** ERROR: Module load completed but symbols could not be loaded for foo.exe
DBGHELP: foo - no symbols loaded
Symbols loaded for foo

The issue appears to be the unrecognized OMF sig.</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>