[llvm-bugs] [Bug 50212] New: llvm-project v12 does not work correctly with JIT-ed code for ARM64
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon May 3 23:17:50 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=50212
Bug ID: 50212
Summary: llvm-project v12 does not work correctly with JIT-ed
code for ARM64
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: release blocker
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: alex_fedch at ukr.net
CC: blitzrakete at gmail.com, dgregor at apple.com,
erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
Created attachment 24825
--> https://bugs.llvm.org/attachment.cgi?id=24825&action=edit
It is simple example (JITtest) what demonstrates issue
I detected wrong work llvm-12 with JITed code for ARM64. (llvm-10 work
correctly)
I wrote a simple example (JITtest) that demonstrates issues and differences
between llvm-10 and llvm-12; between x86_64 and ARM64 for Ubuntu-20.
I created fn_lib.c file with one function, then created fn_lib.ll file (command
" clang -g -c -S -emit-llvm fn_lib.c ")
In jit_test.cpp I load fn_lib.ll (use llvm::parseIRFile), then created
llvm::ExecutionEngine, then founf my function (fn), create argumets and run my
function.
jit_test.cpp can be compile using command " clang++ -g jit_test.cpp -o jit_test
`llvm-config --cxxflags --ldflags --system-libs --libs all` "
This example work OK for clang-10/x86_64, clang-10/ARM64, clang-12/x86_64 BUT
does not work for clang-12/ARM64
At the bottom, I added console output for all cases. (for output logs I used
QEMU for ARM64 and VirtualBox for x86_64, but on real PC and real ARM64 output
the same)
Ubuntu 20, x86_64, clang-10
============================
vub at vub:~/proj/JITtest$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.2 LTS
Release: 20.04
Codename: focal
vub at vub:~/proj/JITtest$ clang++ -v
clang version 10.0.0-4ubuntu1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/9
Candidate multilib: .;@m64
Selected multilib: .;@m64
vub at vub:~/proj/JITtest$ clang -v
clang version 10.0.0-4ubuntu1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/9
Candidate multilib: .;@m64
Selected multilib: .;@m64
vub at vub:~/proj/JITtest$ ls
fn_lib.c jit_test.cpp ReadMe.txt
vub at vub:~/proj/JITtest$ clang -g -S -emit-llvm fn_lib.c
vub at vub:~/proj/JITtest$ clang++ -g jit_test.cpp -o jit_test `llvm-config
--cxxflags --ldflags --system-libs --libs all`
vub at vub:~/proj/JITtest$ ls
fn_lib.c fn_lib.ll jit_test jit_test.cpp ReadMe.txt
vub at vub:~/proj/JITtest$ ./jit_test
START!
parseIRFile
EngineBuilder create
Example: fn(7) = 5040
FINISH!
vub at vub:~/proj/JITtest$
Ubuntu 20, ARM64, clang-10
============================
JITtest# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.2 LTS
Release: 20.04
Codename: focal
JITtest# clang++ -v
clang version 10.0.0-4ubuntu1
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/aarch64-linux-gnu/9
Found candidate GCC installation: /usr/lib/gcc/aarch64-linux-gnu/9
Selected GCC installation: /usr/bin/../lib/gcc/aarch64-linux-gnu/9
Candidate multilib: .;@m64
Selected multilib: .;@m64
JITtest# clang -v
clang version 10.0.0-4ubuntu1
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/aarch64-linux-gnu/9
Found candidate GCC installation: /usr/lib/gcc/aarch64-linux-gnu/9
Selected GCC installation: /usr/bin/../lib/gcc/aarch64-linux-gnu/9
Candidate multilib: .;@m64
Selected multilib: .;@m64
JITtest# ls
ReadMe.txt fn_lib.c jit_test.cpp
JITtest# clang -g -S -emit-llvm fn_lib.c
JITtest# clang++ -g jit_test.cpp -o jit_test `llvm-config --cxxflags --ldflags
--system-libs --libs all`
JITtest# ls
ReadMe.txt fn_lib.c fn_lib.ll jit_test jit_test.cpp
JITtest# ./jit_test
START!
parseIRFile
EngineBuilder create
Example: fn(7) = 5040
FINISH!
JITtest#
Ubuntu 20, x86_64, clang-12
============================
vub at vub20c12:~/proj/JITtest$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.2 LTS
Release: 20.04
Codename: focal
vub at vub20c12:~/proj/JITtest$ clang++-12 -v
Ubuntu clang version
12.0.0-++20210331122613+9ae9ab1ca343-1~exp1~20210330223318.69
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/9
Candidate multilib: .;@m64
Selected multilib: .;@m64
vub at vub20c12:~/proj/JITtest$ clang-12 -v
Ubuntu clang version
12.0.0-++20210331122613+9ae9ab1ca343-1~exp1~20210330223318.69
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/9
Candidate multilib: .;@m64
Selected multilib: .;@m64
vub at vub20c12:~/proj/JITtest$ ls
fn_lib.c jit_test.cpp ReadMe.txt
vub at vub20c12:~/proj/JITtest$ clang-12 -g -S -emit-llvm fn_lib.c
vub at vub20c12:~/proj/JITtest$ clang++-12 -g jit_test.cpp -o jit_test
`llvm-config-12 --cxxflags --ldflags --system-libs --libs all`
vub at vub20c12:~/proj/JITtest$ ls
fn_lib.c fn_lib.ll jit_test jit_test.cpp ReadMe.txt
vub at vub20c12:~/proj/JITtest$ ./jit_test
START!
parseIRFile
EngineBuilder create
Example: fn(7) = 5040
FINISH!
vub at vub20c12:~/proj/JITtest$
Ubuntu 20, ARM64, clang-12
============================
JITtest# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.2 LTS
Release: 20.04
Codename: focal
JITtest# clang++ -v
clang version 12.0.0
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/aarch64-linux-gnu/9
Found candidate GCC installation: /usr/lib/gcc/aarch64-linux-gnu/9
Selected GCC installation: /usr/bin/../lib/gcc/aarch64-linux-gnu/9
Candidate multilib: .;@m64
Selected multilib: .;@m64
JITtest# clang -v
clang version 12.0.0
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/aarch64-linux-gnu/9
Found candidate GCC installation: /usr/lib/gcc/aarch64-linux-gnu/9
Selected GCC installation: /usr/bin/../lib/gcc/aarch64-linux-gnu/9
Candidate multilib: .;@m64
Selected multilib: .;@m64
JITtest# ls
ReadMe.txt fn_lib.c jit_test.cpp
JITtest# clang -g -S -emit-llvm fn_lib.c
JITtest# clang++ -g jit_test.cpp -o jit_test `llvm-config --cxxflags --ldflags
--system-libs --libs all`
JITtest# ls
ReadMe.txt fn_lib.c fn_lib.ll jit_test jit_test.cpp
JITtest# ./jit_test
START!
parseIRFile
EngineBuilder create
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
Segmentation fault (core dumped)
JITtest#
--
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/20210504/6bf36fda/attachment.html>
More information about the llvm-bugs
mailing list