Em Tue, Jun 12, 2018 at 05:31:24PM -0300, Arnaldo Carvalho de Melo escreveu: > Em Thu, Jun 07, 2018 at 01:07:01PM -0700, Martin KaFai Lau escreveu: > > On Thu, Jun 07, 2018 at 04:30:29PM -0300, Arnaldo Carvalho de Melo wrote: > > > So this must be available in a newer llvm version? Which one? > > > I should have put in the details in my last email or > > in the commit message, my bad. > > > 1. The tools/testing/selftests/bpf/Makefile has the CLANG_FLAGS and > > LLC_FLAGS needed to compile the bpf prog. It requires a new > > "-mattr=dwarf" llc option which was added to the future > > llvm 7.0.
> [root@jouet bpf]# pahole hello.o > struct clang version 5.0.1 (tags/RELEASE_501/final) { > clang version 5.0.1 (tags/RELEASE_501/final) clang version 5.0.1 > (tags/RELEASE_501/final); /* 0 4 */ > clang version 5.0.1 (tags/RELEASE_501/final) clang version 5.0.1 > (tags/RELEASE_501/final); /* 4 4 */ > clang version 5.0.1 (tags/RELEASE_501/final) clang version 5.0.1 > (tags/RELEASE_501/final); /* 8 4 */ > clang version 5.0.1 (tags/RELEASE_501/final) clang version 5.0.1 > (tags/RELEASE_501/final); /* 12 4 */ > > /* size: 16, cachelines: 1, members: 4 */ > /* last cacheline: 16 bytes */ > }; > [root@jouet bpf]# > > Ok, I guess I saw this case in the llvm/clang git logs, so this one was > generated with the older clang, will regenerate and add that "-mattr=dwarf" > part. [root@jouet bpf]# pahole hello.o struct clang version 7.0.0 (http://llvm.org/git/clang.git 8c873daccce7ee5339b9fd82c81fe02b73543b65) (http://llvm.org/git/llvm.git 98c78e82f54be8fb0bb5f02e3ca674fbde10ef34) { clang version 7.0.0 (http://llvm.org/git/clang.git 8c873daccce7ee5339b9fd82c81fe02b73543b65) (http://llvm.org/git/llvm.git 98c78 clang version 7.0.0 (http://llvm.org/git/clang.git 8c873daccce7ee5339b9fd82c81fe02b73543b65) (http://llvm.org/git/llvm.git 98c78e82f54be8fb0bb5f02e3ca674fbde10ef34); /* 0 4 */ clang version 7.0.0 (http://llvm.org/git/clang.git 8c873daccce7ee5339b9fd82c81fe02b73543b65) (http://llvm.org/git/llvm.git 98c78 clang version 7.0.0 (http://llvm.org/git/clang.git 8c873daccce7ee5339b9fd82c81fe02b73543b65) (http://llvm.org/git/llvm.git 98c78e82f54be8fb0bb5f02e3ca674fbde10ef34); /* 4 4 */ clang version 7.0.0 (http://llvm.org/git/clang.git 8c873daccce7ee5339b9fd82c81fe02b73543b65) (http://llvm.org/git/llvm.git 98c78 clang version 7.0.0 (http://llvm.org/git/clang.git 8c873daccce7ee5339b9fd82c81fe02b73543b65) (http://llvm.org/git/llvm.git 98c78e82f54be8fb0bb5f02e3ca674fbde10ef34); /* 8 4 */ clang version 7.0.0 (http://llvm.org/git/clang.git 8c873daccce7ee5339b9fd82c81fe02b73543b65) (http://llvm.org/git/llvm.git 98c78 clang version 7.0.0 (http://llvm.org/git/clang.git 8c873daccce7ee5339b9fd82c81fe02b73543b65) (http://llvm.org/git/llvm.git 98c78e82f54be8fb0bb5f02e3ca674fbde10ef34); /* 12 4 */ /* size: 16, cachelines: 1, members: 4 */ /* last cacheline: 16 bytes */ }; [root@jouet bpf]# Ideas? [root@jouet bpf]# trace -e open*,hello.c clang-6.0: error: unknown argument: '-mattr=dwarf' ERROR: unable to compile hello.c Hint: Check error message shown above. Hint: You can also pre-compile it into .o using: clang -target bpf -O2 -c hello.c with proper -I and -D options. event syntax error: 'hello.c' \___ Failed to load hello.c from source: Error when compiling BPF scriptlet (add -v to see detail) Run 'perf list' for a list of valid events Usage: perf trace [<options>] [<command>] or: perf trace [<options>] -- <command> [<options>] or: perf trace record [<options>] [<command>] or: perf trace record [<options>] -- <command> [<options>] -e, --event <event> event/syscall selector. use 'perf list' to list available events [root@jouet bpf]# [root@jouet bpf]# trace -v -e open*,hello.c bpf: builtin compilation failed: -95, try external compiler Kernel build dir is set to /lib/modules/4.17.0-rc5/build set env: KBUILD_DIR=/lib/modules/4.17.0-rc5/build unset env: KBUILD_OPTS include option is set to -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/7/include -I/home/acme/git/linux/arch/x86/include -I./arch/x86/include/generated -I/home/acme/git/linux/include -I./include -I/home/acme/git/linux/arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I/home/acme/git/linux/include/uapi -I./include/generated/uapi -include /home/acme/git/linux/include/linux/kconfig.h set env: NR_CPUS=4 set env: LINUX_VERSION_CODE=0x41100 set env: CLANG_EXEC=/usr/local/bin/clang set env: CLANG_OPTIONS=-g -mattr=dwarf set env: KERNEL_INC_OPTIONS= -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/7/include -I/home/acme/git/linux/arch/x86/include -I./arch/x86/include/generated -I/home/acme/git/linux/include -I./include -I/home/acme/git/linux/arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I/home/acme/git/linux/include/uapi -I./include/generated/uapi -include /home/acme/git/linux/include/linux/kconfig.h set env: PERF_BPF_INC_OPTIONS=-I/home/acme/lib/include/perf/bpf set env: WORKING_DIR=/lib/modules/4.17.0-rc5/build set env: CLANG_SOURCE=/home/acme/bpf/hello.c llvm compiling command template: $CLANG_EXEC -D__KERNEL__ -D__NR_CPUS__=$NR_CPUS -DLINUX_VERSION_CODE=$LINUX_VERSION_CODE $CLANG_OPTIONS $KERNEL_INC_OPTIONS $PERF_BPF_INC_OPTIONS -Wno-unused-value -Wno-pointer-sign -working-directory $WORKING_DIR -c "$CLANG_SOURCE" -target bpf -O2 -o - llvm compiling command : /usr/local/bin/clang -D__KERNEL__ -D__NR_CPUS__=4 -DLINUX_VERSION_CODE=0x41100 -g -mattr=dwarf -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/7/include -I/home/acme/git/linux/arch/x86/include -I./arch/x86/include/generated -I/home/acme/git/linux/include -I./include -I/home/acme/git/linux/arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I/home/acme/git/linux/include/uapi -I./include/generated/uapi -include /home/acme/git/linux/include/linux/kconfig.h -I/home/acme/lib/include/perf/bpf -Wno-unused-value -Wno-pointer-sign -working-directory /lib/modules/4.17.0-rc5/build -c /home/acme/bpf/hello.c -target bpf -O2 -o - clang-6.0: error: unknown argument: '-mattr=dwarf' ERROR: unable to compile hello.c Hint: Check error message shown above. Hint: You can also pre-compile it into .o using: clang -target bpf -O2 -c hello.c with proper -I and -D options. event syntax error: 'hello.c' \___ Failed to load hello.c from source: Error when compiling BPF scriptlet