Re: Modules with list

From: Adam J. Richter (adam@yggdrasil.com)
Date: Wed Nov 27 2002 - 14:04:30 EST


        I wrote two really buggy examples in my previous reply
to Kai. First of all, here is a more "correct" version of
vmlinux.lds.S for determining the disposition of devexit at
kernel load time, although I don't know if ld will allow it:

--- linux/arch/i386/vmlinux.lds.S.orig 2002-11-27 09:51:42.000000000 -0800
+++ linux/arch/i386/vmlinux.lds.S 2002-11-27 10:56:20.000000000 -0800
@@ -1,6 +1,8 @@
 /* ld script to make i386 Linux kernel
  * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>;
  */
+#include <linux/config.h>
+
 OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
 OUTPUT_ARCH(i386)
 ENTRY(_start)
@@ -12,6 +14,9 @@
   _text = .; /* Text and read-only data */
   .text : {
        *(.text)
+#ifdef CONFIG_HOTPLUG
+ *(.devexit.text)
+#endif
        *(.fixup)
        *(.gnu.warning)
        } = 0x9090
@@ -38,6 +43,9 @@
   /* writeable */
   .data : { /* Data */
        *(.data)
+#ifdef CONFIG_HOTPLUG
+ *(.devexit.data)
+#endif
        CONSTRUCTORS
        }
 
@@ -96,6 +104,13 @@
 
   _end = . ;
 
+#ifndef CONFIG_HOTPLUG
+ .discard : {
+ *(.devexit.text)
+ *(.devexit.data)
+ } = 0x001 /* Like bss: SEC_ALLOC, but no SEC_LOAD */
+#endif
+
   /* Sections to be discarded */
   /DISCARD/ : {
        *(.exit.text)

Also here is a "corrected" bit of untested code for clearing
devexit references at module load time:

        if (!module->removable) {
                void ***pptr = module->devexit_p_start;
                while (pptr != module->devexit_p_end) {
                        **pptr = NULL;
                        pptr++;
                }
        }

Sorry for responding too hastily before.

Adam J. Richter __ ______________ 575 Oroville Road
adam@yggdrasil.com \ / Milpitas, California 95035
+1 408 309-6081 | g g d r a s i l United States of America
                         "Free Software For The Rest Of Us."
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Nov 30 2002 - 22:00:18 EST