I am following the kaleidoscope tutorial. Emitting object code is very simple, but now I would like to implement linking step so that my toy programming language could compile directly into a binary (so there is no clang
usage necessary). How can I achieve this with LLVM?
As far as the "no clang
necessary": LLVM has a linker called LLD
that is part of the LLVM project. Depending on how you installed LLVM it should be part of the distro.
Refer to your installed version for LLD as well as usage strategies. You will be able to then define your make
or cmake
recipes.
With reference to your core question, here is the general make flow I go through with my own language:
opt
)as
) -> output.oclang
but this could be swapped with lld
)