Fix writing COFF files when cross-compiling on OSX

Stanislav Karchebny berkus at madfire.net
Wed May 28 08:40:35 PDT 2014


The issue: Trying to build an EFI application with clang on OSX host.

Specifying -target i386-pe—coff resulted in abort from MCWinCOFFStreamer:

fatal error in backend: alignment is limited to 32-bytes

Turns out, that while the streamer was created for coff, the asm backend and asminfo were created for ELF output.
The attached patch fixes it by creating appropriate objects when COFF output is requested.

After applying the patch I was able to successfully build and run my EFI application using only clang/lld (no GNU or MSVC tools involved).

-------------- next part --------------
A non-text attachment was scrubbed...
Name: llvm-create-coff-if-requested.diff
Type: application/octet-stream
Size: 1891 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140528/a4504822/attachment.obj>


More information about the llvm-commits mailing list