Seb
October 27, 2011, 7:30am
#1
Hi all,
Can someone give me advice on what should be a good definition of target datalayout for an ARM cortex-A9 + neon target and x86 32-bit ?
Shall I use a different definition for a cortex-A9 without neon ?
Thanks for your advices
Best Regards
Seb
You can compile an empty C source code with clang -S -emit-llvm and copy the data layout from there.
2011/10/27 Seb <babslachem@gmail.com >
Seb
October 28, 2011, 7:21am
#3
I tried bu clang seems to support only target on which it has been compiled.
If I use:
with clang -S -emit-llvm t.c -o t.ll
I’ve got following file for t.ll
; ModuleID = ‘t.c’
target datalayout = “e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128”
target triple = “x86_64-unknown-linux-gnu”
Which, I think, defines datalayout for x86 64-bit target.
Now If I add -march=arm or -march=x86-32 I’ve got following error message from clang:
error: unknown target CPU ‘arm’
or
error: unknown target CPU ‘x86-32’
Is there a way to build clang so that it support cross-compilation for ARM/x86-32 ?
Best Regards
Seb
2011/10/27 Carl-Philip Hänsch <cphaensch@googlemail.com >
Hi Seb,
You need to use the “-ccc-host-triple” argument to Clang. We’re planning on changing this behaviour to make it more usable.
Clang –ccc-host-triple armv7 –S –emit-llvm –mcpu=cortex-a9 –mattr=+neon
Clang –ccc-host-triple armv7 –S –emit-llvm –mcpu=cortex-a9 –mattr=-neon
Cheers,
James