[llvm-bugs] [Bug 26976] New: Obscure error message when BPF target fails compilation

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Mar 17 10:13:43 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=26976

            Bug ID: 26976
           Summary: Obscure error message when BPF target fails
                    compilation
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: ys114321 at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

yhs at 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 at 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 (http://llvm.org/git/clang.git
309b96c687b008fd6c9c4824bfd9f35c5e777bec) (http://llvm.org/git/llvm.git
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
http://llvm.org/bugs/ 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 at 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.

-- 
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/20160317/68fda00c/attachment.html>


More information about the llvm-bugs mailing list