diff options
author | David Daney <david.daney@cavium.com> | 2017-06-14 01:49:38 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-06-14 21:03:23 +0200 |
commit | 4b7190e8416d9238e995da993a7fb851996654e2 (patch) | |
tree | cd9223768849c8dc218787198acdc37d4ba2dc17 /samples/bpf/Makefile | |
parent | bpf: Add MIPS support to samples/bpf. (diff) | |
download | linux-4b7190e8416d9238e995da993a7fb851996654e2.tar.xz linux-4b7190e8416d9238e995da993a7fb851996654e2.zip |
samples/bpf: Fix tracex5 to work with MIPS syscalls.
There are two problems:
1) In MIPS the __NR_* macros expand to an expression, this causes the
sections of the object file to be named like:
.
.
.
[ 5] kprobe/(5000 + 1) PROGBITS 0000000000000000 000160 ...
[ 6] kprobe/(5000 + 0) PROGBITS 0000000000000000 000258 ...
[ 7] kprobe/(5000 + 9) PROGBITS 0000000000000000 000348 ...
.
.
.
The fix here is to use the "asm_offsets" trick to evaluate the macros
in the C compiler and generate a header file with a usable form of the
macros.
2) MIPS syscall numbers start at 5000, so we need a bigger map to hold
the sub-programs.
Signed-off-by: David Daney <david.daney@cavium.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'samples/bpf/Makefile')
-rw-r--r-- | samples/bpf/Makefile | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 6c7468eb3684..a0561dc762fe 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile @@ -160,6 +160,17 @@ clean: $(MAKE) -C ../../ M=$(CURDIR) clean @rm -f *~ +$(obj)/syscall_nrs.s: $(src)/syscall_nrs.c + $(call if_changed_dep,cc_s_c) + +$(obj)/syscall_nrs.h: $(obj)/syscall_nrs.s FORCE + $(call filechk,offsets,__SYSCALL_NRS_H__) + +clean-files += syscall_nrs.h + +FORCE: + + # Verify LLVM compiler tools are available and bpf target is supported by llc .PHONY: verify_cmds verify_target_bpf $(CLANG) $(LLC) @@ -180,6 +191,8 @@ verify_target_bpf: verify_cmds $(src)/*.c: verify_target_bpf +$(obj)/tracex5_kern.o: $(obj)/syscall_nrs.h + # asm/sysreg.h - inline assembly used by it is incompatible with llvm. # But, there is no easy way to fix it, so just exclude it since it is # useless for BPF samples. |