[LLVMdev] JIT on armhf

David Given dg at cowlark.com
Fri Feb 8 13:42:36 PST 2013


On 08/02/13 14:42, Renato Golin wrote:
[...]
> Can you paste the result of a "clang -v -mcpu=CPU file.c" on your box? I
> want to see what are the arguments and the assembler/linker it's
> choosing to use. What CPU are we talking about?

The box itself is an Allwinner A10; armv7l. /proc/cpuinfo says it's got
swp half thumb fastmult vfp edsp neon vfpv3.

I've been unable to find any values for CPU which are accepted (it just
says 'unknown target CPU'. I've tried arm, armv7, armv7a, armv7l, arm7,
armv4t... Any suggestions? Is there a way to get clang and llc to emit a
list of what triples they support?

Since I posted my message I notice that clang 3.2 has hit Debian
experimental. This no longer produces the warning about an unrecognised
platform, but it still generates softfloat code --- I've compared
clang's output and gcc, and gcc produces hardfloat code. (Incidentally,
I was wrong earlier about clang 3.2 failing. Its output causes ld to
produce an assertion message, and it didn't occur to me then to look to
see whether it had actually created a binary or not.)

Here's what clang 3.2 says with 'clang -v -S -O3 test.c':

Debian clang version 3.2-1~exp3 (tags/RELEASE_32/final) (based on LLVM 3.2)
Target: arm-unknown-linux-gnueabihf
Thread model: posix
"/usr/bin/clang" -cc1 -triple armv4t-unknown-linux-gnueabihf -S
-disable-free -disable-llvm-verifier -main-file-name test.c
-mrelocation-model static -mdisable-fp-elim -fmath-errno
-mconstructor-aliases -fuse-init-array -target-abi aapcs-linux
-target-cpu arm7tdmi -mfloat-abi hard -target-linker-version 2.22
-momit-leaf-frame-pointer -v -coverage-file
/home/dg/shared/workspace/calculon/test.s -resource-dir
/usr/bin/../lib/clang/3.2 -fmodule-cache-path
/var/tmp/clang-module-cache -internal-isystem /usr/local/include
-internal-isystem /usr/bin/../lib/clang/3.2/include -internal-isystem
/usr/include/clang/3.2/include/ -internal-externc-isystem
/usr/include/arm-linux-gnueabihf -internal-externc-isystem
/usr/include/arm-linux-gnueabihf -internal-externc-isystem /usr/include
-O3 -fno-dwarf-directory-asm -fdebug-compilation-dir
/home/dg/shared/workspace/calculon -ferror-limit 19 -fmessage-length 80
-mstackrealign -fno-signed-char -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -o test.s -x c test.c

Clang 3.1:

Debian clang version 3.1-8 (branches/release_31) (based on LLVM 3.1)
Target: arm-unknown-linux-gnueabihf
Thread model: posix
clang: warning: unknown platform, assuming -mfloat-abi=soft
 "/usr/bin/clang" -cc1 -triple armv4t-unknown-linux-gnueabihf -S
-disable-free -disable-llvm-verifier -main-file-name test.c
-mrelocation-model static -mdisable-fp-elim -mconstructor-aliases
-target-abi apcs-gnu -target-cpu arm7tdmi -msoft-float -mfloat-abi soft
-target-feature +soft-float -target-feature +soft-float-abi
-target-feature -neon -target-linker-version 2.22
-momit-leaf-frame-pointer -v -coverage-file test.s -resource-dir
/usr/bin/../lib/clang/3.1 -fmodule-cache-path
/var/tmp/clang-module-cache -internal-isystem /usr/local/include
-internal-isystem /usr/bin/../lib/clang/3.1/include -internal-isystem
/usr/include/clang/3.1/include/ -internal-externc-isystem
-internal-externc-isystem /usr/include/arm-linux-gnueabihf
-internal-externc-isystem /usr/include/arm-linux-gnueabihf
-internal-externc-isystem /usr/include -O3 -fno-dwarf-directory-asm
-fdebug-compilation-dir /home/dg/shared/workspace/calculon -ferror-limit
19 -fmessage-length 80 -mstackrealign -fno-signed-char -fgnu-runtime
-fobjc-runtime-has-arc -fobjc-runtime-has-weak -fobjc-fragile-abi
-fdiagnostics-show-option -fcolor-diagnostics -o test.s -x c test.c

And here's clang 3.0:

Debian clang version 3.0-6 (tags/RELEASE_30/final) (based on LLVM 3.0)
Target: arm-unknown-linux-gnueabihf
Thread model: posix
clang: warning: unknown platform, assuming -mfloat-abi=soft
 "/usr/bin/clang" -cc1 -triple armv4t-unknown-linux-gnueabihf -S
-disable-free -disable-llvm-verifier -main-file-name test.c
-mrelocation-model static -mdisable-fp-elim -mconstructor-aliases
-target-abi apcs-gnu -target-cpu arm7tdmi -msoft-float -mfloat-abi soft
-target-feature +soft-float -target-feature +soft-float-abi
-target-feature -neon -target-linker-version 2.22
-momit-leaf-frame-pointer -v -coverage-file test.s -resource-dir
/usr/bin/../lib/clang/3.0 -fmodule-cache-path
/var/tmp/clang-module-cache -internal-isystem /usr/local/include
-internal-isystem /usr/bin/../lib/clang/3.0/include
-internal-externc-isystem /usr/include/arm-linux-gnueabihf
-internal-externc-isystem /usr/include -O3 -ferror-limit 19
-fmessage-length 80 -fno-signed-char -fgnu-runtime
-fobjc-runtime-has-arc -fobjc-runtime-has-weak -fobjc-fragile-abi
-fdiagnostics-show-option -fcolor-diagnostics -o test.s -x c test.c

(Sorry for the spammage, but I thought it better to snip too little than
too much...)

I'm particularly curious about the way that the triple passed into the
compiler backend starts 'armv4t' when it's rejected as a CPU type if I
specify it manually.

[...]
> If that works, it's possible that you'll need to set the flags Clang is
> doing by default on your front-end, too.

But this *should* all be autodetected, right? If I'm using the JIT, I
shouldn't need platform-specific knowledge to set up the code generator?

-- 
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────
│ "Of course, on a sufficiently small planet, 40 km/hr is, in fact,
│ sufficient to punt the elastic spherical cow into low orbit." ---
│ Brooks Moses on r.a.sf.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130208/f95f583f/attachment.sig>


More information about the llvm-dev mailing list