Linking panic

Matthew Dillon dillon at apollo.backplane.com
Fri Nov 21 14:55:09 PST 2003


:Hi !
:
:>     What revision of /usr/src/sys/kern/link_elf.c and kern_linker.c do you
:>     have?  The revision is the $DragonFly line in the comments near the
:>     top of each file.
:*grin* I know about ident and RCS :-) SCNR
:It's 1.10 resp. 1.15.
:
:Cheers
:Peter

    Those are the correct versions.

    The debugging patch I gave you was bogus... one of the printf's
    is doing a null pointer indirection.  Try this one instead.  "LC"
    lines and "LINKER" lines and "Get sysinit_set" lines and anything
    else near the panic.

    What doesn't make sense is that it appears to be trying to access
    an unrelocated memory location.  There was a bug in link_elf 1.9
    that could cause that but it was fixed in 1.10.

Index: kern_linker.c
===================================================================
RCS file: /cvs/src/sys/kern/kern_linker.c,v
retrieving revision 1.15
diff -u -r1.15 kern_linker.c
--- kern_linker.c	20 Nov 2003 22:07:33 -0000	1.15
+++ kern_linker.c	21 Nov 2003 22:51:52 -0000
@@ -1002,20 +1002,32 @@
 	for (lc = TAILQ_FIRST(&classes); lc; lc = TAILQ_NEXT(lc, link)) {
 	    error = lc->ops->load_file(modname, &lf);
 	    if (error) {
+		printf("LC %p %s error %d\n", lc, lc->desc, error);
 		lf = NULL;
 		break;
+	    } else if (lf) {
+		printf("LC %p %s found %s\n", lc, lc->desc, lf->filename);
+	    } else {
+		printf("LC %p %s (not found)\n", lc, lc->desc);
 	    }
 	}
 	if (lf) {
+	    printf("LINKER file %s\n", lf->filename);
 	    lf->userrefs++;
 
 	    if (linker_file_lookup_set(lf, "sysinit_set", &si_start, &si_stop, NULL) == 0) {
+		printf("Get sysinit_set: %p %p\n", si_start, si_stop);
 		/* HACK ALERT!
 		 * This is to set the sysinit moduledata so that the module
 		 * can attach itself to the correct containing file.
 		 * The sysinit could be run at *any* time.
 		 */
 		for (sipp = si_start; sipp < si_stop; sipp++) {
+		     if (*sipp == NULL) {
+			 printf("PROBLEM! *sipp is NULL at %p\n", *sipp);
+			 continue;
+		     }
+
 		    if ((*sipp)->func == module_register_init) {
 			moddata = (*sipp)->udata;
 			error = module_register(moddata, lf);





More information about the Kernel mailing list