public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ben Wolsieffer <ben.wolsieffer@hefring.com>
To: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Cc: Naresh Kamboju <naresh.kamboju@linaro.org>,
	Miguel Ojeda <ojeda@kernel.org>,
	Christian Schrrefl <chrisi.schrefl@gmail.com>,
	Russell King <rmk+kernel@armlinux.org.uk>,
	Rudraksha Gupta <guptarud@gmail.com>,
	Alice Ryhl <aliceryhl@google.com>,
	Ard Biesheuvel <ardb@kernel.org>,
	anders.roxell@linaro.org, arnd@arndb.de,
	dan.carpenter@linaro.org, laura.nao@collabora.com,
	linux-kernel@vger.kernel.org, lkft-triage@lists.linaro.org,
	regressions@lists.linux.dev, rust-for-linux@vger.kernel.org,
	torvalds@linux-foundation.org, Nick Clifton <nickc@redhat.com>,
	Richard Earnshaw <richard.earnshaw@arm.com>,
	Ramana Radhakrishnan <ramanara@nvidia.com>
Subject: Re: Build: arm rustgcc unknown argument '-mno-fdpic'
Date: Fri, 18 Apr 2025 15:44:43 -0400	[thread overview]
Message-ID: <aAKrq2InExQk7f_k@dell-precision-5540> (raw)
In-Reply-To: <CANiq72napRCGp3Z-xZJaA9zcgREe3Xy5efW8VW=NEZ13DAy+Xw@mail.gmail.com>

On Tue, Apr 15, 2025 at 05:38:54PM +0200, Miguel Ojeda wrote:
> On Tue, Apr 15, 2025 at 1:40 PM Naresh Kamboju
> <naresh.kamboju@linaro.org> wrote:
> >
> > On Tue, 8 Apr 2025 at 00:07, Miguel Ojeda <ojeda@kernel.org> wrote:
> > >
> > > On Mon, 07 Apr 2025 22:58:02 +0530 Naresh Kamboju <naresh.kamboju@linaro.org> wrote:
> > > >
> > > > Regressions on arm build with config rustgcc-lkftconfig-kselftest on the
> > > > Linux mainline and next failed with CONFIG_RUST=y enabled.
> > >
> > > > Bad: next-20250327
> > > > Good: next-20250326
> > >
> > > > Unable to generate bindings: clang diagnosed error: error: unknown
> > > > argument: '-mno-fdpic'
> > >
> > > I assume this is the arm support, i.e. commit ccb8ce526807 ("ARM: 9441/1:
> > > rust: Enable Rust support for ARMv7").
> > >
> > > Clang does not seem to support `-mno-fdpic`, thus you probably need to add it to
> > > `bindgen_skip_c_flags` in `rust/Makefile` so that it gets skipped when the C
> > > compiler is GCC.
> > >
> > > If you do so, please double-check if the flag could potentially alter the ABI in
> > > a way that `bindgen` would generate the wrong bindings.
> >
> > I tested this idea and it works but I don't know enough about
> > rust to double-check if the flag could potentially alter the
> > ABI in a way that `bindgen` would generate the wrong bindings.
> 
> Yeah, it would be nice to have someone knowledgeable about the
> arch/GCC/flag confirm or not -- I don't think Rust knowledge is
> needed, i.e. it is mostly about how GCC behaves with/without the flag
> and vs. Clang (since `bindgen` uses libclang to parse code).
> 
> The original commit adding it to arm (and similar ones for sh and xtensa) says:
> 
>     When building with an arm-*-uclinuxfdpiceabi toolchain, the FDPIC ABI is
>     enabled by default but should not be used to build the kernel.
> 
> So it sounds like it is only an issue for particular toolchains/targets anyway?
> 
> Cc'ing Ben who introduced it, and the arm port GCC maintainers in case
> they may be able to tell us more -- thanks in advance, and sorry for
> any potential noise!

FDPIC is only relevant with no-MMU targets, and then only for userspace.
When configured for the arm-*-uclinuxfdpiceabi target, GCC enables FDPIC
by default to facilitate compiling userspace programs. FDPIC is never
used for the kernel, and we pass -mno-fdpic when building the kernel to
override the default and make sure FDPIC is disabled.

Therefore, it is perfectly safe to omit that flag for kernel builds with
Clang.

Ben

  reply	other threads:[~2025-04-18 19:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-07 17:28 Build: arm rustgcc unknown argument '-mno-fdpic' Naresh Kamboju
2025-04-07 18:37 ` Miguel Ojeda
2025-04-15 11:40   ` Naresh Kamboju
2025-04-15 15:38     ` Miguel Ojeda
2025-04-18 19:44       ` Ben Wolsieffer [this message]
2025-04-18 22:30         ` Miguel Ojeda
2025-04-24 13:39           ` Ben Wolsieffer
2025-04-24 17:01             ` Miguel Ojeda
2025-05-20 23:21               ` Rudraksha Gupta
2025-05-21  6:49                 ` Miguel Ojeda

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=aAKrq2InExQk7f_k@dell-precision-5540 \
    --to=ben.wolsieffer@hefring.com \
    --cc=aliceryhl@google.com \
    --cc=anders.roxell@linaro.org \
    --cc=ardb@kernel.org \
    --cc=arnd@arndb.de \
    --cc=chrisi.schrefl@gmail.com \
    --cc=dan.carpenter@linaro.org \
    --cc=guptarud@gmail.com \
    --cc=laura.nao@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkft-triage@lists.linaro.org \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=naresh.kamboju@linaro.org \
    --cc=nickc@redhat.com \
    --cc=ojeda@kernel.org \
    --cc=ramanara@nvidia.com \
    --cc=regressions@lists.linux.dev \
    --cc=richard.earnshaw@arm.com \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=torvalds@linux-foundation.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