Incompatibility of PIC and non-PIC

Alan Modra alan@linuxcare.com.au
Tue, 22 Aug 2000 09:39:57 +1000 (EST)


On 21 Aug 2000, David Huggins-Daines wrote:

> The real bogosity is
> setting elf.plt.offset to -1 in order to prevent finish_dynamic_symbol
> from filling in the PLT entry, which, aside from overwriting (part of)
> the first PLT entry with the target for the last import stub, also
> causes these stubs themselves to contain references to PLT - 1 (these
> immediately cause SIGBUS at the moment, which is probably a good
> thing).
> 
> This is doubly strange because finish_dynamic_symbol has a check for
> h->pic_call in it already :-)

I think just deleting these lines (which predated the check in
finish_dynamic_symbol) in build_one_stub

	  /* Flag this .plt entry as having been filled in so that
	     finish_dynamic_symbol doesn't repeat our work here.  */
	  eh->elf.plt.offset = (bfd_vma) -1;

will do the trick.  I simply forgot to remove it after fixing
finish_dynamic_symbol to genereate correct .plt entries for the
cases where we don't have a dynamic relocation.

The problem is that you get one stub per input section to ensure that the
stub can be reached.  Messing with plt.offset on the first stub has dire
consequences for subsequent ones.

Alan
-- 
Linuxcare.  Support for the Revolution.