Re: [PATCH bpf-next] scripts/gen-btf.sh: Disable LTO when generating initial .o file
From: Nathan Chancellor
Date: Mon Jan 05 2026 - 18:46:56 EST
On Mon, Jan 05, 2026 at 02:01:36PM -0800, Ihor Solodrai wrote:
> Hi Nathan, thank you for the patch.
>
> I'm starting to think it wasn't a good idea to do
>
> echo "" | ${CC} ...
>
> here, given the number of associated bugs.
Yeah, I was wondering if a lack of KBUILD_CPPFLAGS would also be a
problem since that contains the endianness flag for some targets. I
cannot imagine any more issues than that but I can understand wanting to
back out of it.
> Before gen-btf.sh was introduced, the .btf.o binary was generated with this [1]:
>
> ${OBJCOPY} --only-section=.BTF --set-section-flags .BTF=alloc,readonly \
> --strip-all ${1} "${btf_data}" 2>/dev/null
>
> I changed to ${CC} on the assumption it's a quicker operation than
> stripping entire vmlinux. But maybe it's not worth it and we should
> change back to --strip-all? wdyt?
That certainly seems more robust to me. I see the logic but with
'--only-section' and no glob, I would expect that to be a rather quick
operation but I am running out of time today to test and benchmark such
a change. I will try to do it tomorrow unless someone beats me to it.
Cheers,
Nathan