Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bcc: Add some basic support for MIPS
In order to fix the following errors when running bpf program on the MIPS Loongson64 platform, add some basic support, with this patch, running hello_world.py can get the expected result. root@linux:/home/loongson/bcc# python examples/hello_world.py In file included from <built-in>:3: In file included from /virtual/include/bcc/helpers.h:51: In file included from include/uapi/linux/if_packet.h:5: arch/mips/include/uapi/asm/byteorder.h:17:3: error: "MIPS, but neither __MIPSEB__, nor __MIPSEL__???" # error "MIPS, but neither __MIPSEB__, nor __MIPSEL__???" ^ In file included from <built-in>:3: In file included from /virtual/include/bcc/helpers.h:53: In file included from include/linux/log2.h:12: In file included from include/linux/bitops.h:32: In file included from arch/mips/include/asm/bitops.h:19: In file included from arch/mips/include/asm/barrier.h:11: arch/mips/include/asm/addrspace.h:13:10: fatal error: 'spaces.h' file not found #include <spaces.h> ^~~~~~~~~~ 2 errors generated. Traceback (most recent call last): File "examples/hello_world.py", line 12, in <module> BPF(text='int kprobe__sys_clone(void *ctx) { bpf_trace_printk("Hello, World!\\n"); return 0; }').trace_print() File "/usr/lib/python2.7/site-packages/bcc/__init__.py", line 364, in __init__ raise Exception("Failed to compile BPF module %s" % (src_file or "<text>")) Exception: Failed to compile BPF module <text> root@linux:/home/loongson/bcc# python examples/hello_world.py In file included from <built-in>:3: In file included from /virtual/include/bcc/helpers.h:53: In file included from include/linux/log2.h:12: In file included from include/linux/bitops.h:32: arch/mips/include/asm/bitops.h:101:3: error: invalid output constraint '+ZC' in asm __bit_op(*m, __INS "%0, %3, %2, 1", "i"(bit), "r"(~0)); ^ arch/mips/include/asm/bitops.h:40:19: note: expanded from macro '__bit_op' : "=&r"(__temp), "+" GCC_OFF_SMALL_ASM()(mem) \ ^ [...] arch/mips/include/asm/atomic.h:154:1: error: invalid output constraint '+ZC' in asm arch/mips/include/asm/atomic.h:151:2: note: expanded from macro 'ATOMIC_OPS' ATOMIC_FETCH_OP(pfx, op, type, c_op, asm_op, ll, sc) ^ arch/mips/include/asm/atomic.h:141:4: note: expanded from macro 'ATOMIC_FETCH_OP' "+" GCC_OFF_SMALL_ASM() (v->counter) \ ^ fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated. Traceback (most recent call last): File "examples/hello_world.py", line 12, in <module> BPF(text='int kprobe__sys_clone(void *ctx) { bpf_trace_printk("Hello, World!\\n"); return 0; }').trace_print() File "/usr/lib/python2.7/site-packages/bcc/__init__.py", line 364, in __init__ raise Exception("Failed to compile BPF module %s" % (src_file or "<text>")) Exception: Failed to compile BPF module <text> Signed-off-by: Tiezhu Yang <[email protected]>
- Loading branch information