bpf: Generate BTF_KIND_FLOAT when linking vmlinux
PATCH 1/1 bpf: Generate BTF_KIND_FLOAT when linking vmlinux
pahole v1.21 will support the --btf_gen_floats flag, which makes it generate the information about the floating-point types.
Adjust link-vmlinux.sh to pass this flag to pahole in case it's supported. Whether or not this flag is supported is determined by probing, which is chosen over version check for two reasons:
1) at this moment --btf_gen_floats exists only in master, which identifies itself as v1.20.
2) distros may backport features, making the version check too conservative.
--- 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 paholeopt=-J + if ${PAHOLE} --btf_gen_floats --help >/dev/null 2>&1; then + paholeopt="${paholeopt} --btf_gen_floats" + fi + info "BTF" ${2} - LLVM_OBJCOPY=${OBJCOPY} ${PAHOLE} -J ${1} + LLVM_OBJCOPY=${OBJCOPY} ${PAHOLE} ${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 4 lines · Ilya Leoshkevich
pahole v1.21 will support the --btf_gen_floats flag, which makes it generate the information about the floating-point types.
Quoted 9 lines
Adjust
link-vmlinux.shto pass this flag to pahole in case it's supported. Whether or not this flag is supported is determined by probing, which is chosen over version check for two reasons:1) at this moment --btf_gen_floats exists only in master, which identifies itself as v1.20.
2) distros may backport features, making the version check too conservative.
Does anyone really cherry-pick and backport pahole patches, though? So far we've been using strictly version checks for pahole (1.13, then 1.16, then 1.19 for modules), that keeps everything simpler and more reliable, IMO. I'd stick with 1.21 check and just check with Arnaldo when he's planning to release a new version.
Quoted 11 lines
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()
scripts/link-vmlinux.sh gen_btf() · line 236
Quoted 10 lines
scripts/link-vmlinux.sh +6
-1vmlinux_link ${1} + local paholeopt=-J + if ${PAHOLE} --btf_gen_floats --help >/dev/null 2>&1; then + paholeopt="${paholeopt} --btf_gen_floats" + fi + info "BTF" ${2} - LLVM_OBJCOPY=${OBJCOPY} ${PAHOLE} -J ${1} + LLVM_OBJCOPY=${OBJCOPY} ${PAHOLE} ${paholeopt} ${1}
we know that -J is always specified, so I'd leave it intact, and just have "extra pahole options", potentially empty.
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
Em Tue, Mar 30, 2021 at 11:28:36PM -0700, Andrii Nakryiko escreveu:
Quoted 15 lines · Ilya Leoshkevich
Quoted 4 lines
pahole v1.21 will support the --btf_gen_floats flag, which makes it generate the information about the floating-point types.
Quoted 9 lines
Adjust
link-vmlinux.shto pass this flag to pahole in case it's supported. Whether or not this flag is supported is determined by probing, which is chosen over version check for two reasons:1) at this moment --btf_gen_floats exists only in master, which identifies itself as v1.20.
2) distros may backport features, making the version check too conservative.
Quoted 5 lines
Does anyone really cherry-pick and backport pahole patches, though? So far we've been using strictly version checks for pahole (1.13, then 1.16, then 1.19 for modules), that keeps everything simpler and more reliable, IMO. I'd stick with 1.21 check and just check with Arnaldo when he's planning to release a new version.
The plan is to get 1.21 out of the door when we finish the LTO work, which should be soon.
- Arnaldo
Quoted 31 lines
Quoted 11 lines
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()scripts/link-vmlinux.sh gen_btf() · line 236
Quoted 10 lines
scripts/link-vmlinux.sh +6
-1vmlinux_link ${1} + local paholeopt=-J + if ${PAHOLE} --btf_gen_floats --help >/dev/null 2>&1; then + paholeopt="${paholeopt} --btf_gen_floats" + fi + info "BTF" ${2} - LLVM_OBJCOPY=${OBJCOPY} ${PAHOLE} -J ${1} + LLVM_OBJCOPY=${OBJCOPY} ${PAHOLE} ${paholeopt} ${1}we know that -J is always specified, so I'd leave it intact, and just have "extra pahole options", potentially empty.
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