[cfe-dev] Compile source files to ELF files under Windows

Gaier, Bjoern via cfe-dev cfe-dev at lists.llvm.org
Thu May 27 03:25:33 PDT 2021


Hey everyone,

I currently try to compile a few .cpp files under Windows with Clang-Cl, not targeting the COFF format, but instead I want to create ELF files. I do want to use the Microsoft headers and ABI, I just don't want to get COFF files in the end. So I tried the following target:
--target=x86_64-pc-windows-elf

>From my understanding, I thought this should be correct? Sadly however Clang-Cl failes with:
1>fatal error: error in backend: invalid llvm.linker.options
------------------------------------------------------------------------

Instead I compiled the source file to an IR file to figure out what "invalid llvm.linker.options" might be and got:
!llvm.linker.options = !{!0}
!llvm.dependent-libraries = !{!1, !2}
!llvm.module.flags = !{!3, !4, !5}
!llvm.ident = !{!6}

!0 = !{!"/FAILIFMISMATCH:\22_CRT_STDIO_ISO_WIDE_SPECIFIERS=0\22"}
!1 = !{!"msvcrt"}
!2 = !{!"oldnames"}
!3 = !{i32 1, !"wchar_size", i32 2}
!4 = !{i32 7, !"PIC Level", i32 2}
!5 = !{i32 7, !"uwtable", i32 1}
!6 = !{!"clang version 13.0.0 (https://github.com/llvm/llvm-project.git 5f500d73cd1aaff4c9ab2fd5c327c2d5ca9ae5c9)"}

I assume "/FAILIFMISMATCH" is not supported for ELF files?
Is there a workaround for this issue or is it simply not possible to do what I wanted to do?

Kind greetings
Björn


Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816, USt.ID-Nr. DE 114 165 789 Geschäftsführer: Dr. Hiroshi Nakamura, Dr. Robert Plank, Markus Bode, Takashi Nagano, Junichi Tajika, Ergin Cansiz.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20210527/677daa4c/attachment.html>


More information about the cfe-dev mailing list