[cfe-dev] [LLVMdev] how to change a compiler from a host to a target in Clang's assembler and linker

ETANI NORIKO noriko-e at fc.ritsumei.ac.jp
Tue Jul 17 21:05:03 PDT 2012


Hi,

Thank your for your confirmation.

I had been looking for llvm compiler's option for compiler, assembler, and linker replacing asserted ones to target ones. As a cross-compiler, a cross-assembler, and a cross-linker for target have been already created in toolchain, they can be replaced through llvm compileration.

Wishes,
Noriko 


-----Original message-----
From:NAKAMURA Takumi <geek4civic at gmail.com>
To:noriko-e at fc.ritsumei.ac.jp
Cc:llvmdev <llvmdev at cs.uiuc.edu>,cfe-dev <cfe-dev at cs.uiuc.edu>,Akira Hatanaka <ahatanaka at mips.com>,reed kotler <rkotler at mips.com>
Date:Sat, 7 Jul 2012 00:12:24 +0900
Subject:Re: [LLVMdev] how to change a compiler from a host to a target in Clang's assembler and linker

Konbanwa, Etani san,

It might be clang driver issue. Move to cfe-dev.

2012/7/4 ETANI NORIKO <noriko-e at fc.ritsumei.ac.jp>:
> I would like to ask you how to use Clang in cross-compile environment. My environment is as follows:
> ------
> HOST: 32-bit Fedora 16 with Intel Core i7
>       gcc/g++ compiler available
> TARGET: 32-bit mips-typed linux
>       gnu gcc/g++ for 32-bit mips-typed linux available
> ------

* What do you specify as -target? (eg. clag -c -target i686-pc-mingw32)

* Which toolchain have you installed and what is the prefix of it?
AFAIU, GNU binutils for the target would be essential.
(eg. /usr/bin/i686-pc-mingw32-ld)

> As Clang's option is "-c" in use, my programs are compiled and linked under a host machine's environment (in my case, 32-bit Fedora 16 is a host OS with Intel Core i7).
>
> In order to compile and link them under a target's environment (in my case, mips-typed linux gcc/g++ can work), in Clang’s "Assembler" and "Linker" processes, a compiler on a host should be changed to one on a target. Still now, I cannot find out a file to set a compiler for "Assembler" and "Linker" in Clang. Please advise me how to change a compiler from a host one to a target one.

* Have you tried "clang -c -integrated-as"?

To Mips guys: Do you think Mips MC assembler would work?

FYI, workaround.
clang -S hogehoge.c
target-gcc -c hogehoge.s
target-gcc -o fugafuga hogehoge.o ...
(I don't know how mips-clang would be mature)

...Takumi (中村)



More information about the cfe-dev mailing list