Completely construct the first PLT entry and correctly compute the

PC relative offset in the call insn.
This commit is contained in:
pk 1999-02-26 22:07:47 +00:00
parent d04273bac7
commit f6a359f27f
1 changed files with 10 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: reloc.c,v 1.12 1999/02/25 21:49:04 tv Exp $ */
/* $NetBSD: reloc.c,v 1.13 1999/02/26 22:07:47 pk Exp $ */
/*
* Copyright 1996 John D. Polstra.
@ -584,14 +584,20 @@ _rtld_relocate_objects(
/*
* PLTGOT is the PLT on the sparc.
* The first entry holds the call the dynamic linker.
* We construct a `call' instruction that transfers
* We construct a `call' sequence that transfers
* to `_rtld_bind_start()'.
* The second entry holds the object identification.
* Note: each PLT entry is three words long.
*/
obj->pltgot[1] = 0x40000000 |
#define SAVE 0x9de3bfc0 /* i.e. `save %sp,-64,%sp' */
#define CALL 0x40000000
#define NOP 0x01000000
obj->pltgot[0] = SAVE;
obj->pltgot[1] = CALL |
((Elf_Addr)&_rtld_bind_start -
(Elf_Addr)&obj->pltgot[1]);
(Elf_Addr)&obj->pltgot[1]) >> 2;
obj->pltgot[2] = NOP;
obj->pltgot[3] = (Elf_Addr) obj;
#endif
}