Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/libexec/ld.elf_so If REL(A)SZ extends into .rel(a).plt, trim...



details:   https://anonhg.NetBSD.org/src/rev/cb31fb4f1594
branches:  trunk
changeset: 536048:cb31fb4f1594
user:      mycroft <mycroft%NetBSD.org@localhost>
date:      Thu Sep 05 16:58:16 2002 +0000

description:
If REL(A)SZ extends into .rel(a).plt, trim rel(a)lim.  This is actually due to
what is arguably a bug in BFD on some platforms (at least PPC and SPARC), but
I can't fix old binaries.

diffstat:

 libexec/ld.elf_so/headers.c |  8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diffs (25 lines):

diff -r b583a4e91ef5 -r cb31fb4f1594 libexec/ld.elf_so/headers.c
--- a/libexec/ld.elf_so/headers.c       Thu Sep 05 16:33:57 2002 +0000
+++ b/libexec/ld.elf_so/headers.c       Thu Sep 05 16:58:16 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: headers.c,v 1.10 2002/07/10 15:12:34 fredette Exp $     */
+/*     $NetBSD: headers.c,v 1.11 2002/09/05 16:58:16 mycroft Exp $      */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -238,9 +238,15 @@
        obj->rellim = (const Elf_Rel *)((caddr_t)obj->rel + relsz);
        obj->relalim = (const Elf_Rela *)((caddr_t)obj->rela + relasz);
        if (plttype == DT_REL) {
+               /* On PPC and SPARC, at least, REL(A)SZ may include PLTREL. */
+               if (obj->rellim && obj->pltrel && obj->rellim > obj->pltrel)
+                       obj->rellim = obj->pltrel;
                obj->pltrellim = (const Elf_Rel *)((caddr_t)obj->pltrel + pltrelsz);
                obj->pltrelalim = 0;
        } else {
+               /* On PPC and SPARC, at least, REL(A)SZ may include PLTREL. */
+               if (obj->relalim && obj->pltrela && obj->relalim > obj->pltrela)
+                       obj->relalim = obj->pltrela;
                obj->pltrellim = 0;
                obj->pltrelalim = (const Elf_Rela *)((caddr_t)obj->pltrela + pltrelsz);
        }



Home | Main Index | Thread Index | Old Index