[LLVMdev] Comment "FIXME" in X86MachObjectWriter::RecordX86Relocation

Jim Grosbach grosbach at apple.com
Mon Jul 2 08:40:39 PDT 2012


Hi Verena,

It all depends on the details of what you want to do, of course. No-one has tried, that I know of, to use MachO on Windows before, so there are going to be pitfalls. For example, the way Darwin handles PIC code, indirect symbol resolution, etc, are all assumed by the MachO code. You may well be able to deal with that with fancy handling in a Windows-specific RuntimeDyld or something similar. It's not that there will be insurmountable issues, but rather that there is likely to be some significant work required.

ELF, as I understand it, has more users on Windows already so a lot of those sorts of issues are better understood already.

Regards,
  Jim

On Jul 2, 2012, at 1:57 AM, Verena Beckham <verena at codeplay.com> wrote:

> Hi Jim, Andrew,
> 
> Thanks, I read the discussions about using ELF + MCJIT + Windows and was hoping MachO would work just as well. Since you don't need to modify LLVM to be able to output MachO this was my first choice.
> But are you saying MachO will not work as well as ELF?
> 
> Thanks for the patch Andrew, that will have to be my plan B in this case.
> 
> Verena
> 
> 
> On 29/06/2012 23:47, Kaylor, Andrew wrote:
>> Can I assume we're talking about MCJIT since a file format and relocations are involved?
>> 
>> Some changes are required in order to get MCJIT to generate ELF object files.  Eli Bendersky submitted a patch some time ago to modify the target triple code to enable this, but after a bit of discussion there didn't seem to be a consensus for accepting this proposal.
>> 
>> If you want to try it out, the patch can be found here:
>> 
>> http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20120130/136053.html
>> 
>> I believe you can also find the related discussions from that post.  We've had success using this patch to generate ELF on Windows.  I don't know if any progress has been made toward a more generally acceptable solution.
>> 
>> -Andy
>> 
>> 
>> -----Original Message-----
>> From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Jim Grosbach
>> Sent: Friday, June 29, 2012 9:54 AM
>> To: Verena Beckham
>> Cc: llvmdev at cs.uiuc.edu
>> Subject: Re: [LLVMdev] Comment "FIXME" in X86MachObjectWriter::RecordX86Relocation
>> 
>> Hi Verena,
>> 
>> Windows + MachO is likely to run into lots of problems once you start passing in non-trivial code. The relocation model is very tied to Darwin.
>> 
>> I believe some folks doing JIT on Windows have had some success w/ ELF. Hopefully someone more familiar with the specifics of that will chime in.
>> 
>> -Jim
>> 
>> On Jun 29, 2012, at 8:58 AM, Verena Beckham<verena at codeplay.com>  wrote:
>> 
>>> Hi,
>>> 
>>> In X86MachObjectWriter::RecordX86Relocation I found the comment
>>> 
>>> 
>>>   if (Target.isAbsolute()) { // constant
>>>     // SymbolNum of 0 indicates the absolute section.
>>>     //
>>>     // FIXME: Currently, these are never generated (see code below). I
>>> cannot
>>>     // find a case where they are actually emitted.
>>>     Type = macho::RIT_Vanilla;
>>>   }
>>> 
>>> Is the FIXME still true? I've got some code that hits this, and it
>>> seems any code doing a function call to an absolute address (as
>>> described in this bug for ELF:
>>> http://llvm.org/bugs/show_bug.cgi?id=8656) would hit this. (Although I
>>> haven't tried it)
>>> 
>>> I'm using Windows 32bit x86 Mach-O, with MCJIT.
>>> 
>>> Trying to find a bug within my program and wondered whether the code
>>> is just not supported by LLVM. Let me know if you need a testcase.
>>> 
>>> Thanks!
>>> 
>>> 
>>> --
>>> Verena Beckham
>>> 
>>> Vice President Engineering
>>> 
>>> Codeplay Software Ltd
>>> 45 York Place, Edinburgh, EH1 3HP
>>> Tel: 0131 466 0503
>>> Fax: 0131 557 6600
>>> Website: http://www.codeplay.com
>>> 
>>> This email and any attachments may contain confidential and /or
>>> privileged information and  is for use  by the addressee only. If you
>>> are not the intended recipient, please notify Codeplay Software Ltd
>>> immediately and delete the message from your computer. You may not
>>> copy or forward it,or use or disclose its contents to any other
>>> person. Any views or other information in this message which do not
>>> relate to our business are not authorized by Codeplay software Ltd,
>>> nor does this message form part of any contract unless so stated.
>>> As internet communications are capable of data corruption Codeplay
>>> Software Ltd does not accept any responsibility for any changes made
>>> to this message after it was sent. Please note that Codeplay Software
>>> Ltd does not accept any liability or responsibility for viruses and it
>>> is your responsibility to scan any attachments.
>>> Company registered in England and Wales, number: 04567874 Registered
>>> office: 81 Linkfield Street, Redhill RH1 6BY
>>> _______________________________________________
>>> LLVM Developers mailing list
>>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>> 
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list