bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next] btf: do not use CONFIG_OUTPUT_FORMAT
@ 2019-08-20 11:29 Ilya Leoshkevich
  2019-08-21 15:22 ` Daniel Borkmann
  0 siblings, 1 reply; 2+ messages in thread
From: Ilya Leoshkevich @ 2019-08-20 11:29 UTC (permalink / raw)
  To: Daniel Borkmann, Alexei Starovoitov
  Cc: bpf, Andrii Nakryiko, Heiko Carstens, Vasily Gorbik, Ilya Leoshkevich

Building s390 kernel with CONFIG_DEBUG_INFO_BTF fails, because
CONFIG_OUTPUT_FORMAT is not defined. As a matter of fact, this variable
appears to be x86-only, so other arches might be affected as well.

Fix by obtaining this value from objdump output, just like it's already
done for bin_arch. The exact objdump invocation is "inspired" by
arch/powerpc/boot/wrapper.

Also, use LANG=C for the existing bin_arch objdump invocation to avoid
potential build issues on systems with non-English locale.

Fixes: 341dfcf8d78e ("btf: expose BTF info through sysfs")
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
 scripts/link-vmlinux.sh | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index c31193340108..0d8f41db8cd6 100755
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -115,10 +115,12 @@ gen_btf()
 	LLVM_OBJCOPY=${OBJCOPY} ${PAHOLE} -J ${1}
 
 	# dump .BTF section into raw binary file to link with final vmlinux
-	bin_arch=$(${OBJDUMP} -f ${1} | grep architecture | \
+	bin_arch=$(LANG=C ${OBJDUMP} -f ${1} | grep architecture | \
 		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} -I binary -O ${CONFIG_OUTPUT_FORMAT} -B ${bin_arch} \
+	${OBJCOPY} -I binary -O ${bin_format} -B ${bin_arch} \
 		--rename-section .data=.BTF .btf.vmlinux.bin ${2}
 }
 
-- 
2.21.0


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

* Re: [PATCH bpf-next] btf: do not use CONFIG_OUTPUT_FORMAT
  2019-08-20 11:29 [PATCH bpf-next] btf: do not use CONFIG_OUTPUT_FORMAT Ilya Leoshkevich
@ 2019-08-21 15:22 ` Daniel Borkmann
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Borkmann @ 2019-08-21 15:22 UTC (permalink / raw)
  To: Ilya Leoshkevich, Alexei Starovoitov
  Cc: bpf, Andrii Nakryiko, Heiko Carstens, Vasily Gorbik

On 8/20/19 1:29 PM, Ilya Leoshkevich wrote:
> Building s390 kernel with CONFIG_DEBUG_INFO_BTF fails, because
> CONFIG_OUTPUT_FORMAT is not defined. As a matter of fact, this variable
> appears to be x86-only, so other arches might be affected as well.
> 
> Fix by obtaining this value from objdump output, just like it's already
> done for bin_arch. The exact objdump invocation is "inspired" by
> arch/powerpc/boot/wrapper.
> 
> Also, use LANG=C for the existing bin_arch objdump invocation to avoid
> potential build issues on systems with non-English locale.
> 
> Fixes: 341dfcf8d78e ("btf: expose BTF info through sysfs")
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>

LGTM, applied, thanks!

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

end of thread, other threads:[~2019-08-21 15:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-20 11:29 [PATCH bpf-next] btf: do not use CONFIG_OUTPUT_FORMAT Ilya Leoshkevich
2019-08-21 15:22 ` Daniel Borkmann

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).