]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Support pre-2.25-binutils objcopy for vmlinux BTF
authorStanislav Fomichev <sdf@google.com>
Wed, 27 Nov 2019 16:14:10 +0000 (08:14 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Jan 2020 18:48:41 +0000 (19:48 +0100)
commit22507bd81f12726853a46b3368cadc44ce15ab47
treeef2aed25519746fb7072132fa2ee455acaa454f6
parent7ca574d43df42ea05f10966aae71eb4f25fb449e
bpf: Support pre-2.25-binutils objcopy for vmlinux BTF

commit 39b430ecde158a3416ffc5dfd4a19e1ae71120b4 upstream.

If vmlinux BTF generation fails, but CONFIG_DEBUG_INFO_BTF is set,
.BTF section of vmlinux is empty and kernel will prohibit
BPF loading and return "in-kernel BTF is malformed".

--dump-section argument to binutils' objcopy was added in version 2.25.
When using pre-2.25 binutils, BTF generation silently fails. Convert
to --only-section which is present on pre-2.25 binutils.

Documentation/process/changes.rst states that binutils 2.21+
is supported, not sure those standards apply to BPF subsystem.

v2:
* exit and print an error if gen_btf fails (John Fastabend)

v3:
* resend with Andrii's Acked-by/Tested-by tags

Fixes: 5190c09f08a1e ("btf: expose BTF info through sysfs")
Signed-off-by: Stanislav Fomichev <sdf@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Tested-by: Andrii Nakryiko <andriin@fb.com>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Cc: John Fastabend <john.fastabend@gmail.com>
Link: https://lore.kernel.org/bpf/20191127161410.57327-1-sdf@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
scripts/link-vmlinux.sh