[LLVMdev] Compiling a raw binary with llvm/clang
Nick Lewycky
nicholas at mxc.ca
Thu Dec 17 21:02:30 PST 2009
LiteHacker wrote:
>
> Indeed ld does link it. The reason I am using llvm-ld, is for its unique
> functionality.
> I intend to link to object files together (created by cling), and link them
> with llvm-ld.
> The main feature that I am currently interested in is the ability to have
> "inline functions" between two object files. This was basically impossible
> with gcc.
> Is there any way to make the raw binary with llvm?
Use llvm-ld -link-as-library to perform many .bc files -> single .bc
file with link-time optimization applied.
The use llc to turn a single .bc files to a .s (assembly) file which gcc
can in turn handle.
Nick
> Thank you,
> Ven
>
>
> Török Edwin wrote:
>>
>>
>> An example with clang:
>> $ clang -nostartfiles -c x.c -o x.o
>> $ ld -o x x.o --oformat binary
>>
>> Or to get a 32-bit one:
>> $ /llvm-git/obj/Release/bin/clang -nostartfiles -c x.c -o x.o -m32
>> $ ld -o x1 x.o --oformat binary -melf_i386
>>
>> This one is indeed 5 bytes long.
>>
>> Best regards,
>> --Edwin
>>
>>
More information about the llvm-dev
mailing list