diff options
| author | chs <chs@NetBSD.org> | 2005-09-27 07:20:32 +0000 |
|---|---|---|
| committer | chs <chs@NetBSD.org> | 2005-09-27 07:20:32 +0000 |
| commit | 0c6e4dbbc4d2138cffbada36a3432bc7e3dbfa86 (patch) | |
| tree | 08e55bf061421f81d38f0645e8710adb5be9bf19 /libexec | |
| parent | baee927713e1e6fded7efd66f58cb43164868d0c (diff) | |
ok, the change from rev 1.33 was unnecessary after all,
only the second part of the previous revision was needed.
put the logic for the initial icache invalidation of the PLT
back the way it was, but in a way that makes clearer what's going on,
and add some comments explaining it.
Diffstat (limited to 'libexec')
| -rw-r--r-- | libexec/ld.elf_so/arch/powerpc/ppc_reloc.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c b/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c index 8a11a8f7b1e..1988fc1928c 100644 --- a/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c +++ b/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c @@ -1,4 +1,4 @@ -/* $NetBSD: ppc_reloc.c,v 1.38 2005/09/26 05:45:13 chs Exp $ */ +/* $NetBSD: ppc_reloc.c,v 1.39 2005/09/27 07:20:32 chs Exp $ */ /*- * Copyright (C) 1998 Tsubai Masanari @@ -30,7 +30,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: ppc_reloc.c,v 1.38 2005/09/26 05:45:13 chs Exp $"); +__RCSID("$NetBSD: ppc_reloc.c,v 1.39 2005/09/27 07:20:32 chs Exp $"); #endif /* not lint */ #include <stdarg.h> @@ -58,6 +58,16 @@ static inline int _rtld_relocate_plt_object(const Obj_Entry *, const Elf_Rela *, int, Elf_Addr *); /* + * The PPC PLT format consists of three sections: + * (1) The "pltcall" and "pltresolve" glue code. This is always 18 words. + * (2) The code part of the PLT entries. There are 2 words per entry for + * up to 8192 entries, then 4 words per entry for any additional entries. + * (3) The data part of the PLT entries, comprising a jump table. + * This section is half the size of the second section (ie. 1 or 2 words + * per entry). + */ + +/* * Setup the plt glue routines. */ #define PLTCALL_SIZE 20 @@ -89,7 +99,11 @@ _rtld_setup_pltgot(const Obj_Entry *obj) pltresolve[3] |= ha(obj); pltresolve[4] |= l(obj); - __syncicache(pltcall, 72 + N * 12); + /* + * Invalidate the icache for only the code part of the PLT + * (and not the jump table at the end). + */ + __syncicache(pltcall, (char *)jmptab - (char *)pltcall); } void @@ -218,6 +232,13 @@ _rtld_relocate_plt_lazy(const Obj_Entry *obj) /* b pltresolve */ distance = (Elf_Addr)pltresolve - (Elf_Addr)where; *where++ = 0x48000000 | (distance & 0x03fffffc); + + /* + * Icache invalidation is not done for each entry here + * because we sync the entire code part of the PLT once + * in _rtld_setup_pltgot() after all the entries have been + * initialized. + */ /* __syncicache(where - 3, 12); */ } |
