LLVM Usage Question: Generating objects and executables from an LLVM client

Hi,

I was wondering if you have any good pointers to where to find easily consumable documentation of these things:

  1. How to generate a bitcode object file from an LLVM client (namely my frontend)?
  2. How to interact with libraries with objects in bitcode format from an LLVM client?
  3. How to write out a final executable from an LLVM client?

I know I can dig through the LLVM source tree, namely llvm-ar and llvm-ld, and find the answers, but I was wondering if this isn’t something that should be included in the Kaleidoscope tutorial as virtually anyone serious about using LLVM will run into this problem. I probably sound lazy, but think of the wannabe LLVM user as somebody who has either chosen to not spend time on doing his or her own backend or somebody who is, due to other constraints, limited in his or her choice and therefore just want to get going as quickly as possible. The Kaleidoscope use of JIT is in a way very, very beautiful and in a way less than practical. Because people probably only want to use JIT for interpreters and interpreted languages. If you are doing a compile-link-run language, you have little use for JIT.

I googled “llvm generate object” but found only little of relevance.

By the way, anyone got any comments on this idea of mine? My crazy little idea is that I will make proprietary formats for objects and archives and then (eventually) let the linker API mess around with the native shared library and native executable formats. There’s no reason for doing like this, but my language is only going to be interface compatible with shared libraries anyway as I don’t want to support linking in C and C++ code.

If you write good answers, I don’t mind writing up a supplemental (portable, generic) article for the Kaleidoscope sample. I have not dropped the notion of the Windows build slave doc, I am merely waiting for me to get my new build machine, having it set up, and then I will finish up the article and submit it for inclusion in the LLVM documentation.

Cheers,
Mikael

– Love Thy Frog!

While building i got this error

Error: JAVA_HOME is not defined correctly.

I wonder why vmkit requires JAVA_HOME, i would expect it to be independent of any java staff except the classspath. Am i missing something?

Thank you
Foivos

While building i got this error

Error: JAVA_HOME is not defined correctly.

I wonder why vmkit requires JAVA_HOME, i would expect it to be
independent of any java staff except the classspath. Am i missing something?

Thank you
Foivos

Hi Foivos,

I believe the ant tool is giving you this error message. vmkit requires ant to build MMTk (the garbage collector written in Java).

Cheers,
Nicolas