Add function link_elf_get_gp(), specific to ia64 for now, to get

the DT_PLTGOT value. On ia64 this is the value of GP. We need this
to construct function descriptors, but the elf file structure is
not exported to MD code.

Note that the name of the function is based on the meaning that
DT_PLTGOT has on ia64. This may differ on other architectures. As
such, link_elf_get_gp() has a high level of MD to it. Renaming the
function to describe what DT_* value is returned makes it generic,
but also makes the MD code less clear and if we only need this on
ia64, then a general name for a specific function doesn't help.

In short: I don't know what is "right" at this time, so I'll go
with what I have.
This commit is contained in:
Marcel Moolenaar 2002-04-21 21:08:30 +00:00
parent 3bf762b7f6
commit 8420105927
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=95228
2 changed files with 38 additions and 0 deletions

View File

@ -165,6 +165,10 @@ r_debug_state(struct r_debug *dummy_one __unused,
#endif
#ifdef __ia64__
Elf_Addr link_elf_get_gp(linker_file_t);
#endif
/*
* The kernel symbol table starts here.
*/
@ -1171,3 +1175,18 @@ link_elf_each_function_name(linker_file_t file,
}
return (0);
}
#ifdef __ia64__
/*
* Each KLD has its own GP. The GP value for each load module is given by
* DT_PLTGOT on ia64. We need GP to construct function descriptors, but
* don't have direct access to the ELF file structure. The link_elf_get_gp()
* function returns the GP given a pointer to a generic linker file struct.
*/
Elf_Addr
link_elf_get_gp(linker_file_t lf)
{
elf_file_t ef = (elf_file_t)lf;
return (Elf_Addr)ef->got;
}
#endif

View File

@ -165,6 +165,10 @@ r_debug_state(struct r_debug *dummy_one __unused,
#endif
#ifdef __ia64__
Elf_Addr link_elf_get_gp(linker_file_t);
#endif
/*
* The kernel symbol table starts here.
*/
@ -1171,3 +1175,18 @@ link_elf_each_function_name(linker_file_t file,
}
return (0);
}
#ifdef __ia64__
/*
* Each KLD has its own GP. The GP value for each load module is given by
* DT_PLTGOT on ia64. We need GP to construct function descriptors, but
* don't have direct access to the ELF file structure. The link_elf_get_gp()
* function returns the GP given a pointer to a generic linker file struct.
*/
Elf_Addr
link_elf_get_gp(linker_file_t lf)
{
elf_file_t ef = (elf_file_t)lf;
return (Elf_Addr)ef->got;
}
#endif