diff options
author | peter <peter@FreeBSD.org> | 2004-05-16 20:00:28 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2004-05-16 20:00:28 +0000 |
commit | ea4215c5218f4d79c33e806304e35cc951ea3dc7 (patch) | |
tree | 9c824fecb4de303fa016d7216c651ec04ecaec13 /sys/arm | |
parent | 1eee96e5b10a90bb98c51684bf6fa7c4b4d1c57f (diff) | |
download | FreeBSD-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/arm')
-rw-r--r-- | sys/arm/arm/elf_machdep.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/sys/arm/arm/elf_machdep.c b/sys/arm/arm/elf_machdep.c index 373e937..303832b 100644 --- a/sys/arm/arm/elf_machdep.c +++ b/sys/arm/arm/elf_machdep.c @@ -104,9 +104,9 @@ SYSINIT(oelf32, SI_SUB_EXEC, SI_ORDER_ANY, /* 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; Elf_Addr addr; Elf_Addr addend; @@ -148,7 +148,7 @@ elf_reloc_internal(linker_file_t lf, const void *data, int type, int local) break; case R_ARM_PC24: /* S + A - P */ - addr = elf_lookup(lf, symidx, 1); + addr = lookup(lf, symidx, 1); if (addr == 0) return -1; addr += addend - (Elf_Addr)where; @@ -166,7 +166,7 @@ elf_reloc_internal(linker_file_t lf, const void *data, int type, int local) break; case R_ARM_GLOB_DAT: /* S */ - addr = elf_lookup(lf, symidx, 1); + addr = lookup(lf, symidx, 1); if (addr == 0) return -1; if (*where != addr) @@ -185,17 +185,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 |