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 >
Thanks Akira, it worked! On Thu, Feb 23, 2012 at 10:01 PM, Akira Hatanaka <ahatanak at gmail.com> wrote:> 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 > > >-- *Rafael Parizi* -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120226/11910299/attachment.html>
There is also: 1) an alternate clang driver at http://code.google.com/p/alternate-clang-driver/ . This makes it more or less gcc compatible. 2) there is a way to invoke it all directly with just a call to clang as is with x86/linux but it's not totally finished. i will try and post something about this. the direct form will work if you are on a mips linux machine but there are still some issues running it as a cross. On 02/26/2012 05:36 PM, Rafael BP wrote:> Thanks Akira, > it worked! > > On Thu, Feb 23, 2012 at 10:01 PM, Akira Hatanaka <ahatanak at gmail.com > <mailto:ahatanak at gmail.com>> wrote: > > 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 <mailto: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 <mailto: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 <mailto:LLVMdev at cs.uiuc.edu> > http://llvm.cs.uiuc.edu > > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > > > > > > -- > */Rafael Parizi/* > > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120227/e0a8416b/attachment.html>