<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - llvm-project v12 does not work correctly with JIT-ed code for ARM64"
href="https://bugs.llvm.org/show_bug.cgi?id=50212">50212</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>llvm-project v12 does not work correctly with JIT-ed code for ARM64
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>release blocker
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>alex_fedch@ukr.net
</td>
</tr>
<tr>
<th>CC</th>
<td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=24825" name="attach_24825" title="It is simple example (JITtest) what demonstrates issue">attachment 24825</a> <a href="attachment.cgi?id=24825&action=edit" title="It is simple example (JITtest) what demonstrates issue">[details]</a></span>
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@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@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@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@vub:~/proj/JITtest$ ls
fn_lib.c jit_test.cpp ReadMe.txt
vub@vub:~/proj/JITtest$ clang -g -S -emit-llvm fn_lib.c
vub@vub:~/proj/JITtest$ clang++ -g jit_test.cpp -o jit_test `llvm-config
--cxxflags --ldflags --system-libs --libs all`
vub@vub:~/proj/JITtest$ ls
fn_lib.c fn_lib.ll jit_test jit_test.cpp ReadMe.txt
vub@vub:~/proj/JITtest$ ./jit_test
START!
parseIRFile
EngineBuilder create
Example: fn(7) = 5040
FINISH!
vub@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@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@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@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@vub20c12:~/proj/JITtest$ ls
fn_lib.c jit_test.cpp ReadMe.txt
vub@vub20c12:~/proj/JITtest$ clang-12 -g -S -emit-llvm fn_lib.c
vub@vub20c12:~/proj/JITtest$ clang++-12 -g jit_test.cpp -o jit_test
`llvm-config-12 --cxxflags --ldflags --system-libs --libs all`
vub@vub20c12:~/proj/JITtest$ ls
fn_lib.c fn_lib.ll jit_test jit_test.cpp ReadMe.txt
vub@vub20c12:~/proj/JITtest$ ./jit_test
START!
parseIRFile
EngineBuilder create
Example: fn(7) = 5040
FINISH!
vub@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#</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>