Re: [PATCH v2 2/2] compiler-gcc: Remove obsolete RELOC_HIDE() macro
From: Uros Bizjak
Date: Fri Sep 04 2026 - 13:15:09 EST
On Fri, Sep 4, 2026 at 5:16 PM Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> On Fri, 4 Sept 2026 at 01:28, Uros Bizjak <ubizjak@xxxxxxxxx> wrote:
> >
> > The GCC specific macro was historically used to workaround very
> > old compiler bugs (including pre-4.1 ppc64 GCC). These compilers
> > are now long obsolete.
>
> The gcc-4.1 bug in that comment was about how the use of "=g" caused
> ppc code generation issues.
>
> It's not entirely clear to me that the original reason for this macro
> is actually gone. The cast to 'long' has not always hidden the
> provenance of the address.
>
> The use of inline asm in RELOC_HIDE() actually goes back much much further.
>
> I do agree that it probably is no longer relevant, but that commit
> message is actively misleading. RELOC_HIDE() itself has nothing to do
> with the ppc64-specific gcc bug, that was literally just a small
> indepdendent change to the implementation.
Oh, now that you point out, I was looking at inline asm, but since the
patch removes GCC specific macro, the commit message reads like the
*macro* is there to workaround very old compiler bugs. It is
effectively inline asm that the patch removes, and as you point out,
this inline asm caused ppc code gen issues. Let me rephrase the commit
message to fix the confusion.
The cast to (unsigned long) should remove all compiler's knowledge
about the pointer and force the compiler to use integer arithmetic
instead of pointer arithmetic. This is what the generic version does
without inline asm.
Uros.
> Linus