Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc64/sparc64 Fix R_SPARC_OLO10 relocations.



details:   https://anonhg.NetBSD.org/src/rev/1fd4414ebd7b
branches:  trunk
changeset: 754502:1fd4414ebd7b
user:      martin <martin%NetBSD.org@localhost>
date:      Sun May 02 11:43:30 2010 +0000

description:
Fix R_SPARC_OLO10 relocations.
XXX this whole code does not look like it would have a chance to work on
32bit kernels, but I can't test right now.

diffstat:

 sys/arch/sparc64/sparc64/kobj_machdep.c |  12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diffs (47 lines):

diff -r 129bf383a16e -r 1fd4414ebd7b sys/arch/sparc64/sparc64/kobj_machdep.c
--- a/sys/arch/sparc64/sparc64/kobj_machdep.c   Sun May 02 11:11:36 2010 +0000
+++ b/sys/arch/sparc64/sparc64/kobj_machdep.c   Sun May 02 11:43:30 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kobj_machdep.c,v 1.3 2009/05/20 08:32:35 jnemeth Exp $ */
+/*     $NetBSD: kobj_machdep.c,v 1.4 2010/05/02 11:43:30 martin Exp $  */
 
 /*-
  * Copyright (c) 2001 Jake Burkholder.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kobj_machdep.c,v 1.3 2009/05/20 08:32:35 jnemeth Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kobj_machdep.c,v 1.4 2010/05/02 11:43:30 martin Exp $");
 
 #define        ELFSIZE         ARCH_ELFSIZE
 
@@ -164,7 +164,7 @@
        _BM(22), _BM(10),               /* _HIPLT22, LOPLT10 */
        _BM(32), _BM(22), _BM(10),      /* _PCPLT32, _PCPLT22, _PCPLT10 */
        _BM(10), _BM(11), -1,           /* _10, _11, _64 */
-       _BM(13), _BM(22),               /* _OLO10, _HH22 */
+       _BM(10), _BM(22),               /* _OLO10, _HH22 */
        _BM(10), _BM(22),               /* _HM10, _LM22 */
        _BM(22), _BM(10), _BM(22),      /* _PC_HH22, _PC_HM10, _PC_LM22 */
        _BM(16), _BM(19),               /* _WDISP16, _WDISP19 */
@@ -203,6 +203,9 @@
        if (rtype == R_SPARC_NONE)
                return 0;
 
+       if ((rtype & 0x00ff) == R_SPARC_OLO10)
+               rtype = R_SPARC_OLO10;
+
        if (rtype == R_SPARC_RELATIVE) {
                kobj_stat(ko, &base, NULL);
                value = rela->r_addend + (Elf_Addr)base;
@@ -212,8 +215,7 @@
        }
 
        if (rtype == R_SPARC_JMP_SLOT || rtype == R_SPARC_COPY ||
-           rtype >= sizeof(reloc_target_bitmask) /
-           sizeof(*reloc_target_bitmask))
+           rtype >= __arraycount(reloc_target_bitmask))
                return -1;
 
        if (RELOC_UNALIGNED(rtype))



Home | Main Index | Thread Index | Old Index