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

Luke Evans
Mon, 16 Mar 2009 08:11:06 -0000

> 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.


Thanks for the scoop on the situation.  Much obliged.
It's some relief that my total failure to get anywhere this evening
isn't entirely down to my own incompetence ;-)

After failing to get llc working I was starting to steal code from it
to create just the specific pipeline I wanted, but that wasn't going
anywhere either.

Anyway, actually getting .o output from llc (and via the API of
course) would be wonderful.  I did try the 2.5 llc I compiled myself
with various combinations of arguments including things like:
llc -mtriple='i686-apple-darwin9' -filetype=obj myModule.bc -o foo.o

...but that doesn't seem to work at the moment either (same "target
does not support generation of this file type!" message).

 From what you say, it seems this should work in some simple cases for
2.5, so I conclude that I haven't been driving llc correctly enough to
get the output to work.  Does it need a specific combination of args?
Perhaps more in the module than I provide (targetTriple?).

I had managed to get a .s out by requesting the asm file type, so at
the very least I can rely more of the platform tooling to achieve the
result I want.

Hopefully you can provide more clue about getting llc going for .o
output with 2.5.  Otherwise, I'll certainly keep watching progress
with interest.

Cheers

-- lwe



-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20090316/740f569b/attachment.html>