Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Francis Laniel <flaniel@linux.microsoft.com>
To: "buildroot@buildroot.org" <buildroot@buildroot.org>,
	Lang Daniel <d.lang@abatec.at>
Subject: Re: [Buildroot] [PATCH v2 2/2] linux: use -isystem instead of -I in HOSTCC
Date: Thu, 16 Feb 2023 15:23:35 +0100	[thread overview]
Message-ID: <12152275.O9o76ZdvQC@pwmachine> (raw)
In-Reply-To: <VI1P190MB04930BE811E350544617950D9FA39@VI1P190MB0493.EURP190.PROD.OUTLOOK.COM>

Hi.

Le mercredi 15 février 2023, 10:58:51 CET Lang Daniel a écrit :
> A package might install headers that are incompatible with the kernel's
> header. One example is the most recent version of pahole (1.24).
> HOST_CC includes -I$(HOST_DIR)/include which comes before any include
> logic the kernel might have thus forcing the kernel to prefer headers in
> HOST_DIR.
> 
> The logic to substituting -I with -isystem is taken from
> boot/uboot/uboot.mk.
> 
> Signed-off-by: Daniel Lang <d.lang@abatec.at>

Thank you for this patch!
I tested it and got the same error as you:
FAILED: load BTF from vmlinux: Invalid argument

I tested with qemu_x86_64_defconfig to which I added the same options as you.
I will test with a kernel younger than 5.15.18 and I come back here!

> ---
> v1 -> v2:
>  - Patch was added to the series
> 
> Tested with:
> 
> BR2_aarch64=y
> BR2_TOOLCHAIN_EXTERNAL=y
> BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y
> BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
> BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_AARCH64_GLIBC_STABLE=y
> BR2_LINUX_KERNEL=y
> BR2_LINUX_KERNEL_CUSTOM_VERSION=y
> BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="{VERSION}"
> BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
> BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="pahole-kernel.config"
> BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
> BR2_LINUX_KERNEL_NEEDS_HOST_PAHOLE=y
> 
> and with a fragment for linux:
> 
> CONFIG_BPF_SYSCALL=y
> CONFIG_BPF_UNPRIV_DEFAULT_OFF=n
> CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y
> CONFIG_DEBUG_INFO_REDUCED=n
> CONFIG_DEBUG_INFO_COMPRESSED=n
> CONFIG_DEBUG_INFO_BTF=y
> CONFIG_SYSTEM_TRUSTED_KEYRING=y
> 
> where VERSION is one of:
> 5.2.21 5.3.18 5.4.231 5.5.19 5.6.19 5.7.19 5.8.18 5.9.16 5.10.167 5.11.22
> 5.12.19 5.13.19 5.14.21 5.15.93 5.16.20 5.17.15 5.18.19 5.19.17 6.0.19
> 6.1.11
> 
> Version 5.2, as far as I could work it out, is the version that introduced
> the pahole dependency when CONFIG_DEBUG_INFO_BTF is set.
> 
> None-LTS versions after 5.10 and before 5.19 fail with:
> 
>   LD      vmlinux.o
>   MODPOST vmlinux.symvers
>   MODINFO modules.builtin.modinfo
>   GEN     modules.builtin
>   LD      .tmp_vmlinux.btf
>   BTF     .btf.vmlinux.bin.o
>   LD      .tmp_vmlinux.kallsyms1
>   KSYMS   .tmp_vmlinux.kallsyms1.S
>   AS      .tmp_vmlinux.kallsyms1.S
>   LD      .tmp_vmlinux.kallsyms2
>   KSYMS   .tmp_vmlinux.kallsyms2.S
>   AS      .tmp_vmlinux.kallsyms2.S
>   LD      vmlinux
>   BTFIDS  vmlinux
> FAILED: load BTF from vmlinux: Invalid argument
> make[2]: *** [Makefile:1177: vmlinux] Error 255
> make[1]: *** [package/pkg-generic.mk:293:
> /home/d.lang/ws/other/buildroot/output/build/linux-5.11.22/.stamp_built]
> Error 2 make: *** [Makefile:82: _all] Error 2
> 
> These version miss BTF_KIND_ENUM64 support and require a patch [0] that has
> been added to LTS versions.
> 
> [0]: https://lore.kernel.org/bpf/20221019085604.1017583-6-jolsa@kernel.org/
> 
> Signed-off-by: Daniel Lang <d.lang@abatec.at>
> ---
>  linux/linux.mk | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/linux/linux.mk b/linux/linux.mk
> index 7645b5f507..03d89cd204 100644
> --- a/linux/linux.mk
> +++ b/linux/linux.mk
> @@ -150,7 +150,7 @@ endif
>  # Disable building host tools with -Werror: newer gcc versions can be
>  # extra picky about some code
> (https://bugs.busybox.net/show_bug.cgi?id=14826) LINUX_MAKE_FLAGS = \
> -	HOSTCC="$(HOSTCC) $(HOST_CFLAGS) $(HOST_LDFLAGS)" \
> +	HOSTCC="$(HOSTCC) $(subst -I/,-isystem /,$(subst -I /,-isystem
> /,$(HOST_CFLAGS))) $(HOST_LDFLAGS)" \ ARCH=$(KERNEL_ARCH) \
>  	INSTALL_MOD_PATH=$(TARGET_DIR) \
>  	CROSS_COMPILE="$(TARGET_CROSS)" \

Best regards.


_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  reply	other threads:[~2023-02-16 14:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-15  9:58 [Buildroot] [PATCH v2 2/2] linux: use -isystem instead of -I in HOSTCC Lang Daniel via buildroot
2023-02-16 14:23 ` Francis Laniel [this message]
2023-02-16 14:48   ` Francis Laniel
2023-03-10 20:55 ` Arnout Vandecappelle

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=12152275.O9o76ZdvQC@pwmachine \
    --to=flaniel@linux.microsoft.com \
    --cc=buildroot@buildroot.org \
    --cc=d.lang@abatec.at \
    /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