Andreas Galauner
2010-Apr-08 00:07 UTC
[LLVMdev] Using LLVM with clang for a homebrew kernel
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
On Apr 7, 2010, at 5:07 PM, Andreas Galauner wrote:> > shouldn't be necessary with llvm since I can just translate the bitcode > to any native architecturehttp://llvm.org/docs/FAQ.html#platformindependent Dan
On Wed, Apr 07, 2010 at 06:05:56PM -0700, Dan Gohman wrote:> On Apr 7, 2010, at 5:07 PM, Andreas Galauner wrote: > > > > shouldn't be necessary with llvm since I can just translate the bitcode > > to any native architecture > > http://llvm.org/docs/FAQ.html#platformindependentExcept 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
Possibly Parallel Threads
- [LLVMdev] Using LLVM with clang for a homebrew kernel
- [RFC][clang/llvm] Allow efficient implementation of libc's memory functions in C/C++
- [LLVMdev] [llvm-commits] [llvm] r166875 - in /llvm/trunk: lib/Transforms/Scalar/LoopIdiomRecognize.cpp test/Transforms/LoopIdiom/basic.ll
- RFC: module flag for hosted mode
- RFC: module flag for hosted mode