[LLVMdev] lli : external functions and target datalayout

Óscar Fuentes ofv at wanadoo.es
Sun Oct 24 10:48:32 PDT 2010


Jianzhou Zhao <jianzhou at seas.upenn.edu> writes:

[snip]

> The other question is about
> target datalayout =
> "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
>
> If I use this string to creat a TargetData object directly, I got an
> assertion error:
>
> ~/llvm-2.6/lib/Target/TargetData.cpp:246: void
> llvm::TargetData::setAlignment(llvm::AlignTypeEnum, unsigned char,
> unsigned char, uint32_t): Assertion `abi_align <= pref_align &&
> "Preferred alignment worse than ABI!"' failed.
> Aborted
>
> This is because of the i64:32:64. It seems to be i64:64:64. 'lli' is
> able to fix this problem automatically, but why does llvm-gcc output
> i64:32:64 rather than i64:64:64?

FYI: the X86 data layout is hard-coded in
lib/Target/X86/X86TargetMachine.cpp, so that assert is mostly bogus, and
the existence of "target datalayout" IR setting and
Module::setDataLayout are deceiving.



More information about the llvm-dev mailing list