Re: [PATCH v4 dwarves] btf: Add support for the floating-point types

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

 



On Wed, Mar 10, 2021 at 12:16 PM Ilya Leoshkevich <iii@xxxxxxxxxxxxx> wrote:
>
> Some BPF programs compiled on s390 fail to load, because s390
> arch-specific linux headers contain float and double types.
>
> Fix as follows:
>
> - Make the DWARF loader fill base_type.float_type.
>
> - Introduce the --btf_gen_floats command-line parameter, so that
>   pahole could be used to build both the older and the newer kernels.
>
> - libbpf introduced the support for the floating-point types in commit
>   986962fade5, so update the libbpf submodule to that version and use
>   the new btf__add_float() function in order to emit the floating-point
>   types when not in the compatibility mode.
>
> - Make the BTF loader recognize the new BTF kind.
>
> Example of the resulting entry in the vmlinux BTF:
>
>     [7164] FLOAT 'double' size=8
>
> when building with:
>
>     LLVM_OBJCOPY=${OBJCOPY} ${PAHOLE} -J ${1} --btf_gen_floats
>
> Signed-off-by: Ilya Leoshkevich <iii@xxxxxxxxxxxxx>
> ---

So it looks good to me overall, but here's the question about using
this --btf-gen-floats flag from link-vmlinux.sh script. If you specify
that flag for an old pahole, it will probably error out, right? So
that means we'll need to do feature detection for pahole supported
features, right?..

>
> v1: https://lore.kernel.org/dwarves/20210306022203.152930-1-iii@xxxxxxxxxxxxx/
> v1 -> v2: Introduce libbpf compatibility level command-line parameter.
>           The code should now work for both bpf-next/master and
>           v5.12-rc2.
>
> v2: https://lore.kernel.org/dwarves/20210308235913.162038-1-iii@xxxxxxxxxxxxx/
> v2 -> v3: Use the feature flag (--encode_btf_kind_float) instead of the
>           libbpf version flag.
>
> v3: https://lore.kernel.org/dwarves/20210310141517.169698-1-iii@xxxxxxxxxxxxx/
> v3 -> v4: Rename the flag to --btf_gen_floats.
>
>  btf_loader.c       | 21 +++++++++++++++++++--
>  dwarf_loader.c     | 11 +++++++++++
>  lib/bpf            |  2 +-
>  libbtf.c           | 36 ++++++++++++++++++++++++++++++++++--
>  libbtf.h           |  1 +
>  man-pages/pahole.1 |  5 +++++
>  pahole.c           |  8 ++++++++
>  7 files changed, 79 insertions(+), 5 deletions(-)
>

[...]



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux