I am beginner and Windows user.
In directory MinGW\bin\ I call llvm-gcc.exe hello.c -emit-llvm -S
and file hello.s is created.
I want to compile this assembler code by calling llvm-gcc.exe hello.c
-emit-llvm, it appear collect2: cannot find 'ld'; ld.exe is in this
directory. I have problem with paths?
How I can compile not directly c do bytecode but hello.s to bytecode?
Hello Borneq,
If you want to compile bitcode into assembly, you need to invoke the llvm-as and
llc commands on it to convert it from LLVM Assembly source to bitcode and then
native assembly source instead of llvm-gcc.
If that doesn't work, post back here,
--Sam
Samuel Crow wrote:
If you want to compile bitcode into assembly, you need to invoke the
llvm-as and
llc commands on it to convert it from LLVM Assembly source to bitcode and
then
native assembly source instead of llvm-gcc.
llvm-as compiled hello.s to hello.s.bc. How link it with stdio - I use
printf
llc is virtual machine? If I call llc with hello.s.bc it do nothing (because
printf not linked)
LLVM serve garbage collection? How use it? If I write "p=malloc(100)" it
probably not free with GC. How write finalizer method called before free?
llc is the bitcode to native Assembly compiler. Once you have it compiled you
can assemble the output with the gas assembler and link with the C runtime
library using ld.
If you want to run the bitcode directly, you use lli instead. That uses a JIT
by default or, if JIT is unsupported on your platform, an interpreter. Also,
when running lli from the command line, I don't think you need to do anything
special to link the C runtime library since lli already uses it.
If you want to use garbage collection, you need to run a programming language
that supports garbage collection like Objective C 2.0. By default, C doesn't
support garbage collection.