[syslinux:firmware] module: Define __{ctors,dtors}_end symbols
syslinux-bot for Chandramouli Narayanan
chandramouli.narayanan at intel.com
Fri Nov 9 09:06:25 PST 2012
Commit-ID: 48b044fc7fc2c0ebb53c3963e9dc75629ae30414
Gitweb: http://www.syslinux.org/commit/48b044fc7fc2c0ebb53c3963e9dc75629ae30414
Author: Chandramouli Narayanan <chandramouli.narayanan at intel.com>
AuthorDate: Wed, 22 Aug 2012 11:37:50 +0100
Committer: Matt Fleming <matt.fleming at intel.com>
CommitDate: Wed, 22 Aug 2012 11:42:19 +0100
module: Define __{ctors,dtors}_end symbols
This patch fixes linker script for module initialization. The old
__module_*_ptr symbols are no longer used, instead we now have an
array of constructors and destructors.
Signed-off-by: Chandramouli Narayanan <chandramouli.narayanan at intel.com>
Signed-off-by: Matt Fleming <matt.fleming at intel.com>
---
com32/lib/i386/elf.ld | 10 ++--------
com32/lib/sys/module/common.c | 2 +-
com32/lib/sys/module/elf_module.c | 2 +-
com32/lib/x86_64/elf.ld | 10 ++--------
4 files changed, 6 insertions(+), 18 deletions(-)
diff --git a/com32/lib/i386/elf.ld b/com32/lib/i386/elf.ld
index 158badb..fc2e7db 100644
--- a/com32/lib/i386/elf.ld
+++ b/com32/lib/i386/elf.ld
@@ -91,13 +91,9 @@ SECTIONS
__ctors_start = .;
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
- LONG(0x00000000)
- __module_init_ptr = .;
KEEP (*(.ctors_modinit))
- LONG(0x00000000)
- __module_main_ptr = .;
KEEP (*(.ctors_modmain))
- LONG(0x00000000)
+ __ctors_end = .;
}
.dtors :
@@ -105,10 +101,8 @@ SECTIONS
__dtors_start = .;
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
- LONG(0x00000000)
- __module_exit_ptr = .;
KEEP (*(.dtors_modexit))
- LONG(0x00000000)
+ __dtors_end = .;
}
.jcr : { KEEP (*(.jcr)) }
diff --git a/com32/lib/sys/module/common.c b/com32/lib/sys/module/common.c
index dc3754c..e6af486 100644
--- a/com32/lib/sys/module/common.c
+++ b/com32/lib/sys/module/common.c
@@ -423,7 +423,7 @@ int _module_unload(struct elf_module *module) {
int module_unload(struct elf_module *module) {
module_ctor_t *dtor;
- for (dtor = module->dtors; *dtor; dtor++)
+ for (dtor = module->dtors; dtor && *dtor; dtor++)
(*dtor) ();
return _module_unload(module);
diff --git a/com32/lib/sys/module/elf_module.c b/com32/lib/sys/module/elf_module.c
index d973272..4ee296c 100644
--- a/com32/lib/sys/module/elf_module.c
+++ b/com32/lib/sys/module/elf_module.c
@@ -288,7 +288,7 @@ int module_load(struct elf_module *module) {
(module->exit_func == NULL) ? NULL : *(module->exit_func));
*/
- for (ctor = module->ctors; *ctor; ctor++)
+ for (ctor = module->ctors; ctor && *ctor; ctor++)
(*ctor) ();
return 0;
diff --git a/com32/lib/x86_64/elf.ld b/com32/lib/x86_64/elf.ld
index bf9881f..4e88bcb 100644
--- a/com32/lib/x86_64/elf.ld
+++ b/com32/lib/x86_64/elf.ld
@@ -92,13 +92,9 @@ SECTIONS
__ctors_start = .;
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
- LONG(0x00000000)
- __module_init_ptr = .;
KEEP (*(.ctors_modinit))
- LONG(0x00000000)
- __module_main_ptr = .;
KEEP (*(.ctors_modmain))
- LONG(0x00000000)
+ __ctors_end = .;
}
.dtors :
@@ -106,10 +102,8 @@ SECTIONS
__dtors_start = .;
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
- LONG(0x00000000)
- __module_exit_ptr = .;
KEEP (*(.dtors_modexit))
- LONG(0x00000000)
+ __dtors_end = .;
}
.jcr : { KEEP (*(.jcr)) }
More information about the Syslinux-commits
mailing list