bpf: Generate BTF_KIND_FLOAT when linking vmlinux
PATCH v2 1/1 bpf: Generate BTF_KIND_FLOAT when linking vmlinux
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/[email protected]/
--- scripts/link-vmlinux.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
scripts/link-vmlinux.sh +6 -1
@@ -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
Signature · 1 line
2.29.2
Quoted 26 lines · 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.shto pass this flag to pahole in case it's supported, which is determined using a simple version check.[1] https://lore.kernel.org/dwarves/[email protected]/
Signed-off-by Ilya Leoshkevich <[email protected]>---
scripts/link-vmlinux.sh | 7 ++++++-1 file changed, 6 insertions(+), 1 deletion(-)scripts/link-vmlinux.sh +0
-0@@ -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
+
Quoted 8 lines
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_ALLOCbecause .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/[email protected]/
v1 -> v2: Use a version check instead of probing.
Quoted 11 lines · 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.shto pass this flag to pahole in case it's supported, which is determined using a simple version check.[1] https://lore.kernel.org/dwarves/[email protected]/
Signed-off-by Ilya Leoshkevich <[email protected]>---
few nits below, but otherwise looks good:
scripts/link-vmlinux.sh gen_btf() · line 230
Quoted 12 lines
scripts/link-vmlinux.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)scripts/link-vmlinux.sh +1
-0@@ -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?
scripts/link-vmlinux.sh gen_btf() · line 236
Quoted 7 lines
scripts/link-vmlinux.sh +5
-1+ 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
Quoted 6 lines
scripts/link-vmlinux.sh +0
-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