diff --git a/sys/alpha/alpha/elf_machdep.c b/sys/alpha/alpha/elf_machdep.c index ddeae1ba561b..285a17441290 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 619b0777ab9c..71520de1747a 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 619b0777ab9c..71520de1747a 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 5b2bc2eec3a1..ea8695fda0a7 100644 --- a/sys/ia64/ia64/elf_machdep.c +++ b/sys/ia64/ia64/elf_machdep.c @@ -46,6 +46,7 @@ #include #include +#include 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 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; diff --git a/sys/kern/link_elf_obj.c b/sys/kern/link_elf_obj.c index bbbaa2ca3275..75c95cda179c 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 c1627b1b9f8a..e00c9d385363 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 4889bc9ab881..e4860c857de1 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 d15a3872e53a..5e0a76050d34 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