Re: [PATCH] MIPS: Implement ARCH_HAS_CC_CAN_LINK

From: Thomas Weißschuh

Date: Fri Jan 02 2026 - 02:47:29 EST


On Wed, Dec 31, 2025 at 02:33:40AM +0000, Maciej W. Rozycki wrote:
> On Mon, 22 Dec 2025, Thomas Weißschuh wrote:
>
> > diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> > index b88b97139fa8..316e3c29c431 100644
> > --- a/arch/mips/Kconfig
> > +++ b/arch/mips/Kconfig
> > @@ -3126,6 +3127,20 @@ config CC_HAS_MNO_BRANCH_LIKELY
> > config CC_HAS_BROKEN_INLINE_COMPAT_BRANCH
> > def_bool y if CC_IS_CLANG
> >
> > +config ARCH_CC_CAN_LINK
> > + bool
> > + default $(cc_can_link_user,-m64 -EL) if 64BIT && CPU_LITTLE_ENDIAN
> > + default $(cc_can_link_user,-m64 -EB) if 64BIT && CPU_BIG_ENDIAN
> > + default $(cc_can_link_user,-m32 -EL) if CPU_LITTLE_ENDIAN
> > + default $(cc_can_link_user,-m32 -EB) if CPU_BIG_ENDIAN
> > +
> > +config ARCH_USERFLAGS
> > + string
> > + default "-m64 -EL" if 64BIT && CPU_LITTLE_ENDIAN
> > + default "-m64 -EB" if 64BIT && CPU_BIG_ENDIAN
> > + default "-m32 -EL" if CPU_LITTLE_ENDIAN
> > + default "-m32 -EB" if CPU_BIG_ENDIAN
>
> There are no `-m32'/`-m64' options with MIPS GCC; where did you get them
> from and how did you verify your change? Did you mean `-mabi=...' by any
> chance?

Yes indeed. Not sure how that happened, I do have a correct version in
another branch... Thanks for spotting this.

> Also does the n32 ABI have to be factored in, since IIUC this
> stuff is about user programs?

It can be added, but I don't think it makes much sense.
It would only be used if CONFIG_MIPS32_N32=y (which is non-default) and if
the toolchain which has no n64 libc, but does have a n32 libc.
This seems unlikely to me, but let me know if I am mistaken.


Thomas