bpf: make sure CO-RE relocs are typed with struct BTF_KIND_STRUCT
Based on observation within bpf-next selftests and comparisson of GCC and clang compiled code, the BPF loader expects all CO-RE relocations to point to BTF non const and non volatile type nodes. gcc/ChangeLog: * btfout.cc (get_btf_kind): Remove static from function definition. * config/bpf/btfext-out.cc (bpf_code_reloc_add): Check if CO-RE type is not a const or volatile. * ctfc.h (btf_dtd_kind): Add prototype for function. gcc/testsuite/ChangeLog: * gcc.target/bpf/core-attr-const.c: New test.
Showing
- gcc/btfout.cc 1 addition, 1 deletiongcc/btfout.cc
- gcc/config/bpf/btfext-out.cc 7 additions, 0 deletionsgcc/config/bpf/btfext-out.cc
- gcc/ctfc.h 2 additions, 0 deletionsgcc/ctfc.h
- gcc/testsuite/gcc.target/bpf/core-attr-const.c 40 additions, 0 deletionsgcc/testsuite/gcc.target/bpf/core-attr-const.c
Loading
Please register or sign in to comment