Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/hppa/hppa Fix DIR21L relocations where we missed a ...



details:   https://anonhg.NetBSD.org/src/rev/e7d7256a983c
branches:  trunk
changeset: 772008:e7d7256a983c
user:      skrll <skrll%NetBSD.org@localhost>
date:      Tue Dec 13 12:55:50 2011 +0000

description:
Fix DIR21L relocations where we missed a bit of 'b'

Add support for DPREL relocations.

Modulo debug information in modules /usr/tests/modules now passes all
tests on NetBSD/hp700 (with a MODULAR kernel)

diffstat:

 sys/arch/hppa/hppa/kobj_machdep.c |  32 ++++++++++++++++++++++++++------
 1 files changed, 26 insertions(+), 6 deletions(-)

diffs (69 lines):

diff -r 1cda000666d2 -r e7d7256a983c sys/arch/hppa/hppa/kobj_machdep.c
--- a/sys/arch/hppa/hppa/kobj_machdep.c Tue Dec 13 12:29:19 2011 +0000
+++ b/sys/arch/hppa/hppa/kobj_machdep.c Tue Dec 13 12:55:50 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kobj_machdep.c,v 1.5 2009/04/30 15:34:24 skrll Exp $   */
+/*     $NetBSD: kobj_machdep.c,v 1.6 2011/12/13 12:55:50 skrll Exp $   */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -52,7 +52,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kobj_machdep.c,v 1.5 2009/04/30 15:34:24 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kobj_machdep.c,v 1.6 2011/12/13 12:55:50 skrll Exp $");
 
 #define        ELFSIZE         ARCH_ELFSIZE
 
@@ -105,6 +105,9 @@
        Elf_Addr addr, value;
        Elf_Word rtype, symidx;
        const Elf_Rela *rela;
+       extern int __data_start;
+
+       unsigned int GP = (int) &__data_start;
 
        if (!isrela) {
                printf("kobj_reloc: only support RELA relocations\n");
@@ -151,7 +154,7 @@
                value = LR(addr, value);
                *where |=
                    (((value >> 31) & 0x001) <<  0) |
-                   (((value >> 20) & 0x3ff) <<  1) |
+                   (((value >> 20) & 0x7ff) <<  1) |
                    (((value >> 18) & 0x003) << 14) |
                    (((value >> 13) & 0x01f) << 16) |
                    (((value >> 11) & 0x003) << 12);
@@ -170,11 +173,28 @@
                    (((value & 0x003ff) << 1) << 2);            /* w2 */
                break;
 
-#if 0
-       case R_TYPE(DPREL17F):
+       case R_TYPE(DPREL14R):
+               /* RR(symbol - GP, addend) */
+               addr = kobj_sym_lookup(ko, symidx);
+               value = RR(addr - GP, value);
+               *where |=
+                    (((value >>  0) & 0x1fff) << 1) |
+                    (((value >> 13) & 0x1) << 0);
+               break;
+
+
        case R_TYPE(DPREL21L):
+               /* LR(symbol - GP, addend) */
+               addr = kobj_sym_lookup(ko, symidx);
+               value = LR(addr - GP, value);
+               *where |=
+                   (((value >> 31) & 0x001) <<  0) |
+                   (((value >> 20) & 0x7ff) <<  1) |
+                   (((value >> 18) & 0x003) << 14) |
+                   (((value >> 13) & 0x01f) << 16) |
+                   (((value >> 11) & 0x003) << 12);
                break;
-#endif
+
        case R_TYPE(SEGREL32):
                /* symbol - SB + addend */
                /* XXX SB */



Home | Main Index | Thread Index | Old Index