Hi All,
I am trying to build kselftest on Linux-5.4-rc3+ on ubuntu 18.04. I
installed LLVM-9.0.0 and Clang-9.0.0 from below links after following
steps from [1] because of discussion [2]
https://releases.llvm.org/9.0.0/llvm-9.0.0.src.tar.xz
https://releases.llvm.org/9.0.0/clang-tools-extra-9.0.0.src.tar.xz
https://releases.llvm.org/9.0.0/cfe-9.0.0.src.tar.xz
After that I started this error.
make[2]: Leaving directory '/usr/src/tovards/linux/tools/lib/bpf'
(clang -I. -I./include/uapi -I../../../include/uapi
-I/usr/src/tovards/linux/tools/testing/selftests/bpf/../usr/include
-D__TARGET_ARCH_arm64 -idirafter /usr/local/include -idirafter
/usr/local/lib/clang/9.0.0/include -idirafter
/usr/include/aarch64-linux-gnu -idirafter /usr/include
-Wno-compare-distinct-pointer-types -O2 -target bpf -emit-llvm \
-c progs/test_core_reloc_ints.c -o - || echo "clang failed") | \
llc -march=arm64 -mcpu=generic -filetype=obj -o
/usr/src/tovards/linux/tools/testing/selftests/bpf/test_core_reloc_ints.o
progs/test_core_reloc_ints.c:32:6: error: using
builtin_preserve_access_index() without -g
if (BPF_CORE_READ(&out->u8_field, &in->u8_field) ||
^
./bpf_helpers.h:533:10: note: expanded from macro 'BPF_CORE_READ'
__builtin_preserve_access_index(src))
^
progs/test_core_reloc_ints.c:33:6: error: using
builtin_preserve_access_index() without -g
BPF_CORE_READ(&out->s8_field, &in->s8_field) ||
^
./bpf_helpers.h:533:10: note: expanded from macro 'BPF_CORE_READ'
__builtin_preserve_access_index(src))
^
progs/test_core_reloc_ints.c:34:6: error: using
builtin_preserve_access_index() without -g
BPF_CORE_READ(&out->u16_field, &in->u16_field) ||
^
./bpf_helpers.h:533:10: note: expanded from macro 'BPF_CORE_READ'
__builtin_preserve_access_index(src))
^
progs/test_core_reloc_ints.c:35:6: error: using
builtin_preserve_access_index() without -g
BPF_CORE_READ(&out->s16_field, &in->s16_field) ||
^
./bpf_helpers.h:533:10: note: expanded from macro 'BPF_CORE_READ'
__builtin_preserve_access_index(src))
^
progs/test_core_reloc_ints.c:36:6: error: using
builtin_preserve_access_index() without -g
BPF_CORE_READ(&out->u32_field, &in->u32_field) ||
^
./bpf_helpers.h:533:10: note: expanded from macro 'BPF_CORE_READ'
__builtin_preserve_access_index(src))
^
progs/test_core_reloc_ints.c:37:6: error: using
builtin_preserve_access_index() without -g
BPF_CORE_READ(&out->s32_field, &in->s32_field) ||
^
./bpf_helpers.h:533:10: note: expanded from macro 'BPF_CORE_READ'
__builtin_preserve_access_index(src))
^
progs/test_core_reloc_ints.c:38:6: error: using
builtin_preserve_access_index() without -g
BPF_CORE_READ(&out->u64_field, &in->u64_field) ||
^
./bpf_helpers.h:533:10: note: expanded from macro 'BPF_CORE_READ'
__builtin_preserve_access_index(src))
^
progs/test_core_reloc_ints.c:39:6: error: using
builtin_preserve_access_index() without -g
BPF_CORE_READ(&out->s64_field, &in->s64_field))
^
./bpf_helpers.h:533:10: note: expanded from macro 'BPF_CORE_READ'
__builtin_preserve_access_index(src))
^
8 errors generated.
llc: error: llc: <stdin>:1:1: error: expected top-level entity
clang failed
In order to solve this error, I modifed bpf/Makefile as
CLANG_CFLAGS = $(CLANG_SYS_INCLUDES) \
- -Wno-compare-distinct-pointer-types
+ -Wno-compare-distinct-pointer-types -g
Now I am getting this error
(clang -I. -I./include/uapi -I../../../include/uapi
-I/usr/src/tovards/linux/tools/testing/selftests/bpf/../usr/include
-D__TARGET_ARCH_arm64 -idirafter /usr/local/include -idirafter
/usr/local/lib/clang/9.0.0/include -idirafter
/usr/include/aarch64-linux-gnu -idirafter /usr/include
-Wno-compare-distinct-pointer-types -g -O2 -target bpf -emit-llvm \
-c progs/test_core_reloc_ints.c -o - || echo "clang failed") | \
llc -march=arm64 -mcpu=generic -filetype=obj -o
/usr/src/tovards/linux/tools/testing/selftests/bpf/test_core_reloc_ints.o
LLVM ERROR: Cannot select: intrinsic %llvm.preserve.struct.access.index
Makefile:267: recipe for target
'/usr/src/tovards/linux/tools/testing/selftests/bpf/test_core_reloc_ints.o'
failed
make[1]: ***
[/usr/src/tovards/linux/tools/testing/selftests/bpf/test_core_reloc_ints.o]
Error 1
Please suggest!!
--prabhakar(pk)
[1]
https://stackoverflow.com/questions/47255526/how-to-build-the-latest-clang-tidy
[2] https://www.mail-archive.com/netdev@xxxxxxxxxxxxxxx/msg315096.html
Linux top-commit
----------------
commit bc88f85c6c09306bd21917e1ae28205e9cd775a7 (HEAD -> master,
origin/master, origin/HEAD)
Author: Ben Dooks <ben.dooks@xxxxxxxxxxxxxxx>
Date: Wed Oct 16 12:24:58 2019 +0100
kthread: make __kthread_queue_delayed_work static
The __kthread_queue_delayed_work is not exported so
make it static, to avoid the following sparse warning:
kernel/kthread.c:869:6: warning: symbol
'__kthread_queue_delayed_work' was not declared. Should it be static?
Signed-off-by: Ben Dooks <ben.dooks@xxxxxxxxxxxxxxx>
Signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>