On 10/20/26 8:16 AM, John David Anglin wrote:
A function pointer on 32-bit hppa points to a function descriptor.
Unfortunately,
function descriptors aren't unique and it's complicated to determine the actual
address of the function when lazy binding is in effect.
Right. They're definitely not unique.
What I remember was that you could mask off the low bit and dereference
that word (or some offset from that word) and you'd get the function's
real address, but that even that case wasn't handled consistently enough
to get to proper ANSI/ISO behavior.
There is definitely confusion on this issue. The tree-ssa/pr22051-1.c
test currently fails on hppa-linux because NULL is not canonicalized.
This has been the case for a long time, so I don't think we want to
change the current behavior.
If foo is defined, if (_1 == 0B) will never be true as function descriptors
never
reside in page 0. If you don't have that information, then we will have to give
up on the constant folding optimization.
Given that a pdir pointing to location 0 has the magic low order bit
off, then canonicalizion shouldn't be needed and you can compare
directly. Or am I mis-remembering.
The way it is implemented now is that such comparisons are folded
ignoring canonicalization which to me means that
(simplify
(tcc_comparison (.CANONICALIZE_FUNCPTR_FOR_COMPARE @0)
(.CANONICALIZE_FUNCPTR_FOR_COMPARE @1))
can be simplified if @0 @1 simplifies via address_compare?
I do wonder whether the not strict specification requires this to
be target specific folding? Did we ever have another port than pa
to require this?
This is definitely specific to 32-bit pa although the use of function
descriptors isn't.
That's my recollection as well.
jeff