summaryrefslogtreecommitdiffstats
path: root/sys/ia64
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2004-05-16 20:00:28 +0000
committerpeter <peter@FreeBSD.org>2004-05-16 20:00:28 +0000
commitea4215c5218f4d79c33e806304e35cc951ea3dc7 (patch)
tree9c824fecb4de303fa016d7216c651ec04ecaec13 /sys/ia64
parent1eee96e5b10a90bb98c51684bf6fa7c4b4d1c57f (diff)
downloadFreeBSD-src-ea4215c5218f4d79c33e806304e35cc951ea3dc7.zip
FreeBSD-src-ea4215c5218f4d79c33e806304e35cc951ea3dc7.tar.gz
Make a small revision to the api between the elf linker core and the
elf_reloc() backends for two reasons. First, to support the possibility of there being two elf linkers in the kernel (eg: amd64), and second, to pass the relocbase explicitly (for relocating .o format kld files).
Diffstat (limited to 'sys/ia64')
-rw-r--r--sys/ia64/ia64/elf_machdep.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/sys/ia64/ia64/elf_machdep.c b/sys/ia64/ia64/elf_machdep.c
index 1c7f1d2..b40c21e 100644
--- a/sys/ia64/ia64/elf_machdep.c
+++ b/sys/ia64/ia64/elf_machdep.c
@@ -143,7 +143,7 @@ ia64_coredump(struct thread *td, struct vnode *vp, off_t limit)
}
static Elf_Addr
-lookup_fdesc(linker_file_t lf, Elf_Word symidx)
+lookup_fdesc(linker_file_t lf, Elf_Word symidx, elf_lookup_fn lookup)
{
linker_file_t top;
Elf_Addr addr;
@@ -151,7 +151,7 @@ lookup_fdesc(linker_file_t lf, Elf_Word symidx)
int i;
static int eot = 0;
- addr = elf_lookup(lf, symidx, 0);
+ addr = lookup(lf, symidx, 0);
if (addr == 0) {
top = lf;
symname = elf_get_symname(top, symidx);
@@ -191,7 +191,8 @@ lookup_fdesc(linker_file_t lf, Elf_Word symidx)
/* Process one elf relocation with addend. */
static int
-elf_reloc_internal(linker_file_t lf, const void *data, int type, int local)
+elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data,
+ int type, int local, elf_lookup_fn lookup)
{
Elf_Addr relocbase = (Elf_Addr)lf->address;
Elf_Addr *where;
@@ -238,7 +239,7 @@ elf_reloc_internal(linker_file_t lf, const void *data, int type, int local)
case R_IA64_NONE:
break;
case R_IA64_DIR64LSB: /* word64 LSB S + A */
- addr = elf_lookup(lf, symidx, 1);
+ addr = lookup(lf, symidx, 1);
if (addr == 0)
return (-1);
*where = addr + addend;
@@ -248,7 +249,7 @@ elf_reloc_internal(linker_file_t lf, const void *data, int type, int local)
printf("%s: addend ignored for OPD relocation\n",
__func__);
}
- addr = lookup_fdesc(lf, symidx);
+ addr = lookup_fdesc(lf, symidx, lookup);
if (addr == 0)
return (-1);
*where = addr;
@@ -256,7 +257,7 @@ elf_reloc_internal(linker_file_t lf, const void *data, int type, int local)
case R_IA64_REL64LSB: /* word64 LSB BD + A */
break;
case R_IA64_IPLTLSB:
- addr = lookup_fdesc(lf, symidx);
+ addr = lookup_fdesc(lf, symidx, lookup);
if (addr == 0)
return (-1);
where[0] = *((Elf_Addr*)addr) + addend;
@@ -272,17 +273,19 @@ elf_reloc_internal(linker_file_t lf, const void *data, int type, int local)
}
int
-elf_reloc(linker_file_t lf, const void *data, int type)
+elf_reloc(linker_file_t lf, Elf_Addr relocbase, const void *data, int type,
+ elf_lookup_fn lookup)
{
- return (elf_reloc_internal(lf, data, type, 0));
+ return (elf_reloc_internal(lf, relocbase, data, type, 0, lookup));
}
int
-elf_reloc_local(linker_file_t lf, const void *data, int type)
+elf_reloc_local(linker_file_t lf, Elf_Addr relocbase, const void *data,
+ int type, elf_lookup_fn lookup)
{
- return (elf_reloc_internal(lf, data, type, 1));
+ return (elf_reloc_internal(lf, relocbase, data, type, 1, lookup));
}
int
OpenPOWER on IntegriCloud