FYI,

I'm observing more instruction reordering with >=3.9 as compared to
3.8 for the same code. You might need the following fix:

http://git.kernel.org/cgit/linux/kernel/git/davem/net-next.git/commit/?id=57a09bf0a416700676e77102c28f9cfcb48267e0

On Sun, Oct 23, 2016 at 4:35 PM, William Tu via iovisor-dev
<[email protected]> wrote:
> Thanks! I upgrade LLVM to 4.0.0 and this error no longer shows up.
> William
>
> On Sat, Oct 22, 2016 at 8:33 AM, Alexei Starovoitov
> <[email protected]> wrote:
>> On Fri, Oct 21, 2016 at 11:38 PM, William Tu via iovisor-dev
>> <[email protected]> wrote:
>>> Hi,
>>> I'm running into this LLVM ERROR at compile time. Does anyone seem
>>> this before or can give me some suggestions? thanks!
>>>
>>> -------
>>> LLVM ERROR: Cannot select: 0x3bafa28: ch = brind 0x3bc98f0:1,
>>> 0x3bc98f0 [ORD=1] [ID=9]
>>>   0x3bc98f0: i64,ch = load 0x3bb0db0:1, 0x3baf588,
>>> 0x3bc8c58<LD8[JumpTable]> [ORD=1] [ID=8]
>>>     0x3baf588: i64 = add 0x3bade48, 0x3bb06c0 [ORD=1] [ID=7]
>>>       0x3bade48: i64 = shl 0x3bb0db0, 0x3bb0470 [ORD=1] [ID=6]
>>>         0x3bb0db0: i64,ch = CopyFromReg 0x3b78a00, 0x3bad2b8 [ORD=1] [ID=5]
>>>           0x3bad2b8: i64 = Register %vreg1 [ID=1]
>>>         0x3bb0470: i64 = Constant<3> [ID=4]
>>>       0x3bb06c0: i64 = JumpTable<0> [ID=2]
>>>     0x3bc8c58: i64 = Constant<0> [ID=3]
>>> In function: main_proto
>>> samples/bpf/Makefile:128: recipe for target 'samples/bpf/sockex3_kern.o' 
>>> failed
>>>
>>> My C code is below:
>>> ----------------------------------
>>> SEC("socket/0")
>>> static int main_proto(struct __sk_buff *skb)
>>> {
>>>     u32 proto2 = skb->cb[1];
>>>     switch (proto2) {
>>>     case 0:
>>>         skb->cb[2]= 0;
>>>         break;
>>>     case 1:
>>>         skb->cb[2]= 1;
>>>         break;
>>>     case 2:
>>>         skb->cb[2]= 2;
>>>         break;
>>>     case 3:
>>>         skb->cb[2]= 3;
>>>         break;
>>>     default:
>>>         break;
>>>     }
>>>     return 0;
>>> }
>>>
>>> I found that removing "case 3" will prevent the error, but then I
>>> could only have 3 cases.
>>> [root@vm-dev bpf]# clang --version
>>> clang version 3.7.0 (tags/RELEASE_370/final)
>>> [root@vm-dev lib]# llc --version
>>> LLVM (http://llvm.org/):
>>>   LLVM version 3.7.0
>>
>> 3.7.0 has several known bugs. Please upgrade to 3.7.1 or higher.
>> jumptable should have been converted to branches by backend...
> _______________________________________________
> iovisor-dev mailing list
> [email protected]
> https://lists.iovisor.org/mailman/listinfo/iovisor-dev
_______________________________________________
iovisor-dev mailing list
[email protected]
https://lists.iovisor.org/mailman/listinfo/iovisor-dev

Reply via email to