I want to try something new and try to use llvm with clang as a C(++)
frontend as a compiler.
Unfortunately I couldn't find any information about how I can use clang
and llvm in a freestanding environment without a libc, so I thought
about asking on this mailing list. I hope this is the right place for
such things.
When using gcc, I just added "-nostdlib -nostdinc -fno-builtin
-ffreestanding" to the parameters and everythin was fine. How can I do
that with llvm?
The next thing is the architecture. I'm currently writing code for i686,
but there will be support for ia64 and arm in the future. Regardless of
the host platform, I need to cross compile my binaries for a given
architecture. How can I specify that? With gcc I needed to create a
complete cross compiling toolchain (target i686-elf for example) which
shouldn't be necessary with llvm since I can just translate the bitcode
to any native architecture I want. But how can I select it?
Another thing inside the target string (this i686-elf thingy) is the
binary format. I though about using Mach-O instead of ELF and llvm seems
to support that, since it created perfect Mach-O files when I tested it
with a hello world on my Mac OS. Where can I set this output format?
Can somebody push me into the right direction or towards the right
documentation about this?
Thanks,
Andreas Galauner
_______________________________________________
LLVM Developers mailing list
LLV...@cs.uiuc.edu http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
http://llvm.org/docs/FAQ.html#platformindependent
Dan
In the llvm-doc is the following:
Also, since many platforms define their ABIs in terms of C, and since
LLVM is lower-level than C, front-ends currently must emit
platform-specific IR in order to have the result conform to the platform
ABI.
Can you give an example for this except system calls (which e.g. on
windows use
a different calling convention)?
If you write your own operating system then how does llvm-IR depend on
the ABI?
-Jochen
varargs is the poster boy. Right now llvm proper only has support for
some pieces of varargs translation on x86_64. Frontends handle the bulk of
the work.
I hope to add some more code in this area relatively soon.
Of course, anything having to do with Fortran is done completely by
the frontend as there is no standard ABI for that language.
-Dave
Except that in this case there is no ABI to deal with, so it should be
possible to write code with care such that the generated bitcode is platform
independent.
Tom