[LLVMdev] Compiling a raw binary with llvm/clang

LiteHacker vilmer88 at gmail.com
Thu Dec 17 12:08:44 PST 2009


Hey,

The following code creates a raw binary (no ELF or PE.. just raw):

gcc -nostartfiles -c -o hello.o hello.c
ld -o hello1 hello.o --oformat binary

You can try the following code out with it:

void _start()
{
  while(1);
}

The resulting raw binary is 5 bytes.

Now how do you do this in clang/llvm?
Apparently llvm-ld doesn't have a "--oformat binary" option.
Anybody know how to do this with llvm?
-- 
View this message in context: http://old.nabble.com/Compiling-a-raw-binary-with-llvm-clang-tp26834182p26834182.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.




More information about the llvm-dev mailing list