[LLVMbugs] [Bug 16256] New: MCJIT on ARM does not link correctly external functions with double-typed arguments

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jun 7 01:40:20 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=16256

            Bug ID: 16256
           Summary: MCJIT on ARM does not link correctly external
                    functions with double-typed arguments
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Generic Execution Engine Support
          Assignee: unassignedbugs at nondot.org
          Reporter: dmitri.rubinstein at googlemail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

When external function accepts double-typed arguments MCJIT does not correctly
link it.

Following command sequence produces different results on x86_64 and ARM
(RaspberryPi VM with hard-float ABI, see below for details):

cat > printd.c <<EOF
#include <stdio.h>

double printd(double X)
{
   printf("printd: %f\n", X);
   return 0;
}
EOF

cat > print.c <<EOF
#include <stdio.h>

extern double printd(double X);

int main(int argc, char **argv)
{
   printd(123.0);
   printd(4.0);
   return 0;
}
EOF

gcc printd.c -fPIC -shared -o printd.so
clang -Wall -c -emit-llvm -O3 print.c -o print.bc
lli -use-mcjit -load=./printd.so print.bc

Correct output on x86_64:
printd: 123.000000
printd: 4.000000

Wrong output on ARM:
printd: 1.000000
printd: 0.000000

When printd definition is added into print.c everything works as expected.

ARM configuration is QEMU with RaspberryPi Raspbian “wheezy” kernel, 
hard float support:

cat /proc/cpuinfo 
Processor       : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS        : 602.11
Features        : swp half thumb fastmult vfp edsp java tls 
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xb76
CPU revision    : 7

Hardware        : ARM-Versatile PB
Revision        : 0000
Serial          : 0000000000000000

LLVM datalayout and triple produced by clang are:

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:64:128-a0:0:64-n32-S64"
target triple = "armv4t-unknown-linux-gnueabihf"

LLVM was cloned from git repository, branch release_33, latest commit:
1df068064
git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_33@182492
91177308-0d34-0410-b5e6-96231b3b80d8

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130607/e50cfbad/attachment.html>


More information about the llvm-bugs mailing list