[LLVMdev] Generate Executable to Mips

reed kotler rkotler at mips.com
Tue Feb 28 13:33:43 PST 2012


In principle you can get rid of the dependence on mips-gcc for linking 
and assembly.
We just have not bothered to fix the scripts for that.

You should be able to do the last step with as and ld.
If you are using the direct object emitter, then you only need ld.

You can join the googlecode for that project as a developer and check in 
your changes
if  you get that working.

On 02/27/2012 08:30 PM, Jia Liu wrote:
> Great Job!
> If I use alternate-clang-driver, will I need mips-gcc still?
> I mean alternate-clang-driver use as&ld directly or by calling gcc?
>
>
>
> Regards,
> Jia Liu
>
> On Tue, Feb 28, 2012 at 10:39 AM, reed kotler<rkotler at mips.com>  wrote:
>> 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>  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
>>
>>
>>
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>
>>
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>




More information about the llvm-dev mailing list