[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzZ+e4vnW7Gconhq3AJ5od=TULAZC=-+UANFDGXcWCoOSA@mail.gmail.com>
Date: Tue, 26 Nov 2019 14:30:31 -0800
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Stanislav Fomichev <sdf@...gle.com>
Cc: Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
"David S. Miller" <davem@...emloft.net>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>
Subject: Re: [PATCH bpf] bpf: support pre-2.25-binutils objcopy for vmlinux BTF
On Tue, Nov 26, 2019 at 9:56 AM Stanislav Fomichev <sdf@...gle.com> wrote:
>
> 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.
>
> Fixes: 341dfcf8d78ea ("btf: expose BTF info through sysfs")
> Signed-off-by: Stanislav Fomichev <sdf@...gle.com>
> ---
Looks good, still works for me :)
Tested-by: Andrii Nakryiko <andriin@...com>
> scripts/link-vmlinux.sh | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
> index 06495379fcd8..c56ba91f52b0 100755
> --- a/scripts/link-vmlinux.sh
> +++ b/scripts/link-vmlinux.sh
> @@ -127,7 +127,8 @@ gen_btf()
> cut -d, -f1 | cut -d' ' -f2)
> bin_format=$(LANG=C ${OBJDUMP} -f ${1} | grep 'file format' | \
> awk '{print $4}')
> - ${OBJCOPY} --dump-section .BTF=.btf.vmlinux.bin ${1} 2>/dev/null
> + ${OBJCOPY} --set-section-flags .BTF=alloc -O binary \
> + --only-section=.BTF ${1} .btf.vmlinux.bin 2>/dev/null
> ${OBJCOPY} -I binary -O ${bin_format} -B ${bin_arch} \
> --rename-section .data=.BTF .btf.vmlinux.bin ${2}
> }
> --
> 2.24.0.432.g9d3f5f5b63-goog
>
Powered by blists - more mailing lists