[cfe-dev] How do I specify a specific PowerPC CPU to clang?

Richard Pennington rich at pennware.com
Mon Jun 18 16:47:00 PDT 2012

On Monday, June 18, 2012 04:32:15 PM Sean Payne wrote:

I want to have clang and then llvm generate code for a specific CPU.  Eg, 
suppose I want it to build for the PowerPC 750 CPU, how am I meant to tell 

I'm running the latest latest trunk versions of clang and llvm on windows and 
I'm running clang in the debugger.  I've tried all sorts of combinations, but 
can't get the "CPU" member of TargetOptions to be populated.  e.g. here are 
some arguments I've tried that didn't work: -target ppc750-bla-darwin   -S c:
\projects\llvm_750\test1.cpp -o -



Hi Sean,

Interesting you should ask this question. Today I added an -mcpu option to my 
version off clang/LLVM:

[~/ellcc] main% bin/ecc -target ppc-ellcc-linux hello.c -v -mcpu=750
clang version 3.2 (http://ellcc.org/svn/ellcc/branches/newlib/llvm/tools/clang 
Target: ppc-ellcc-linux
Thread model: posix
 "/home/rich/ellcc/bin/ecc" -cc1 -triple ppc-ellcc-linux -S -disable-free -
main-file-name hello.c -mrelocation-model static -mdisable-fp-elim -fmath-errno 
-mconstructor-aliases -msoft-float -target-cpu 750 -target-linker-version -momit-leaf-frame-pointer -v -resource-dir 
/home/rich/ellcc/bin/../libecc -fmodule-cache-path /var/tmp/clang-module-cache 
-fno-dwarf-directory-asm -fdebug-compilation-dir /home/rich/ellcc -ferror-
limit 19 -fmessage-length 87 -mstackrealign -fno-signed-char -fgnu-runtime -
fobjc-runtime-has-arc -fobjc-runtime-has-weak -fobjc-fragile-abi -
fdiagnostics-show-option -fcolor-diagnostics -o /tmp/hello-KzHR2J.s -x c 
clang -cc1 version 3.2 based upon LLVM 3.2svn default target x86_64-unknown-
#include "..." search starts here:
#include <...> search starts here:
End of search list.
 "/home/rich/ellcc/bin/ppc-elf-as" -o /tmp/hello-ZIWKej.o /tmp/hello-KzHR2J.s 
 "/home/rich/ellcc/bin/ecc-ld" -m elf32ppc --build-id --hash-style=gnu -e 
_start --eh-frame-hdr -Bdynamic -dynamic-linker /usr/libexec/ld.so -o a.out 
/home/rich/ellcc/bin/../libecc/lib/ppc/linux/crtbegin.o -nostdlib -
L/home/rich/ellcc/bin/../libecc/ldscripts/linux -
L/home/rich/ellcc/bin/../libecc/lib/ppc/linux -
L/home/rich/ellcc/bin/../libecc/lib/ppc /tmp/hello-ZIWKej.o -Telf32ppc.x -lc -
lcompiler-rt /home/rich/ellcc/bin/../libecc/lib/ppc/linux/crtend.o
[~/ellcc] main% 

Currently the TOT doesn't support -mcpu for the PowerPC.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120618/2e552ea9/attachment.html>

More information about the cfe-dev mailing list