Skip to contentSkip to conversation

arch: um: turn BTF_TYPEINFO support off

RFC In review Brendan Higgins 3 participants 6 messages Jan 27, 2020 – Jan 28, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover arch: um: turn BTF_TYPEINFO support off

As a part of my quest to get allyesconfig working on UML, I found a new build error, with CONFIG_DEBUG_INFO_BTF=y:

scripts/link-vmlinux.sh: line 106: 17463 Segmentation fault LLVM_OBJCOPY=${OBJCOPY} ${PAHOLE} -J ${1}
objcopy: --change-section-vma .BTF=0x0000000000000000 never used
objcopy: --change-section-lma .BTF=0x0000000000000000 never used
objcopy: error: the input file '.btf.vmlinux.bin' is empty Failed to generate BTF for vmlinux
Try to disable CONFIG_DEBUG_INFO_BTF
make: *** [Makefile:1078: vmlinux] Error 1

The most interesting bit seems to be the:

objcopy: error: the input file '.btf.vmlinux.bin' is empty

Thinking about it, I am not sure if it makes sense for UML to produce BTF type information, so I proposed a fix here that:

1. Adds the ability for architectures to turn BTF support off.
2. Turns BTF support off for UML.

I am also totally fine with just saying that DEBUG_INFO_BTF depends on !UML, but I figured people would prefer this approach more.

Brendan Higgins (2):
kbuild: add arch specific dependency for BTF support
arch: um: turn BTF_TYPEINFO support off

 arch/um/Kconfig   | 1 +
 lib/Kconfig.debug | 5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)
Signature · 1 line
2.25.0.341.g760bfbb309-goog
#1 lore raw

RFC 1/2 kbuild: add arch specific dependency for BTF support

Some archs (like UM) do not build with CONFIG_DEBUG_INFO_BTF=y, so add an options for archs to select to opt-in or out of BTF typeinfo support.

---
 lib/Kconfig.debug | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
lib/Kconfig.debug +4 -1
index e4676b992eae9..f5bcb391f1b7d 100644
@@ -238,9 +238,12 @@ config DEBUG_INFO_DWARF4
 	  But it significantly improves the success of resolving
 	  variables in gdb on optimized code.
 
+config ARCH_NO_BTF_TYPEINFO
+	bool
+
 config DEBUG_INFO_BTF
 	bool "Generate BTF typeinfo"
-	depends on DEBUG_INFO
+	depends on DEBUG_INFO && !ARCH_NO_BTF_TYPEINFO
 	help
 	  Generate deduplicated BTF type information from DWARF debug info.
 	  Turning this on expects presence of pahole tool, which will convert
Signature · 1 line
2.25.0.341.g760bfbb309-goog
#2 lore raw

Re: [RFC v1 1/2] kbuild: add arch specific dependency for BTF support

Hi.

Quoted 3 lines · Brendan Higgins

Some archs (like UM) do not build with CONFIG_DEBUG_INFO_BTF=y, so add an options for archs to select to opt-in or out of BTF typeinfo support.

Could you use a different subject prefix (e.g. "btf:") ?

This is unrelated to kbuild.

Thanks.

Quoted 26 lines
---
 lib/Kconfig.debug | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
lib/Kconfig.debug +4 -2
index e4676b992eae9..f5bcb391f1b7d 100644
@@ -238,9 +238,12 @@ config DEBUG_INFO_DWARF4
          But it significantly improves the success of resolving
          variables in gdb on optimized code.
 
+config ARCH_NO_BTF_TYPEINFO
+       bool
+
 config DEBUG_INFO_BTF
        bool "Generate BTF typeinfo"
-       depends on DEBUG_INFO
+       depends on DEBUG_INFO && !ARCH_NO_BTF_TYPEINFO
        help
          Generate deduplicated BTF type information from DWARF debug info.
          Turning this on expects presence of pahole tool, which will convert
--

2.25.0.341.g760bfbb309-goog

Signature · 2 lines
Best Regards
Masahiro Yamada
#3 lore raw

Re: [RFC v1 1/2] kbuild: add arch specific dependency for BTF support

Quoted 6 lines · Masahiro Yamada

Hi.

Quoted 1 line · Brendan Higgins
Quoted 7 lines
Quoted 2 lines

Some archs (like UM) do not build with CONFIG_DEBUG_INFO_BTF=y, so add an options for archs to select to opt-in or out of BTF typeinfo support.

Could you use a different subject prefix (e.g. "btf:") ?

This is unrelated to kbuild.

Sure. My apologies, I just used the kbuild subject prefix because that's what the previous commit that touched BTF used. Will fix in next revision.

Thanks!

Quoted 31 lines
Quoted 24 lines
---
 lib/Kconfig.debug | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
lib/Kconfig.debug +4 -2
index e4676b992eae9..f5bcb391f1b7d 100644
@@ -238,9 +238,12 @@ config DEBUG_INFO_DWARF4
          But it significantly improves the success of resolving
          variables in gdb on optimized code.
 
+config ARCH_NO_BTF_TYPEINFO
+       bool
+
 config DEBUG_INFO_BTF
        bool "Generate BTF typeinfo"
-       depends on DEBUG_INFO
+       depends on DEBUG_INFO && !ARCH_NO_BTF_TYPEINFO
        help
          Generate deduplicated BTF type information from DWARF debug info.
          Turning this on expects presence of pahole tool, which will convert
--
Quoted 2 lines

2.25.0.341.g760bfbb309-goog

--
Best Regards
Masahiro Yamada

#4 lore raw

RFC 2/2 arch: um: turn BTF_TYPEINFO support off

In reply to Brendan Higgins

Currently CONFIG_DEBUG_INFO_BTF=y doesn't work on UML:

scripts/link-vmlinux.sh: line 106: 17463 Segmentation fault LLVM_OBJCOPY=${OBJCOPY} ${PAHOLE} -J ${1}
objcopy: --change-section-vma .BTF=0x0000000000000000 never used
objcopy: --change-section-lma .BTF=0x0000000000000000 never used
objcopy: error: the input file '.btf.vmlinux.bin' is empty Failed to generate BTF for vmlinux
Try to disable CONFIG_DEBUG_INFO_BTF
make: *** [Makefile:1078: vmlinux] Error 1

So turn off ARCH_HAS_BTF_TYPEINFO support off for the UM architecture.

---
 arch/um/Kconfig | 1 +
 1 file changed, 1 insertion(+)
arch/um/Kconfig +1 -0
index 0917f8443c285..53e13d8b210e0 100644
@@ -6,6 +6,7 @@ config UML
 	bool
 	default y
 	select ARCH_HAS_KCOV
+	select ARCH_NO_BTF_TYPEINFO
 	select ARCH_NO_PREEMPT
 	select HAVE_ARCH_AUDITSYSCALL
 	select HAVE_ARCH_SECCOMP_FILTER
Signature · 1 line
2.25.0.341.g760bfbb309-goog
maintainer Acked-by on v1 2/2
#5 lore raw
Quoted 23 lines · Brendan Higgins

Currently CONFIG_DEBUG_INFO_BTF=y doesn't work on UML:

scripts/link-vmlinux.sh: line 106: 17463 Segmentation fault LLVM_OBJCOPY=${OBJCOPY} ${PAHOLE} -J ${1}
objcopy: --change-section-vma .BTF=0x0000000000000000 never used
objcopy: --change-section-lma .BTF=0x0000000000000000 never used
objcopy: error: the input file '.btf.vmlinux.bin' is empty Failed to generate BTF for vmlinux
Try to disable CONFIG_DEBUG_INFO_BTF
make: *** [Makefile:1078: vmlinux] Error 1

So turn off ARCH_HAS_BTF_TYPEINFO support off for the UM architecture.

---
  arch/um/Kconfig | 1 +
  1 file changed, 1 insertion(+)
arch/um/Kconfig +0 -0
index 0917f8443c285..53e13d8b210e0 100644

arch/um/Kconfig config UML · line 12

Quoted 7 lines
arch/um/Kconfig +1 -0
@@ -6,6 +6,7 @@ config UML
  	bool
  	default y
  	select ARCH_HAS_KCOV
+	select ARCH_NO_BTF_TYPEINFO
  	select ARCH_NO_PREEMPT
  	select HAVE_ARCH_AUDITSYSCALL
  	select HAVE_ARCH_SECCOMP_FILTER
Signature · 8 lines
Anton R. Ivanov
Cambridgegreys Limited. Registered in England. Company Number 10273661
https://www.cambridgegreys.com/

_______________________________________________
linux-um mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-um