Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/m68k/m68k Fix reloc calcurations (mechanically pull...



details:   https://anonhg.NetBSD.org/src/rev/cb5d77cc397b
branches:  trunk
changeset: 758032:cb5d77cc397b
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Thu Oct 14 16:33:50 2010 +0000

description:
Fix reloc calcurations (mechanically pulled from working i386 and sh3).
Now options MODULAR works at least on news68k:

# uname -mrs
NetBSD 5.99.39 news68k
# modstat|grep filesys
coredump         misc       filesys    2     2790     -
exec_aout        misc       filesys    0     1866     coredump
exec_elf32       misc       filesys    0     6072     coredump
exec_script      misc       filesys    0     972      -
kernfs           vfs        filesys    0     9734     -
mfs              vfs        filesys    0     3656     ffs
procfs           vfs        filesys    0     23924    -
#

diffstat:

 sys/arch/m68k/m68k/kobj_machdep.c |  15 ++++++---------
 1 files changed, 6 insertions(+), 9 deletions(-)

diffs (46 lines):

diff -r f444820d83b8 -r cb5d77cc397b sys/arch/m68k/m68k/kobj_machdep.c
--- a/sys/arch/m68k/m68k/kobj_machdep.c Thu Oct 14 16:31:16 2010 +0000
+++ b/sys/arch/m68k/m68k/kobj_machdep.c Thu Oct 14 16:33:50 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kobj_machdep.c,v 1.2 2008/04/28 20:23:27 martin Exp $  */
+/*     $NetBSD: kobj_machdep.c,v 1.3 2010/10/14 16:33:50 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kobj_machdep.c,v 1.2 2008/04/28 20:23:27 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kobj_machdep.c,v 1.3 2010/10/14 16:33:50 tsutsui Exp $");
 
 #define        ELFSIZE         ARCH_ELFSIZE
 
@@ -64,8 +64,7 @@
                addr = kobj_sym_lookup(ko, symnum);
                if (addr == 0)
                        return -1;
-               tmp = (Elf_Addr)(relocbase + addr +
-                   rela->r_addend) - (Elf_Addr)where;
+               tmp = (Elf_Addr)(addr + rela->r_addend) - (Elf_Addr)where;
                if (*where != tmp)
                        *where = tmp;
                break;
@@ -75,14 +74,12 @@
                addr = kobj_sym_lookup(ko, symnum);
                if (addr == 0)
                        return -1;
-               tmp = (Elf_Addr)(relocbase + addr +
-                   rela->r_addend);
-               if (*where != tmp)
-                       *where = tmp;
+               tmp = (Elf_Addr)(addr + *where + rela->r_addend);
+               *where = tmp;
                break;
 
        case R_TYPE(RELATIVE):
-               *where += (Elf_Addr)relocbase;
+               *where += (Elf_Addr)(relocbase + rela->r_addend);
                break;
 
        default:



Home | Main Index | Thread Index | Old Index