diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2020-07-16 21:26:19 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2020-07-16 21:26:19 +0000 |
commit | dc920f8b87b7c52325bd135253ddf3d6879bb97e (patch) | |
tree | 6bd463c7fe1b24f09e87a85e2d8a2330be6e9030 /libexec | |
parent | 55bed41956fd54a23882af6ea9c5e9e3c20480a1 (diff) |
Rewrite loop to match what is written down in the ABI document.
ok drahn@
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/ld.so/powerpc64/rtld_machine.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/libexec/ld.so/powerpc64/rtld_machine.c b/libexec/ld.so/powerpc64/rtld_machine.c index 08562960410..7a862a81916 100644 --- a/libexec/ld.so/powerpc64/rtld_machine.c +++ b/libexec/ld.so/powerpc64/rtld_machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtld_machine.c,v 1.3 2020/07/16 21:18:09 kettenis Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.4 2020/07/16 21:26:18 kettenis Exp $ */ /* * Copyright (c) 1999 Dale Rahn @@ -276,7 +276,7 @@ _dl_md_reloc_got(elf_object_t *object, int lazy) fails = _dl_md_reloc(object, DT_JMPREL, DT_PLTRELSZ); } else { Elf_Addr *plt; - int numplt, i; + int numplt, n; /* Relocate processor-specific tags. */ object->Dyn.info[DT_PROC(DT_PPC64_GLINK)] += object->obj_base; @@ -289,10 +289,9 @@ _dl_md_reloc_got(elf_object_t *object, int lazy) numplt = object->Dyn.info[DT_PLTRELSZ] / sizeof(Elf_RelA); plt[0] = (uint64_t)_dl_bind_start; plt[1] = (uint64_t)object; - // offset 2 as first two entries are rtld parameters - for (i = 2; i < numplt+2; i++) { - plt[i] = object->Dyn.info[DT_PROC(DT_PPC64_GLINK)] + - i*4 + 24; + for (n = 0; n < numplt; n++) { + plt[n + 2] = object->Dyn.info[DT_PROC(DT_PPC64_GLINK)] + + n * 4 + 32; } } |