[PATCH bpf v1 0/2] bpf: Fix linker optimization removing kfuncs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch series fixes unwanted stripping of kernel kfuncs during linker
optimization, as indicated by build warnings from resolve_btfids e.g.
"WARN: resolve_btfids: unresolved symbol ...". This can happen because the
__bpf_kfunc macro annotating kfunc declarations is ignored during linking.

Patch 1 adds support for the compiler attribute "__retain__", used to
avoid linker garbage cleanup. Patch 2 then updates __bpf_kfunc to use this
attribute when LTO builds are enabled.


Tony Ambardar (2):
  Compiler Attributes: Add __retain macro
  bpf: Harden __bpf_kfunc tag against linker kfunc removal

 include/linux/btf.h                 |  2 +-
 include/linux/compiler_attributes.h | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

-- 
2.34.1





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux