summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/alpha/alpha/elf_machdep.c14
-rw-r--r--sys/amd64/amd64/elf_machdep.c14
-rw-r--r--sys/i386/i386/elf_machdep.c14
-rw-r--r--sys/ia64/ia64/elf_machdep.c15
-rw-r--r--sys/kern/link_elf.c9
-rw-r--r--sys/kern/link_elf_obj.c9
-rw-r--r--sys/powerpc/powerpc/elf_machdep.c14
-rw-r--r--sys/sparc64/sparc64/elf_machdep.c14
-rw-r--r--sys/sys/linker.h3
9 files changed, 106 insertions, 0 deletions
diff --git a/sys/alpha/alpha/elf_machdep.c b/sys/alpha/alpha/elf_machdep.c
index ddeae1b..285a174 100644
--- a/sys/alpha/alpha/elf_machdep.c
+++ b/sys/alpha/alpha/elf_machdep.c
@@ -172,3 +172,17 @@ elf_reloc(linker_file_t lf, const void *data, int type)
}
return(0);
}
+
+int
+elf_cpu_load_file(linker_file_t lf __unused)
+{
+
+ return (0);
+}
+
+int
+elf_cpu_unload_file(linker_file_t lf __unused)
+{
+
+ return (0);
+}
diff --git a/sys/amd64/amd64/elf_machdep.c b/sys/amd64/amd64/elf_machdep.c
index 619b077..71520de 100644
--- a/sys/amd64/amd64/elf_machdep.c
+++ b/sys/amd64/amd64/elf_machdep.c
@@ -169,3 +169,17 @@ elf_reloc(linker_file_t lf, const void *data, int type)
}
return(0);
}
+
+int
+elf_cpu_load_file(linker_file_t lf __unused)
+{
+
+ return (0);
+}
+
+int
+elf_cpu_unload_file(linker_file_t lf __unused)
+{
+
+ return (0);
+}
diff --git a/sys/i386/i386/elf_machdep.c b/sys/i386/i386/elf_machdep.c
index 619b077..71520de 100644
--- a/sys/i386/i386/elf_machdep.c
+++ b/sys/i386/i386/elf_machdep.c
@@ -169,3 +169,17 @@ elf_reloc(linker_file_t lf, const void *data, int type)
}
return(0);
}
+
+int
+elf_cpu_load_file(linker_file_t lf __unused)
+{
+
+ return (0);
+}
+
+int
+elf_cpu_unload_file(linker_file_t lf __unused)
+{
+
+ return (0);
+}
diff --git a/sys/ia64/ia64/elf_machdep.c b/sys/ia64/ia64/elf_machdep.c
index 5b2bc2e..ea8695f 100644
--- a/sys/ia64/ia64/elf_machdep.c
+++ b/sys/ia64/ia64/elf_machdep.c
@@ -46,6 +46,7 @@
#include <machine/elf.h>
#include <machine/md_var.h>
+#include <machine/unwind.h>
struct sysentvec elf64_freebsd_sysvec = {
SYS_MAXSYSCALL,
@@ -215,3 +216,17 @@ elf_reloc(linker_file_t lf, const void *data, int type)
return (0);
}
+
+int
+elf_cpu_load_file(linker_file_t lf __unused)
+{
+
+ return (0);
+}
+
+int
+elf_cpu_unload_file(linker_file_t lf __unused)
+{
+
+ return (0);
+}
diff --git a/sys/kern/link_elf.c b/sys/kern/link_elf.c
index bbbaa2c..75c95cd 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;
diff --git a/sys/kern/link_elf_obj.c b/sys/kern/link_elf_obj.c
index bbbaa2c..75c95cd 100644
--- a/sys/kern/link_elf_obj.c
+++ b/sys/kern/link_elf_obj.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;
diff --git a/sys/powerpc/powerpc/elf_machdep.c b/sys/powerpc/powerpc/elf_machdep.c
index c1627b1..e00c9d3 100644
--- a/sys/powerpc/powerpc/elf_machdep.c
+++ b/sys/powerpc/powerpc/elf_machdep.c
@@ -163,3 +163,17 @@ elf_reloc(linker_file_t lf, const void *data, int type)
}
return(0);
}
+
+int
+elf_cpu_load_file(linker_file_t lf __unused)
+{
+
+ return (0);
+}
+
+int
+elf_cpu_unload_file(linker_file_t lf __unused)
+{
+
+ return (0);
+}
diff --git a/sys/sparc64/sparc64/elf_machdep.c b/sys/sparc64/sparc64/elf_machdep.c
index 4889bc9..e4860c8 100644
--- a/sys/sparc64/sparc64/elf_machdep.c
+++ b/sys/sparc64/sparc64/elf_machdep.c
@@ -312,3 +312,17 @@ elf_reloc(linker_file_t lf, const void *data, int type)
return (0);
}
+
+int
+elf_cpu_load_file(linker_file_t lf __unused)
+{
+
+ return (0);
+}
+
+int
+elf_cpu_unload_file(linker_file_t lf __unused)
+{
+
+ return (0);
+}
diff --git a/sys/sys/linker.h b/sys/sys/linker.h
index d15a387..5e0a760 100644
--- a/sys/sys/linker.h
+++ b/sys/sys/linker.h
@@ -233,6 +233,9 @@ Elf_Addr elf_lookup(linker_file_t, Elf_Word, int);
const Elf_Sym *elf_get_sym(linker_file_t _lf, Elf_Word _symidx);
const char *elf_get_symname(linker_file_t _lf, Elf_Word _symidx);
+int elf_cpu_load_file(linker_file_t);
+int elf_cpu_unload_file(linker_file_t);
+
/* values for type */
#define ELF_RELOC_REL 1
#define ELF_RELOC_RELA 2
OpenPOWER on IntegriCloud