[LLVMdev] Using LLVM with clang for a homebrew kernel
Andreas Galauner
andreas at galauner.de
Wed Apr 7 17:07:12 PDT 2010
Hello everybody,
I'm currently developing my own small operating system as a hobby
project in my free time.
Until now, I'm using gcc and the binutils to compile my C++ code.
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
More information about the llvm-dev
mailing list