[llvm-bugs] [Bug 40568] New: Unable to run windows binary compiled with clang/lld/mingw

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Feb 1 14:15:26 PST 2019


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

            Bug ID: 40568
           Summary: Unable to run windows binary compiled with
                    clang/lld/mingw
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: re.mcclue at gmail.com
                CC: llvm-bugs at lists.llvm.org, peter.smith at linaro.org

I have downloaded and installed clang on windows 10 from
http://releases.llvm.org/download.html and mingw from
https://sourceforge.net/projects/mingw-w64/

I am trying to compile a very basic C program using clang/lld/mingw:

int main(int argc, char* argv[argc + 1])
{
  return 0;
}
To compile I invoke:

clang.exe -target x86_64-windows-gnu -fuse-ld=lld.exe -g -gcodeview 
 -Wl,/debug,/pdb:example.pdb example.c -o example.exe

This creates an exe which faults on startup in mainCRTStartup
(__security_init_cookie to be precise).

However, running with default ld from binutils is successful:
clang.exe -target x86_64-windows-gnu example.c -o example.exe

In total I tried:

x86_64-8.1.0-posix-seh-rt_v6-rev0
x86_64-7.3.0-posix-seh-rt_v5-rev0
x86_64-8.1.0-win32-seh-rt_v6-rev0
x86_64-8.1.0-win32-sjlj-rt_v6-rev0
without any luck producing a functional program.

So I am wondering, is there something obvious I am doing wrong here?

EDIT: I have also tried with msys2 to no avail. Specifically:

pacman -S mingw-w64-x86_64-clang mingw-w64-x86_64-lld

-- 
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/20190201/d6b36201/attachment.html>


More information about the llvm-bugs mailing list