Re: [PATCH 2/3] selftests/nolibc: avoid function pointer comparisons

Thomas Weißschuh <[email protected]>
Newsgroups org.kernel.vger.linux-parisc,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On 2026-04-07 19:20:12+0200, Helge Deller wrote:
> On 4/7/26 18:37, Thomas Weißschuh wrote:
> > The upcoming parisc support would require libgcc to implement function
> > pointer comparisons. As we try to avoid the libgcc dependency rework
> > the logic to work without such comparisons.
> 
> Instead of working around at this specific code, I think it makes more sense
> to simply add the __canonicalize_funcptr_for_compare() symbol somewhere.
> Code is in arch/parisc/kernel/real2.S:
> ENTRY_CFI(__canonicalize_funcptr_for_compare)
> #ifdef CONFIG_64BIT
>         bve (%r2)
> #else
>         bv %r0(%r2)
> #endif
>         copy %r26,%r28
> ENDPROC_CFI(__canonicalize_funcptr_for_compare)
> 
> Or am I missing something?

nolibc is license more liberally than the rest of the kernel.
So lifting code from there is problematic. Also users should still
be able to use libgcc if they so desire, so this function could
conflict.

> Btw, since you want to avoid libgcc, I think this is quite hard, since
> gcc automatically adds lots of parisc specific millicode functions (see the "$$" symbols
> in parisc_ksyms.c) and many of the gcc helper functions (e.g. __muldi3).

The only one I ran into was $$dyncall. But that was mitigated by using
--mfast-indirect-calls. This option does not support shared libraries or
nested functions, but both are irrelevant for nolibc anyways.

> So, I'm not sure if it makes sense to try to avoid libgcc....

It works for the current version of nolibc-test.
If a user uses features that do require libgcc support then they can
always just use it. We only want to avoid forcing it on users.


Thomas
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.