[LLVMdev] Static code generation - is it gone from LLVM 2.7?

Peter Shugalev peter at shugalev.com
Sat Mar 27 03:41:42 PDT 2010


Chris Lattner wrote:
> On Mar 26, 2010, at 6:24 PM, Peter Shugalev wrote:
> 
>> Hi,
>>
>> Just realized that ability to generate static object code (e.g. ELF w/o
>> using JIT) is no longer available in 2.7 (at least in release_27 branch).
>>
>> For example
>>> llc -filetype=obj whatever.bc
>> doesn't work in Linux environment anymore (well it wasn't fully
>> implemented before but it worked for simple bytecodes in 2.6).
>>
>> I used to generate code by creating TargetMachine and
>> FunctionPassManager, then calling TargetMachine::addPassesToEmitFile,
>> then adding my own CodeEmitter/CodeWriter (exactly like llc does). I
>> have to say I always hated code emitter interface but at least it worked
>> for me.
>>
>> Now LLVMTargetMachine::addPassesToEmitFile has changed. It adds its own
>> code emitter and it's always MachOCodeEmitter which of course I don't need.
>>
>> Is there a new way to create non-JIT object code in LLVM 2.7?
> 
> Nope, sorry.  This will hopefully be coming in 2.8.  Mainline llvm can already do macho quite robustly for x86-32 and x86-64.
> 
> -Chris
> 

What exactly is expected to be coming? Will it be the same way MachO is
currently implemented but with some flexibility to supply my own class
to do actual object output? Or just a return of old ObjectCodeEmitter?

-- 
Best Regards
Peter Shugalev



More information about the llvm-dev mailing list