Source-Changes-HG archive

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

[src/trunk]: src/sys/kern print the index of the problematic symbol



details:   https://anonhg.NetBSD.org/src/rev/10cc3475329b
branches:  trunk
changeset: 973347:10cc3475329b
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Jun 27 17:27:59 2020 +0000

description:
print the index of the problematic symbol

diffstat:

 sys/kern/subr_kobj.c |  21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)

diffs (69 lines):

diff -r 7982b34ccf68 -r 10cc3475329b sys/kern/subr_kobj.c
--- a/sys/kern/subr_kobj.c      Sat Jun 27 17:23:08 2020 +0000
+++ b/sys/kern/subr_kobj.c      Sat Jun 27 17:27:59 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_kobj.c,v 1.66 2018/06/23 14:22:30 jakllsch Exp $  */
+/*     $NetBSD: subr_kobj.c,v 1.67 2020/06/27 17:27:59 christos Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_kobj.c,v 1.66 2018/06/23 14:22:30 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_kobj.c,v 1.67 2020/06/27 17:27:59 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_modular.h"
@@ -889,7 +889,8 @@
                 * Don't even try to lookup the symbol if the index is
                 * bogus.
                 */
-               kobj_error(ko, "symbol index out of range");
+               kobj_error(ko, "symbol index %ju out of range",
+                   (uintmax_t)symidx);
                return EINVAL;
        }
 
@@ -903,7 +904,8 @@
        switch (ELF_ST_BIND(sym->st_info)) {
        case STB_LOCAL:
                /* Local, but undefined? huh? */
-               kobj_error(ko, "local symbol undefined");
+               kobj_error(ko, "local symbol @%ju undefined",
+                   (uintmax_t)symidx);
                return EINVAL;
 
        case STB_GLOBAL:
@@ -912,11 +914,13 @@
 
                /* Force a lookup failure if the symbol name is bogus. */
                if (*symbol == 0) {
-                       kobj_error(ko, "bad symbol name");
+                       kobj_error(ko, "bad symbol @%ju name",
+                           (uintmax_t)symidx);
                        return EINVAL;
                }
                if (sym->st_value == 0) {
-                       kobj_error(ko, "bad value");
+                       kobj_error(ko, "%s @%ju: bad value", symbol,
+                           (uintmax_t)symidx);
                        return EINVAL;
                }
 
@@ -924,10 +928,13 @@
                return 0;
 
        case STB_WEAK:
-               kobj_error(ko, "weak symbols not supported");
+               kobj_error(ko, "weak symbol @%ju not supported",
+                   (uintmax_t)symidx);
                return EINVAL;
 
        default:
+               kobj_error(ko, "bad binding %#x for symbol @%ju",
+                   ELF_ST_BIND(sym->st_info), (uintmax_t)symidx);
                return EINVAL;
        }
 }



Home | Main Index | Thread Index | Old Index