[PATCH] powerpc: Work around gcc miscompilation of __pa() on 64-bit

Benjamin Herrenschmidt benh at kernel.crashing.org
Mon Sep 2 09:59:12 EST 2013


On Tue, 2013-08-27 at 16:42 +0930, Alan Modra wrote:
> The proper fix is to define a whole slew of new relocations and reloc
> specifiers, and modify everything to use them, but that seems like too
> much bother.  I had ideas once upon a time to implement gas and ld
> options that makes @ha and _HA report overflows, but haven't found one
> of those round tuits.

No, if you don't have a reloc that can represent this, then the proper
fix is to use the existing relocs to load the original symbol address
into a register, then *generate* the appropriate 64-bit addition on top
of it.

The pointer has been cast to an integer before the addition, it's no
longer an object pointer and gcc shouldn't treat it as such, at which
point we are in the domain of normal integer arithmetics.

Cheers,
Ben.




More information about the Linuxppc-dev mailing list