All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Ricardo Ribalda <ribalda@chromium.org>
Cc: Nicolas Schier <nsc@kernel.org>,
	Julian Braha <julianbraha@gmail.com>,
	"Lorenzo Stoakes (ARM)" <ljs@kernel.org>,
	linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kbuild: pass -fno-pic when probing for -mfentry
Date: Tue, 20 Oct 2026 14:54:03 -0700	[thread overview]
Message-ID: <20261020215403.GA2506074@ax162> (raw)
In-Reply-To: <20261020-pie-v1-1-9be09f2324b1@chromium.org>

Hi Ricardo,

On Tue, Oct 20, 2026 at 06:10:52AM +0000, Ricardo Ribalda wrote:
> Some distros (namely Debian) configure their 32-bit toolchain with
> --enable-default-pie.
> 
> To properly probe for -mfentry on them we need to pass -fno-pic,
> otherwise allmodconfig will fail with:
> 
> ./arch/x86/include/asm/ftrace.h:9:3: error: #error Compiler does not support fentry?
> 
> Fixes: 454e00cf8ee5 ("kbuild: avoid re-running compiler and linker probes")
> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
> ---
> I found this while testing next with media-ci.
> 
> Full logs:
> https://gitlab.freedesktop.org/linux-media/users/ribalda/-/jobs/113299249#L4729

Thanks a lot for the patch/report. I noticed another problem with this
check and the fix is quite ugly, so I think I would rather just back out
of this move altogether, along with documenting these pitfalls for
future travelers:

  https://lore.kernel.org/20261020-kconfig-fix-mfentry-check-v1-0-428258bc0fc0@kernel.org/

> ---
>  scripts/Kconfig.toolchain | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/Kconfig.toolchain b/scripts/Kconfig.toolchain
> index b0b9a663ddbe..53b361cf365a 100644
> --- a/scripts/Kconfig.toolchain
> +++ b/scripts/Kconfig.toolchain
> @@ -170,8 +170,10 @@ config CC_HAS_MNOP_MCOUNT
>  	def_bool $(cc-option,-mnop-mcount)
>  
>  # s390-linux-gnu-gcc did not support -mfentry until gcc-9.
> +# 32-bit x86 gcc does not support -mfentry in combination with -fpic, which will
> +# be enabled by default when gcc is configured with --enable-default-pie.
>  config CC_HAS_MFENTRY
> -	def_bool $(cc-option,-mfentry)
> +	def_bool $(cc-option,-fno-pic -mfentry)
>  
>  config LD_OPT_FORCE_GROUP_ALLOCATION
>  	def_string "$(ld-option-str,--force-group-allocation)"
> 
> ---
> base-commit: 3d229ce89862b8e82d71a9e11d6f840ca272a6d6
> change-id: 20261020-pie-6774df20b0fa
> 
> Best regards,
> -- 
> Ricardo Ribalda <ribalda@chromium.org>
> 

-- 
Cheers,
Nathan

      parent reply	other threads:[~2026-10-20 21:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-20  6:10 [PATCH] kbuild: pass -fno-pic when probing for -mfentry Ricardo Ribalda
2026-10-20  9:10 ` Lorenzo Stoakes (ARM)
2026-10-20 21:54 ` Nathan Chancellor [this message]

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=20261020215403.GA2506074@ax162 \
    --to=nathan@kernel.org \
    --cc=julianbraha@gmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ljs@kernel.org \
    --cc=nsc@kernel.org \
    --cc=ribalda@chromium.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.