Source-Changes-HG archive

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

[src/netbsd-6]: src/libexec/ld.elf_so Pull up revisions:



details:   https://anonhg.NetBSD.org/src/rev/1a18cb80f5fd
branches:  netbsd-6
changeset: 774380:1a18cb80f5fd
user:      jdc <jdc%NetBSD.org@localhost>
date:      Wed Aug 08 06:24:51 2012 +0000

description:
Pull up revisions:
  src/libexec/ld.elf_so/headers.c revision 1.42
  src/libexec/ld.elf_so/arch/sparc64/mdreloc.c revision 1.53
(requested by martin in ticket #447).

Remove a debug assert that does not hold for PIE (e.g. phdr = 0x40, but
obj has not been mapped at 0, so obj->phdr is 0x100040).
OK: skrll

Add special handling needed for OLO10 relocations.
First part of fixing PR port-sparc64/46724.

diffstat:

 libexec/ld.elf_so/arch/sparc64/mdreloc.c |  19 +++++++++++++++----
 libexec/ld.elf_so/headers.c              |   5 ++---
 2 files changed, 17 insertions(+), 7 deletions(-)

diffs (80 lines):

diff -r 72490f0234ea -r 1a18cb80f5fd libexec/ld.elf_so/arch/sparc64/mdreloc.c
--- a/libexec/ld.elf_so/arch/sparc64/mdreloc.c  Wed Aug 08 06:18:59 2012 +0000
+++ b/libexec/ld.elf_so/arch/sparc64/mdreloc.c  Wed Aug 08 06:24:51 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mdreloc.c,v 1.52 2011/03/30 08:37:52 martin Exp $      */
+/*     $NetBSD: mdreloc.c,v 1.52.6.1 2012/08/08 06:24:51 jdc Exp $     */
 
 /*-
  * Copyright (c) 2000 Eduardo Horvath.
@@ -32,7 +32,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: mdreloc.c,v 1.52 2011/03/30 08:37:52 martin Exp $");
+__RCSID("$NetBSD: mdreloc.c,v 1.52.6.1 2012/08/08 06:24:51 jdc Exp $");
 #endif /* not lint */
 
 #include <errno.h>
@@ -323,6 +323,10 @@
                if (type == R_TYPE(NONE))
                        continue;
 
+               /* OLO10 relocations have extra info */
+               if ((type & 0x00ff) == R_SPARC_OLO10)
+                       type = R_SPARC_OLO10;
+
                /* We do JMP_SLOTs in _rtld_bind() below */
                if (type == R_TYPE(JMP_SLOT))
                        continue;
@@ -335,8 +339,10 @@
                 * We use the fact that relocation types are an `enum'
                 * Note: R_SPARC_TLS_TPOFF64 is currently numerically largest.
                 */
-               if (type > R_TYPE(TLS_TPOFF64))
-                       return (-1);
+               if (type > R_TYPE(TLS_TPOFF64)) {
+                       dbg(("unknown relocation type %x at %p", type, rela));
+                       return -1;
+               }
 
                value = rela->r_addend;
 
@@ -422,6 +428,11 @@
                        value += (Elf_Addr)(defobj->relocbase + def->st_value);
                }
 
+               if (type == R_SPARC_OLO10) {
+                       value = (value & 0x3ff)
+                           + (((Elf64_Xword)rela->r_info<<32)>>40);
+               }
+
                if (RELOC_PC_RELATIVE(type)) {
                        value -= (Elf_Addr)where;
                }
diff -r 72490f0234ea -r 1a18cb80f5fd libexec/ld.elf_so/headers.c
--- a/libexec/ld.elf_so/headers.c       Wed Aug 08 06:18:59 2012 +0000
+++ b/libexec/ld.elf_so/headers.c       Wed Aug 08 06:24:51 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: headers.c,v 1.41 2011/06/25 05:45:12 nonaka Exp $       */
+/*     $NetBSD: headers.c,v 1.41.4.1 2012/08/08 06:24:51 jdc Exp $      */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: headers.c,v 1.41 2011/06/25 05:45:12 nonaka Exp $");
+__RCSID("$NetBSD: headers.c,v 1.41.4.1 2012/08/08 06:24:51 jdc Exp $");
 #endif /* not lint */
 
 #include <err.h>
@@ -356,7 +356,6 @@
                    obj->phsize, (long)obj->relocbase));
                break;
        }
-       assert(obj->phdr == phdr);
        
        for (ph = phdr; ph < phlimit; ++ph) {
                vaddr = (Elf_Addr)(uintptr_t)(obj->relocbase + ph->p_vaddr);



Home | Main Index | Thread Index | Old Index