[LLVMdev] Structure alignment
Manoel Teixeira
manoel at fonetica.com.br
Tue Jun 9 13:35:52 PDT 2009
Hi,
It's not ok yet.
When a C function calls a LLVM function, or a LLVM function calls a C function, the offset of the variables are wrong.
When a don't mix LLVM with C, it's ok, but I need call extern functions using structs.
Ciao
Manoel
Subject: Re: [LLVMdev] Structure alignment
To: LLVM Developers Mailing List <llvmdev at cs.uiuc.edu>
Message-ID:
<f5aa3e9b0906081415oa706eadh21a7814c0f95e006 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
On Mon, Jun 8, 2009 at 1:53 PM, Manoel Teixeira<manoel at fonetica.com.br> wrote:
>
> %FIRSTSTRU = type { i32, ?double, i32, i8* }
>
> struct ?{
> ? ? ? ?int ? ? ? ? ? ? ? ? ? ? ? ? ? ? var1;
> ? ? ? ?double ? ? ? ? ? ? ? ? ?var2;
> ? ? ? ?int ? ? ? ? ? ? ? ? ? ? ? ? ? ? var3;
> ? ? ? ?char ? ?*var4;
> }firstStru ;
>
> Could someone help?
> If, running a application in windows with MSVC, ?I allocate a memmory buffer and call a LLVM
> function with such buffer, there's a structure alignment problem.
> If the LLVM function call a C function using the same buffer, it runs fine.
> Any ideas?
You're probably passing in the wrong string to the TargetData; try
something like the following:
target datalayout =
"e-p:32:32:32-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-f80:32:32"
-Eli
More information about the llvm-dev
mailing list