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/arch/sparc64 Since GNU ld doesn't honor th...



details:   https://anonhg.NetBSD.org/src/rev/f93a3a653c15
branches:  trunk
changeset: 828668:f93a3a653c15
user:      joerg <joerg%NetBSD.org@localhost>
date:      Mon Dec 25 17:00:15 2017 +0000

description:
Since GNU ld doesn't honor the PLT entry reservation, also compensate
for JMP_IREL relocations at the start of the PLT.

diffstat:

 libexec/ld.elf_so/arch/sparc64/mdreloc.c |  15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diffs (50 lines):

diff -r 325842a063b1 -r f93a3a653c15 libexec/ld.elf_so/arch/sparc64/mdreloc.c
--- a/libexec/ld.elf_so/arch/sparc64/mdreloc.c  Mon Dec 25 12:38:01 2017 +0000
+++ b/libexec/ld.elf_so/arch/sparc64/mdreloc.c  Mon Dec 25 17:00:15 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mdreloc.c,v 1.66 2017/11/06 21:16:04 joerg Exp $       */
+/*     $NetBSD: mdreloc.c,v 1.67 2017/12/25 17:00:15 joerg Exp $       */
 
 /*-
  * Copyright (c) 2000 Eduardo Horvath.
@@ -32,7 +32,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: mdreloc.c,v 1.66 2017/11/06 21:16:04 joerg Exp $");
+__RCSID("$NetBSD: mdreloc.c,v 1.67 2017/12/25 17:00:15 joerg Exp $");
 #endif /* not lint */
 
 #include <errno.h>
@@ -533,7 +533,8 @@
 
        result = 0;     /* XXX gcc */
 
-       if (ELF_R_TYPE(obj->pltrela->r_info) == R_TYPE(JMP_SLOT)) {
+       if (ELF_R_TYPE(obj->pltrela->r_info) == R_TYPE(JMP_SLOT) ||
+           ELF_R_TYPE(obj->pltrela->r_info) == R_TYPE(JMP_IREL)) {
                /*
                 * XXXX
                 *
@@ -546,8 +547,9 @@
                 * 
                 * So, to provide binary compatibility, we will check the first
                 * entry, if it is reserved it should not be of the type
-                * JMP_SLOT.  If it is JMP_SLOT, then the 4 reserved entries
-                * were not generated and our index is 4 entries too far.
+                * JMP_SLOT or JMP_REL.  If it is either of those, then
+                * the 4 reserved entries were not generated and our index
+                * is 4 entries too far.
                 */
                rela -= 4;
        }
@@ -572,7 +574,8 @@
         * Check for first four reserved entries - and skip them.
         * See above for details.
         */
-       if (ELF_R_TYPE(obj->pltrela->r_info) != R_TYPE(JMP_SLOT))
+       if (ELF_R_TYPE(obj->pltrela->r_info) != R_TYPE(JMP_SLOT) &&
+           ELF_R_TYPE(obj->pltrela->r_info) != R_TYPE(JMP_IREL))
                rela += 4;
 
        for (; rela < obj->pltrelalim; rela++)



Home | Main Index | Thread Index | Old Index