Re: [PATCH 1/2] MIPS: Compressed PLT/stubs support

Alan Modra
2013-02-22T00:58:48Z

On Thu, Feb 21, 2013 at 02:06:34PM -0700, Tom Tromey wrote:
> Maciej> if (type != ST_SYNTHETIC)
> Maciej> elf_sym = (elf_symbol_type *) sym;
> Maciej> - else
> Maciej> + else if (((sym->udata.i | 0xff) ^ 0xff) != 0)
> Maciej> elf_sym = (elf_symbol_type *) sym->udata.p;
> Maciej> + else
> Maciej> + elf_sym = NULL;
>
> This seems iffy to me. I suppose what gives me pause is the possibility
> that this condition will trigger on some other port that does something
> odd in BFD.

ppc64 is the only target that currently provides get_synthetic_symtab
returning non-NULL values of udata.

We have

union
{
void *p;
bfd_vma i;
}
udata;

"i" is always 64 bits when ppc64 is supported by BFD. The size of "p"
depends on the host. If they happen to both be 64-bit the analysis is
easy and Maciej's change will break ppc64 if "p" can have an address
in the range [0,255]. For 32-bit little-endian hosts we get the same
result. For 32-bit big-endian hosts, "p" occupies the high 32 bits of
"i", so any non-NULL value of "p" will pass the new test.

I doubt we care about hosts that might allocate memory from the zero
page, so Maciej's change is OK as far as I'm concerned.

Hmm, perhaps a cleaner change would be implement make_msymbol_special
for ppc64 and move the udata.p special case out of elf_symtab_read?

--
Alan Modra
Australia Development Lab, IBM