[LLVMdev] Compiling a raw binary with llvm/clang
Eli Friedman
eli.friedman at gmail.com
Thu Dec 17 20:05:55 PST 2009
On Thu, Dec 17, 2009 at 7:42 PM, LiteHacker <vilmer88 at gmail.com> wrote:
>
> $ clang -ffunction-sections -fdata-sections -Os -nostartfiles -c -o hello.o
> hello.c
> $ clang -ffunction-sections -fdata-sections -Os -nostartfiles -c -o test.o
> test.c
> $ llvm-ld -s -o hello2 hello.o
> $ llc hello2.bc -o hello3
> $ ld -o hello_B hello3 --oformat binary
> ld:hello3: file format not recognized; treating as linker script
> ld:hello3:1: syntax error
>
> I am guessing that is what you meant by the "then use the same procedure you
> were originally using." right?
>
> Sorry for the hasle. Thank you for your help,
> Ven
Umm, yes, except you need to add a step to assemble the output of llc
(something like "gcc -x assembler hello3 -c -o hello4").
-Eli
More information about the llvm-dev
mailing list