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
This commit is contained in:
parent
c143d6c24a
commit
1aeb23cdfa
sys
alpha/alpha
amd64/amd64
i386/i386
ia64/ia64
kern
powerpc/powerpc
sparc64/sparc64
sys
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user