<html>
<head>
<base href="https://llvm.org/bugs/" />
</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 --- - Obscure error message when BPF target fails compilation"
href="https://llvm.org/bugs/show_bug.cgi?id=26976">26976</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Obscure error message when BPF target fails compilation
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</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>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>ys114321@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>yhs@ubuntu:~/work/iproute2/examples/bpf$ cat bug.c
#include "bpf_api.h"
__section_cls_entry
int imain(struct __sk_buff *skb)
{
int rand = get_prandom_u32();
skb->tc_classid = (((rand % 2) == 0) ? (rand % 15) : 15);
printt("XXX 1st layer minor: %d\n", skb->tc_classid);
return TC_ACT_OK;
}
BPF_LICENSE("GPL");
yhs@ubuntu:~/work/iproute2/examples/bpf$ clang -O2
-I/home/yhs/work/iproute2/include -target bpf -c bug.c
fatal error: error in backend: Cannot select: 0x51d1dd0: i64 = sdiv 0x51ce080,
Constant:i64<15>
0x51ce080: i64 = sra 0x51ce010, Constant:i64<32>
0x51ce010: i64 = shl 0x51cdfa0, Constant:i64<32>
0x51cdfa0: i64,ch,glue = CopyFromReg 0x51cdec0, Register:i64 %R0,
0x51cdec0:1
0x51cdf30: i64 = Register %R0
0x51cdec0: ch,glue = callseq_end 0x51cde50, TargetConstant:i64<0>,
TargetConstant:i64<0>, 0x51cde50:1
0x51cdd70: i64 = TargetConstant<0>
0x51cdd70: i64 = TargetConstant<0>
0x51cde50: ch,glue = BPFISD::CALL 0x51cdde0, Constant:i64<7>
0x51cdd00: i64 = Constant<7>
0x51d1c10: i64 = Constant<32>
0x51d1c10: i64 = Constant<32>
0x51ce780: i64 = Constant<15>
In function: imain
clang-3.9: error: clang frontend command failed with exit code 70 (use -v to
see invocation)
clang version 3.9.0 (<a href="http://llvm.org/git/clang.git">http://llvm.org/git/clang.git</a>
309b96c687b008fd6c9c4824bfd9f35c5e777bec) (<a href="http://llvm.org/git/llvm.git">http://llvm.org/git/llvm.git</a>
031194de74acdaeb977562e80207b76f57263fad)
Target: bpf
Thread model: posix
InstalledDir: /home/yhs/work/llvm/build/install/bin
clang-3.9: note: diagnostic msg: PLEASE submit a bug report to
<a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> and include the crash backtrace, preprocessed source, and
associated run script.
clang-3.9: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-3.9: note: diagnostic msg: /tmp/bug-64ca72.c
clang-3.9: note: diagnostic msg: /tmp/bug-64ca72.sh
clang-3.9: note: diagnostic msg:
********************
yhs@ubuntu:~/work/iproute2/examples/bpf$
Just from error message itself, it not clear what users should do to resolve
the issue.
If we have message issued from compiler like below:
Error: Unsupport signed division for DAG:
0x51d1dd0: i64 = sdiv 0x51ce080, Constant:i64<15>
Users will know that signed division is not supported in BPF backend and they
may need to tweak their codes.</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>