You will need to install a cross compiler.
I think you can find one somewhere in this link:
https://sourcery.mentor.com/GNUToolchain/
Once you have a cross compiler, this should do what you want (if you
want little-endian code):
clang -target mipsel-unknown-linux -ccc-clang-archs mipsel -O3
hello.c -o hello.bc -emit-llvm
llc -march=mipsel hello.bc -o hello.s
mips-linux-gnu-gcc hello.s -o hello -mips32 -EL
You can also generate object code with this command:
llc -march=mipsel hello.bc -o hello.o -filetype=obj
Then run the linker:
mips-linux-gnu-gcc hello.o -o hello -mips32 -EL
On Thu, Feb 23, 2012 at 4:18 PM, Rafael BP <parizi.computacao at
gmail.com> wrote:> This is true?
> clang/llvm cannot produce mips object code or executable (yet).
> from:
> http://old.nabble.com/How-to-get-MIPS-from-clang-%2B-llvm---td32822926.html
>
>
> On Thu, Feb 23, 2012 at 8:37 PM, Rafael BP <parizi.computacao at
gmail.com>
> wrote:
>>
>> Hi,
>> How can I generate executable to mips with llvm-gcc.
>> I'm using Ilvm-2.9, X86PC and the following commands:
>>
>> llvm-gcc -emit-llvm hello.c -c -o hello.bc (OK)
>> llc -march=mips hello.bc -o hello.s (OK)
>>
>> gcc hello.s -o hello (does not work).
>>
>> Thanks,
>>
>> --
>> Rafael Parizi
>>
>>
>>
>
>
>
> --
> Rafael Parizi
>
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>