bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next v2] bpf: Generate BTF_KIND_FLOAT when linking vmlinux
@ 2021-04-12 21:56 Ilya Leoshkevich
  2021-04-12 21:59 ` Ilya Leoshkevich
  2021-04-13  3:18 ` Andrii Nakryiko
  0 siblings, 2 replies; 3+ messages in thread
From: Ilya Leoshkevich @ 2021-04-12 21:56 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Arnaldo Carvalho de Melo
  Cc: bpf, Heiko Carstens, Vasily Gorbik, Ilya Leoshkevich

pahole v1.21 supports the --btf_gen_floats flag, which makes it
generate the information about the floating-point types [1].

Adjust link-vmlinux.sh to pass this flag to pahole in case it's
supported, which is determined using a simple version check.

[1] https://lore.kernel.org/dwarves/YHRiXNX1JUF2Az0A@kernel.org/

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
 scripts/link-vmlinux.sh | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index 3b261b0f74f0..392c7fb94d3e 100755
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -227,8 +227,13 @@ gen_btf()
 
 	vmlinux_link ${1}
 
+	local extra_paholeopt=
+	if [ "${pahole_ver}" -ge "121" ]; then
+		extra_paholeopt="${extra_paholeopt} --btf_gen_floats"
+	fi
+
 	info "BTF" ${2}
-	LLVM_OBJCOPY=${OBJCOPY} ${PAHOLE} -J ${1}
+	LLVM_OBJCOPY=${OBJCOPY} ${PAHOLE} -J${extra_paholeopt} ${1}
 
 	# Create ${2} which contains just .BTF section but no symbols. Add
 	# SHF_ALLOC because .BTF will be part of the vmlinux image. --strip-all
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH bpf-next v2] bpf: Generate BTF_KIND_FLOAT when linking vmlinux
  2021-04-12 21:56 [PATCH bpf-next v2] bpf: Generate BTF_KIND_FLOAT when linking vmlinux Ilya Leoshkevich
@ 2021-04-12 21:59 ` Ilya Leoshkevich
  2021-04-13  3:18 ` Andrii Nakryiko
  1 sibling, 0 replies; 3+ messages in thread
From: Ilya Leoshkevich @ 2021-04-12 21:59 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Arnaldo Carvalho de Melo
  Cc: bpf, Heiko Carstens, Vasily Gorbik

On Mon, 2021-04-12 at 23:56 +0200, Ilya Leoshkevich wrote:
> pahole v1.21 supports the --btf_gen_floats flag, which makes it
> generate the information about the floating-point types [1].
> 
> Adjust link-vmlinux.sh to pass this flag to pahole in case it's
> supported, which is determined using a simple version check.
> 
> [1] https://lore.kernel.org/dwarves/YHRiXNX1JUF2Az0A@kernel.org/
> 
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> ---
>  scripts/link-vmlinux.sh | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
> index 3b261b0f74f0..392c7fb94d3e 100755
> --- a/scripts/link-vmlinux.sh
> +++ b/scripts/link-vmlinux.sh
> @@ -227,8 +227,13 @@ gen_btf()
>  
>         vmlinux_link ${1}
>  
> +       local extra_paholeopt=
> +       if [ "${pahole_ver}" -ge "121" ]; then
> +               extra_paholeopt="${extra_paholeopt} --btf_gen_floats"
> +       fi
> +
>         info "BTF" ${2}
> -       LLVM_OBJCOPY=${OBJCOPY} ${PAHOLE} -J ${1}
> +       LLVM_OBJCOPY=${OBJCOPY} ${PAHOLE} -J${extra_paholeopt} ${1}
>  
>         # Create ${2} which contains just .BTF section but no symbols.
> Add
>         # SHF_ALLOC because .BTF will be part of the vmlinux image. --
> strip-all

Sorry, I realized I forgot to add a changelog (it's trivial, but
still). Posting it here:

v1:
https://lore.kernel.org/bpf/20210331014356.256212-1-iii@linux.ibm.com/
v1 -> v2: Use a version check instead of probing.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH bpf-next v2] bpf: Generate BTF_KIND_FLOAT when linking vmlinux
  2021-04-12 21:56 [PATCH bpf-next v2] bpf: Generate BTF_KIND_FLOAT when linking vmlinux Ilya Leoshkevich
  2021-04-12 21:59 ` Ilya Leoshkevich
@ 2021-04-13  3:18 ` Andrii Nakryiko
  1 sibling, 0 replies; 3+ messages in thread
From: Andrii Nakryiko @ 2021-04-13  3:18 UTC (permalink / raw)
  To: Ilya Leoshkevich
  Cc: Alexei Starovoitov, Daniel Borkmann, Arnaldo Carvalho de Melo,
	bpf, Heiko Carstens, Vasily Gorbik

On Mon, Apr 12, 2021 at 2:56 PM Ilya Leoshkevich <iii@linux.ibm.com> wrote:
>
> pahole v1.21 supports the --btf_gen_floats flag, which makes it
> generate the information about the floating-point types [1].
>
> Adjust link-vmlinux.sh to pass this flag to pahole in case it's
> supported, which is determined using a simple version check.
>
> [1] https://lore.kernel.org/dwarves/YHRiXNX1JUF2Az0A@kernel.org/
>
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> ---

few nits below, but otherwise looks good:

Acked-by: Andrii Nakryiko <andrii@kernel.org>

>  scripts/link-vmlinux.sh | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
> index 3b261b0f74f0..392c7fb94d3e 100755
> --- a/scripts/link-vmlinux.sh
> +++ b/scripts/link-vmlinux.sh
> @@ -227,8 +227,13 @@ gen_btf()
>
>         vmlinux_link ${1}
>
> +       local extra_paholeopt=

let's keep variables together, can you move it up to `local
pahole_ver` above? btw, does it need `=`, or `local paholeopt` will
just create it as an empty variable?

> +       if [ "${pahole_ver}" -ge "121" ]; then
> +               extra_paholeopt="${extra_paholeopt} --btf_gen_floats"
> +       fi
> +
>         info "BTF" ${2}
> -       LLVM_OBJCOPY=${OBJCOPY} ${PAHOLE} -J ${1}
> +       LLVM_OBJCOPY=${OBJCOPY} ${PAHOLE} -J${extra_paholeopt} ${1}

it looks weird that there is no space between -J and $extra_paholeopt,
why complicating things? extra space isn't a big deal in command
invocation, imo

>
>         # Create ${2} which contains just .BTF section but no symbols. Add
>         # SHF_ALLOC because .BTF will be part of the vmlinux image. --strip-all
> --
> 2.29.2
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-13  3:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-12 21:56 [PATCH bpf-next v2] bpf: Generate BTF_KIND_FLOAT when linking vmlinux Ilya Leoshkevich
2021-04-12 21:59 ` Ilya Leoshkevich
2021-04-13  3:18 ` Andrii Nakryiko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).