Hi guys, I have a question about the LLVM ARM backend: I try to build *.c files for Windows Phone (Windows 8) - so, basically I need to generate an "arm-pe" file (I *think* it has the same file structure like x86-pe file, but i am not sure). unfortunately, LLVM has no support with ARM PE\COFF. Any ideas? How difficult is to add the support in this file format? (LLC can generate ARM assembly, and PE\COFF files...) is there any fundamental difference between those file types (ARM-PE \ x86-PE) ? Thanks, Nir ________________________________ This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster at nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary. An NDS Group Limited company. www.nds.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130513/050d9811/attachment.html>
Moshe, Nir wrote: [...]> I have a question about the LLVM ARM backend: > > I try to build *.c files for Windows Phone (Windows 8) - so, basically > I need to generate an "arm-pe" file (I *think* it has the same file > structure like x86-pe file, but i am not sure). > unfortunately, LLVM has no support with ARM PE\COFF.We recently ran into this. Unfortunately there's no binutils support for ARM PE/COFF (at least the last time I looked). It doesn't seem to be very hard to add; from what I found out, the only real difference is a difference to the CPU type field. But binutils is sufficiently painful to wrangle that I couldn't do it in a few hours, so we went for other tools. With binutils support adding ARM PE/COFF should be fairly easy, depending on how much the ABI has changed from ARM EABI. -- ┌─── dg@cowlark.com ───── http://www.cowlark.com ───── │ │ 𝕻𝖍'𝖓𝖌𝖑𝖚𝖎 𝖒𝖌𝖑𝖜'𝖓𝖆𝖋𝖍 𝕮𝖙𝖍𝖚𝖑𝖍𝖚 𝕽'𝖑𝖞𝖊𝖍 𝖜𝖌𝖆𝖍'𝖓𝖆𝖌𝖑 𝖋𝖍𝖙𝖆𝖌𝖓. │ -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 263 bytes Desc: OpenPGP digital signature URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130513/dcac9302/attachment.sig>
> It doesn't seem to be very hard to add; from what I found out, the only > real difference is a difference to the CPU type field. But binutils is > sufficiently painful to wrangle that I couldn't do it in a few hours, so > we went for other tools.The relocations are probably almost all different too. I couldn't find any specification (they're probably undocumented) you can get an idea of the work required from the ELF equivalent: http://infocenter.arm.com/help/topic/com.arm.doc.ihi0044e/IHI0044E_aaelf.pdf LLVM itself doesn't have to support all of the relocations defined (just a sufficiently powerful subset to describe any program) but binutils (specifically ld and to a lesser extent gas) theoretically needs to handle each and every one. You might be able to get away with less, but it's dodgy from a neatness point of view: a compiler could claim implementation-decision; a linker would be clearly ABI non-compliant. Nothing impossible, of course, but more than a quick evening's job even for someone who knew the code inside-out. Cheers. Tim.
I don't remember the exact version it happened, but right after the Windows RT / Windows Phone 8 stuff was announced and it became known that native apps were possible, I seem to remember GCC removing support for ARM/PE. I don't know if this was related to binutils removing it or if it was strictly gcc related, but you may have better luck hacking it into a pre-2012 version. -Gordon -----Original Message----- From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of David Given Sent: Monday, May 13, 2013 11:53 AM To: llvmdev at cs.uiuc.edu Subject: Re: [LLVMdev] Generate PE\COFF file with ARM instructions Moshe, Nir wrote: [...]> I have a question about the LLVM ARM backend: > > I try to build *.c files for Windows Phone (Windows 8) - so, basically > I need to generate an "arm-pe" file (I *think* it has the same file > structure like x86-pe file, but i am not sure). > unfortunately, LLVM has no support with ARM PE\COFF.We recently ran into this. Unfortunately there's no binutils support for ARM PE/COFF (at least the last time I looked). It doesn't seem to be very hard to add; from what I found out, the only real difference is a difference to the CPU type field. But binutils is sufficiently painful to wrangle that I couldn't do it in a few hours, so we went for other tools. With binutils support adding ARM PE/COFF should be fairly easy, depending on how much the ABI has changed from ARM EABI. -- ┌─── dg@cowlark.com ───── http://www.cowlark.com ───── │ │ 𝕻𝖍'𝖓𝖌𝖑𝖚𝖎 𝖒𝖌𝖑𝖜'𝖓𝖆𝖋𝖍 𝕮𝖙𝖍𝖚𝖑𝖍𝖚 𝕽'𝖑𝖞𝖊𝖍 𝖜𝖌𝖆𝖍'𝖓𝖆𝖌𝖑 𝖋𝖍𝖙𝖆𝖌𝖓. │
Hi, On Mon, May 13, 2013 at 5:37 PM, Moshe, Nir <NMoshe at nds.com> wrote:> Hi guys, > > I have a question about the LLVM ARM backend: > > I try to build *.c files for Windows Phone (Windows 8) - so, basically I > need to generate an "arm-pe" file (I *think* it has the same file structure > like x86-pe file, but i am not sure). > unfortunately, LLVM has no support with ARM PE\COFF. > > Any ideas? > How difficult is to add the support in this file format? (LLC can generate > ARM assembly, and PE\COFF files...) is there any fundamental difference > between those file types (ARM-PE \ x86-PE) ? > > Thanks, > Nir > > >At one point cegcc (http://cegcc.sourceforge.net) project has managed to do this for WinCE which was PE/ARM. You should check the latest sources to see if it helps. ismail -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130513/4eb43c64/attachment.html>