linux - 使用-O0 编译linux kernel (4.4) bpf samples 导致错误

标签 linux linux-kernel clang llvm-clang

如果我从 linux 内核编译 samples/bpf/并将优化更改为 -O0,我会收到以下错误。尽管使用 -O2(Makefile 中的默认设置)工作正常。

谁能解释一下这里出了什么问题。

$ make samples/bpf/

[...]

clang  -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/4.9/include -I./arch/x86/include -Iarch/x86/include/generated/uapi -Iarch/x86/include/generated  -Iinclude -I./arch/x86/include/uapi -Iarch/x86/include/generated/uapi -I./include/uapi -Iinclude/generated/uapi -include ./include/linux/kconfig.h  \
    -D__KERNEL__ -Wno-unused-value -Wno-pointer-sign \
    -O0 -emit-llvm -c samples/bpf/tracex1_kern.c -o -| /home/ravi/bin/llc -march=bpf -filetype=obj -o samples/bpf/tracex1_kern.o
LLVM ERROR: Cannot select: t12: ch,glue = BPFISD::CALL t11, t6, Register:i64 %R1, t11:1
  t6: i64,ch = load<LD8[getelementptr inbounds (%struct.smp_ops, %struct.smp_ops* @smp_ops, i32 0, i32 3)]> t0, t3, undef:i64
    t3: i64 = add t16, Constant:i64<24>
      t16: i64 = BPFISD::Wrapper TargetGlobalAddress:i64<%struct.smp_ops* @smp_ops> 0
        t15: i64 = TargetGlobalAddress<%struct.smp_ops* @smp_ops> 0
      t2: i64 = Constant<24>
    t5: i64 = undef
  t10: i64 = Register %R1
  t11: ch,glue = CopyToReg t9, Register:i64 %R1, Constant:i64<0>
    t10: i64 = Register %R1
    t4: i64 = Constant<0>
In function: smp_send_stop
samples/bpf/Makefile:66: recipe for target 'samples/bpf/tracex1_kern.o' failed
make[1]: *** [samples/bpf/tracex1_kern.o] Error 1
Makefile:1544: recipe for target 'samples/bpf/' failed
make: *** [samples/bpf/] Error 2

最佳答案

这是 BPF 端口中的错误。请在 llvm.org 上提交错误并附上复制说明。谢谢!

关于linux - 使用-O0 编译linux kernel (4.4) bpf samples 导致错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34702879/

相关文章:

C++ clang链接器问题

c++ - 是否允许编译器优化堆内存分配?

java - JavaFX 应用程序中的 iFrame 在 Linux 上运行时不加载某些页面

Linux 分段

linux-kernel - 如何修改未编译为模块的 Linux 内核驱动程序?

linux-kernel - 物理/逻辑/虚拟内存地址之间的差异

ubuntu - clang 4.0 无法在 ubuntu 17.04 上构建 clang 3.42

linux - awk 后续行之间的区别

linux - lpsolve库动态链接

linux - 在 Oracle Enterprise Linux 上安装 Net::LDAP 时出错