4

I'm currently working on adding Windows CE as a Target Operating system in LLVM/Clang. I've compiled LLVM/Clang on Windows and when I use it to compile code for my own native windows target or when I cross-compile to my new Windows CE target it produces ELF object files. The problem is that I need it to produce COFF object files. I couldn't find any way to configure Clang to emit COFF at runtime, so I've been adding debug to the code to try and figure out how I can get it to produce COFF by modifying the source code itself. I've been working on it for a while and figured I would ask if anyone could help me figure how I can get it to generate COFF.

When the TargetInfo class is constructed (lib/Basic/Targets.cpp) I see that Triple.getObjectFormat returns the enum value for COFF so I'm not sure why it's producing ELF. I figure the culprit will be in the lib/CodeGen project but I'm having a hard time figuring out where the final object file format is evaluated. Any help would be appreciated.

marler8997
  • 119
  • 10
  • Can't offer you specific help on that, but the obj file is the same used by Win32 so comparing what you have with a version that can create desktop Windows binaries may help. – Valter Minute Nov 17 '17 at 07:11
  • I realized that at some point after my changes it started producing COFF after all. There are still more problems, the COFF machine type is 0x01C4 but windows CE needs it to be 0x01C0. I believe I've found where that is set in the LLVM library. Hopefully after this I can link/execute these files on windows CE. – marler8997 Nov 17 '17 at 17:15
  • Sounds like good progress. Is that open source already? If you need support to test for ARM-based devices on different CE releases, I can probably help. – Valter Minute Nov 20 '17 at 08:22

0 Answers0