From: Vineet Gupta <vgupta@kernel.org>
To: Sasha Levin <sashal@kernel.org>, Vineet Gupta <vgupta@kernel.org>,
linux-snps-arc@lists.infradead.org
Cc: Andrii Nakryiko <andrii@kernel.org>,
Ilya Leoshkevich <iii@linux.ibm.com>,
bpf@vger.kernel.org, linux-kernel@vger.kernel.org,
Arnd Bergmann <arnd@arndb.de>
Subject: Re: [PATCH] ARC: Strip libgcc debug information when generating BTF
Date: Sat, 31 Oct 2026 18:04:01 -0700 [thread overview]
Message-ID: <09db4d22-2836-4656-8c6a-a7e5377710fb@kernel.org> (raw)
In-Reply-To: <20261015154044.4058618-1-sashal@kernel.org>
On 10/15/26 08:40, Sasha Levin wrote:
> ARC links against the compiler's libgcc archive. The ARC GNU 2023.03
> toolchain ships this library with debug information, including complex
> floating-point types in integer arithmetic helpers such as __udivdi3.
> These types reach vmlinux even though the kernel does not use complex
> floating-point arithmetic.
>
> When floating-point BTF encoding is enabled, pahole rejects those types:
>
> Complex, interval and imaginary float types are not supported
> Error while encoding BTF.
> FAILED: load BTF from .tmp_vmlinux1.BTF.1: No such file or directory
>
> KernelCI's upgrade to pahole 1.31 exposed this long-standing problem as
> failed ARC builds. As of 1.32, pahole still rejects these types, and
> older versions will stay in use, so the kernel build has to keep them
> out of vmlinux. Commit f122668ddcce ("ARC: Add eBPF JIT support")
> documented the same failure along with a workaround of disabling
> floating-point BTF encoding, but that also discards supported
> floating-point types from kernel BTF.
>
> For CONFIG_DEBUG_INFO_BTF, generate a debug-stripped copy of the selected
> libgcc archive in the output tree and link that copy. Preserve the archive
> structure so that only needed helpers are linked, and use the normal
> Kbuild objcopy rule to track input and command changes. The trade-off is
> that vmlinux in BTF-enabled builds no longer carries DWARF for the libgcc
> helpers. Debug information for kernel code, the installed toolchain and
> non-BTF builds stay unchanged.
>
> Reproduced and tested with ARC GCC 12.2.1 and pahole 1.31 and 1.32 using
> an ARCv2 tinyconfig with BPF_SYSCALL and DWARF4/BTF enabled. Before and
> after vmlinux.o files are identical after stripping debug information.
>
> Fixes: db16c1fe92d7 ("bpf: Generate BTF_KIND_FLOAT when linking vmlinux")
> Link: https://github.com/kernelci/kernelci-core/commit/e71b8c9f42253180596e734c18965a5aad80c8c5
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
> arch/arc/Makefile | 9 ++++++++-
> arch/arc/lib/Makefile | 8 ++++++++
> 2 files changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arc/Makefile b/arch/arc/Makefile
> index 868805ffcfeab..4ea705a331c7c 100644
> --- a/arch/arc/Makefile
> +++ b/arch/arc/Makefile
> @@ -86,7 +86,14 @@ core-$(CONFIG_ARC_PLAT_TB10X) += arch/arc/plat-tb10x/
> core-$(CONFIG_ARC_PLAT_AXS10X) += arch/arc/plat-axs10x/
> core-$(CONFIG_ARC_SOC_HSDK) += arch/arc/plat-hsdk/
>
> -libs-y += arch/arc/lib/ $(LIBGCC)
> +libs-y += arch/arc/lib/
> +
> +ifdef CONFIG_DEBUG_INFO_BTF
> +export LIBGCC := $(LIBGCC)
> +libs-y += arch/arc/lib/libgcc.a
> +else
> +libs-y += $(LIBGCC)
> +endif
>
> boot := arch/arc/boot
>
> diff --git a/arch/arc/lib/Makefile b/arch/arc/lib/Makefile
> index 30158ae69fd4a..2807ee24f27e6 100644
> --- a/arch/arc/lib/Makefile
> +++ b/arch/arc/lib/Makefile
> @@ -13,3 +13,11 @@ lib-$(CONFIG_ISA_ARCV2) +=memcpy-archs-unaligned.o
> else
> lib-$(CONFIG_ISA_ARCV2) +=memcpy-archs.o
> endif
> +
> +# libgcc can contain complex floating-point debug types unsupported by BTF.
> +# Strip only the debug information from a local copy of the selected archive.
> +always-$(CONFIG_DEBUG_INFO_BTF) += libgcc.a
> +OBJCOPYFLAGS_libgcc.a := --strip-debug
> +
> +$(obj)/libgcc.a: $(LIBGCC) FORCE
> + $(call if_changed,objcopy)
I'm working on getting rid of libgcc linking for ARC.
This requires adding some GENERIC_LIB_* routines, but as part of that
series I'll propose a revert of this and then the dropping the first link.
Don't intend to revert this per se, but revert just makes it cleaner.
Just FYI.
Thx,
-Vineet
next prev parent reply other threads:[~2026-11-01 1:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-15 15:40 Sasha Levin
2026-10-16 9:18 ` Alan Maguire
2026-11-01 1:04 ` Vineet Gupta [this message]
2026-11-01 11:09 ` Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=09db4d22-2836-4656-8c6a-a7e5377710fb@kernel.org \
--to=vgupta@kernel.org \
--cc=andrii@kernel.org \
--cc=arnd@arndb.de \
--cc=bpf@vger.kernel.org \
--cc=iii@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-snps-arc@lists.infradead.org \
--cc=sashal@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®