[LLVMdev] n00b question: From module/bitcode to Mach-O dylib file directly?

someguy just.s0m3.guy+llvmdev at gmail.com
Mon Mar 16 00:27:25 PDT 2009


Hey Luke,

Unfortunately, the 'state of the art' is that llc only really supports
emission of native assembly files (-filetype=asm) which can then be
assembled and linked with your native gas/ld.

There is some source support for 'object file generation', exposed via
the -filetype=obj flag to llc, but it is not complete, and totally
broken in some cases. This is something I am trying to work on with
Aaron. You can follow our discussion on the list here, and feel free
to pitch in.

That said, the MachO generation _should_ work (in 2.5) for outputting
.o files, which would still need to be linked using your native ld
into a dynlib. I don't see that llc will ever generate a dynlib, as I
think that that is not its function. The most you can expect is a
valid target object file.

If you encounter a particular issue using the -filetype=obj flag,
please let us know so we can fix it...

I for one would really like to see object generation become a fully
working feature of the llvm toolchain.

On Mon, Mar 16, 2009 at 4:54 AM, Luke Evans <luke at eversosoft.com> wrote:
> Aaah. Wasn't quite sure what you were doing here. I'm not positive
> what llvm can emit via the writers (there's support for all parts of
> the file format), but it could be extended to write one out. I'm just
> not quite sure why :)
> -eric
>
> Well, ultimately I'm curious about what it would take to port a JVM based
> language (http://openquark.org) to LLVM.
> A main motivator though is language/library/platform integration on the Mac
> (Cocoa, Objective-C, autozone).  I'm not too interested in a JIT at this
> point, but rather native code generation.
> So far I can see a MachOWriter (with an "AddMachOWriter" in FileWriters.h)
> and it looks like I get to pass an appropriate TargetMachine to this.
> I'm wondering if this is expected to be sufficient (added to a pass manager)
> to be able to output a library on the Mac - whether or not it actually
> works.
> I only picked LLVM up yesterday, so I'm still trying to understand how the
> parts work together.  With my current lack of orientation I have very little
> intuition as to whether I'm on the right track, and if it fails, how close
> (or otherwise) I might have been to getting something going.  So I suppose
> I've
> been looking for hints at the vague 'shape' of the code I would expect to
> connect together to get the output I want, and while there are some nice
> samples for some parts of LLVM, I haven't found much to help learn how to
> emit native .o or .dylib (assuming this is possible).
> In the meantime I'll spend some time trying to bang some of the
> aforementioned pieces together and see if I can get it to do anything
> interesting with a minimal module.
> Thanks.
> -- lwe
>
>
>
>
>
>
> _______________________________________________
> 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