aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/link_elf.c
diff options
context:
space:
mode:
authorMarcel Moolenaar <marcel@FreeBSD.org>2002-10-19 19:16:03 +0000
committerMarcel Moolenaar <marcel@FreeBSD.org>2002-10-19 19:16:03 +0000
commit1aeb23cdfad85fbb0905ff47a30c712552253c46 (patch)
treea5d88a56e3884938d35135eb41dd619975aba723 /sys/kern/link_elf.c
parentc143d6c24ad906e431d561038544af65d1eb6670 (diff)
downloadsrc-1aeb23cdfad85fbb0905ff47a30c712552253c46.tar.gz
src-1aeb23cdfad85fbb0905ff47a30c712552253c46.zip
Add two hooks to signal module load and module unload to MD code.
The primary reason for this is to allow MD code to process machine specific attributes, segments or sections in the ELF file and update machine specific state accordingly. An immediate use of this is in the ia64 port where unwind information is updated to allow debugging and tracing in/across modules. Note that this commit does not add the functionality to the ia64 port. See revision 1.9 of ia64/ia64/elf_machdep.c. Validated on: alpha, i386, ia64
Notes
Notes: svn path=/head/; revision=105469
Diffstat (limited to 'sys/kern/link_elf.c')
-rw-r--r--sys/kern/link_elf.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/kern/link_elf.c b/sys/kern/link_elf.c
index bbbaa2ca3275..75c95cda179c 100644
--- a/sys/kern/link_elf.c
+++ b/sys/kern/link_elf.c
@@ -222,6 +222,12 @@ link_elf_link_common_finish(linker_file_t lf)
elf_file_t ef = (elf_file_t)lf;
char *newfilename;
#endif
+ int error;
+
+ /* Notify MD code that a module is being loaded. */
+ error = elf_cpu_load_file(lf);
+ if (error)
+ return (error);
#ifdef DDB
GDB_STATE(RT_ADD);
@@ -838,6 +844,9 @@ link_elf_unload_file(linker_file_t file)
}
#endif
+ /* Notify MD code that a module is being unloaded. */
+ elf_cpu_unload_file(file);
+
if (ef->preloaded) {
link_elf_unload_preload(file);
return;