aboutsummaryrefslogtreecommitdiff
path: root/drivers/ntb
diff options
context:
space:
mode:
authorKumar Kartikeya Dwivedi2021-10-28 12:04:56 +0530
committerAlexei Starovoitov2021-10-28 16:30:06 -0700
commit585a3571981d8a93e2211e1ac835d31a63e68cd8 (patch)
tree89ea558bbaa738c733171c0f9093fe4ec6bc7252 /drivers/ntb
parentc24941cd3766b6de682dbe6809bd6af12271ab5b (diff)
libbpf: Add weak ksym support to gen_loader
This extends existing ksym relocation code to also support relocating weak ksyms. Care needs to be taken to zero out the src_reg (currently BPF_PSEUOD_BTF_ID, always set for gen_loader by bpf_object__relocate_data) when the BTF ID lookup fails at runtime. This is not a problem for libbpf as it only sets ext->is_set when BTF ID lookup succeeds (and only proceeds in case of failure if ext->is_weak, leading to src_reg remaining as 0 for weak unresolved ksym). A pattern similar to emit_relo_kfunc_btf is followed of first storing the default values and then jumping over actual stores in case of an error. For src_reg adjustment, we also need to perform it when copying the populated instruction, so depending on if copied insn[0].imm is 0 or not, we decide to jump over the adjustment. We cannot reach that point unless the ksym was weak and resolved and zeroed out, as the emit_check_err will cause us to jump to cleanup label, so we do not need to recheck whether the ksym is weak before doing the adjustment after copying BTF ID and BTF FD. This is consistent with how libbpf relocates weak ksym. Logging statements are added to show the relocation result and aid debugging. Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20211028063501.2239335-4-memxor@gmail.com
Diffstat (limited to 'drivers/ntb')
0 files changed, 0 insertions, 0 deletions