<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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++ release 3.6 fails to compile using -target i386-pc-windows-msvc-elf"
   href="https://llvm.org/bugs/show_bug.cgi?id=22963">22963</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang++ release 3.6 fails to compile using -target i386-pc-windows-msvc-elf
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.6
          </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>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>karl.schmidt@autodesk.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=14079" name="attach_14079" title="Example input file">attachment 14079</a> <a href="attachment.cgi?id=14079&action=edit" title="Example input file">[details]</a></span>
Example input file

When compiling using the i386-pc-windows-msvc-elf target, the compile fails
with a "backend data layout does not match expected target description" error.


  To Reproduce

bar.cpp (also attached):
-------------------------------------------------------------
int bar = 0;
-------------------------------------------------------------

clang++ -emit-llvm -target i386-pc-windows-msvc-elf -o bar.ll -c -S bar.cpp

error: backend data layout 'e-m:e-p:32:32-i64:64-f80:32-n8:16:32-S32' does not
       match expected target description
       'e-m:w-p:32:32-i64:64-f80:32-n8:16:32-S32'
1 error generated.


  Additional details

The two layouts differ only in the name mangling. It seems like the request for
ELF is not being passed to the LLVM target machine. I am guessing this is a bug
and it should in fact compile. If it is by design a clearer error message would
be appreciated.

The issue also occurs with clang and when omitting the -emit-llvm and -S flags.
clang and clang++ are 32 bit builds, created using MSVC 2012 and targeting X86
only.


Compiling works fine if not specifying ELF or for 64-bit. For instance,
compiling as

  clang++ -emit-llvm -target x86_64-pc-windows-msvc-elf -o bar.ll -c -S bar.cpp

Produces the expected output in bar.ll:
-------------------------------------------------------------
; ModuleID = 'bar.cpp'
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-msvc-elf"

@"\01?bar@@3HA" = global i32 0, align 4

!llvm.module.flags = !{!0}
!llvm.ident = !{!1}

!0 = !{i32 1, !"PIC Level", i32 2}
!1 = !{!"clang version 3.6.0 (tags/RELEASE_360/final)"}
-------------------------------------------------------------


  Background

We're using clang++ to compile part of our C++ codebase to bytecode, and then
later linking that with various llvm modules at runtime. llvm 3.6 has removed
the legacy JIT and so we're moving to the MCJIT engine, which requires us to
use ELF on windows.</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>