aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChandramouli Narayanan <chandramouli.narayanan@intel.com>2012-08-22 11:37:50 +0100
committerMatt Fleming <matt.fleming@intel.com>2012-08-22 11:42:19 +0100
commit48b044fc7fc2c0ebb53c3963e9dc75629ae30414 (patch)
treeec5b75f2c3269ae91bcb469600648acb95935633
parenta98721fcd284bfc73bf5b5c422760817f0ba8bb2 (diff)
downloadsyslinux-48b044fc7fc2c0ebb53c3963e9dc75629ae30414.tar.gz
syslinux-48b044fc7fc2c0ebb53c3963e9dc75629ae30414.tar.xz
syslinux-48b044fc7fc2c0ebb53c3963e9dc75629ae30414.zip
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@intel.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
-rw-r--r--com32/lib/i386/elf.ld10
-rw-r--r--com32/lib/sys/module/common.c2
-rw-r--r--com32/lib/sys/module/elf_module.c2
-rw-r--r--com32/lib/x86_64/elf.ld10
4 files changed, 6 insertions, 18 deletions
diff --git a/com32/lib/i386/elf.ld b/com32/lib/i386/elf.ld
index 158badbb..fc2e7db5 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 dc3754c4..e6af4860 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 d9732729..4ee296c4 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 bf9881f1..4e88bcb0 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)) }