PERFORCE change 50541 for review
Peter Wemm
peter at FreeBSD.org
Tue Apr 6 17:23:48 PDT 2004
http://perforce.freebsd.org/chv.cgi?CH=50541
Change 50541 by peter at peter_daintree on 2004/04/06 17:21:03
Valiantly attempt to update other platform elf_machdep.c files after
I broke the API.
Affected files ...
.. //depot/projects/hammer/sys/alpha/alpha/elf_machdep.c#10 edit
.. //depot/projects/hammer/sys/amd64/amd64/elf_machdep.c#20 edit
.. //depot/projects/hammer/sys/i386/i386/elf_machdep.c#10 edit
.. //depot/projects/hammer/sys/ia64/ia64/elf_machdep.c#12 edit
.. //depot/projects/hammer/sys/powerpc/powerpc/elf_machdep.c#9 edit
.. //depot/projects/hammer/sys/sparc64/sparc64/elf_machdep.c#10 edit
Differences ...
==== //depot/projects/hammer/sys/alpha/alpha/elf_machdep.c#10 (text+ko) ====
@@ -108,9 +108,9 @@
/* 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 lu)
{
- Elf_Addr relocbase = (Elf_Addr) lf->address;
Elf_Addr *where;
Elf_Addr addr;
Elf_Addr addend;
@@ -152,7 +152,7 @@
break;
case R_ALPHA_REFQUAD:
- addr = elf_lookup(lf, symidx, 1);
+ addr = lu(lf, symidx, 1);
if (addr == 0)
return -1;
addr += addend;
@@ -161,7 +161,7 @@
break;
case R_ALPHA_GLOB_DAT:
- addr = elf_lookup(lf, symidx, 1);
+ addr = lu(lf, symidx, 1);
if (addr == 0)
return -1;
addr += addend;
@@ -171,7 +171,7 @@
case R_ALPHA_JMP_SLOT:
/* No point in lazy binding for kernel modules. */
- addr = elf_lookup(lf, symidx, 1);
+ addr = lu(lf, symidx, 1);
if (addr == 0)
return -1;
if (*where != addr)
@@ -198,17 +198,19 @@
}
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 lu)
{
- return (elf_reloc_internal(lf, data, type, 0));
+ return (elf_reloc_internal(lf, relocbase, data, type, 0, lu));
}
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 lu)
{
- return (elf_reloc_internal(lf, data, type, 1));
+ return (elf_reloc_internal(lf, relocbase, data, type, 1, lu));
}
int
==== //depot/projects/hammer/sys/amd64/amd64/elf_machdep.c#20 (text+ko) ====
@@ -104,7 +104,8 @@
/* Process one elf relocation with addend. */
static int
-elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data, int type, int local, elf_lookup_fn lu)
+elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data,
+ int type, int local, elf_lookup_fn lu)
{
Elf64_Addr *where, val;
Elf32_Addr *where32, val32;
@@ -201,14 +202,16 @@
}
int
-elf_reloc(linker_file_t lf, Elf_Addr relocbase, const void *data, int type, elf_lookup_fn lu)
+elf_reloc(linker_file_t lf, Elf_Addr relocbase, const void *data, int type,
+ elf_lookup_fn lu)
{
return (elf_reloc_internal(lf, relocbase, data, type, 0, lu));
}
int
-elf_reloc_local(linker_file_t lf, Elf_Addr relocbase, const void *data, int type, elf_lookup_fn lu)
+elf_reloc_local(linker_file_t lf, Elf_Addr relocbase, const void *data,
+ int type, elf_lookup_fn lu)
{
return (elf_reloc_internal(lf, relocbase, data, type, 1, lu));
==== //depot/projects/hammer/sys/i386/i386/elf_machdep.c#10 (text+ko) ====
@@ -104,9 +104,9 @@
/* 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 lu)
{
- Elf_Addr relocbase = (Elf_Addr) lf->address;
Elf_Addr *where;
Elf_Addr addr;
Elf_Addr addend;
@@ -148,7 +148,7 @@
break;
case R_386_32: /* S + A */
- addr = elf_lookup(lf, symidx, 1);
+ addr = lu(lf, symidx, 1);
if (addr == 0)
return -1;
addr += addend;
@@ -157,7 +157,7 @@
break;
case R_386_PC32: /* S + A - P */
- addr = elf_lookup(lf, symidx, 1);
+ addr = lu(lf, symidx, 1);
if (addr == 0)
return -1;
addr += addend - (Elf_Addr)where;
@@ -175,7 +175,7 @@
break;
case R_386_GLOB_DAT: /* S */
- addr = elf_lookup(lf, symidx, 1);
+ addr = lu(lf, symidx, 1);
if (addr == 0)
return -1;
if (*where != addr)
@@ -194,17 +194,19 @@
}
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 lu)
{
- return (elf_reloc_internal(lf, data, type, 0));
+ return (elf_reloc_internal(lf, relocbase, data, type, 0, lu));
}
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 lu)
{
- return (elf_reloc_internal(lf, data, type, 1));
+ return (elf_reloc_internal(lf, relocbase, data, type, 1, lu));
}
int
==== //depot/projects/hammer/sys/ia64/ia64/elf_machdep.c#12 (text+ko) ====
@@ -143,7 +143,7 @@
}
static Elf_Addr
-lookup_fdesc(linker_file_t lf, Elf_Word symidx)
+lookup_fdesc(linker_file_t lf, Elf_Word symidx, elf_lookup_fn lu)
{
linker_file_t top;
Elf_Addr addr;
@@ -151,7 +151,7 @@
int i;
static int eot = 0;
- addr = elf_lookup(lf, symidx, 0);
+ addr = lu(lf, symidx, 0);
if (addr == 0) {
top = lf;
symname = elf_get_symname(top, symidx);
@@ -191,7 +191,8 @@
/* 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 lu)
{
Elf_Addr relocbase = (Elf_Addr)lf->address;
Elf_Addr *where;
@@ -238,7 +239,7 @@
case R_IA64_NONE:
break;
case R_IA64_DIR64LSB: /* word64 LSB S + A */
- addr = elf_lookup(lf, symidx, 1);
+ addr = lu(lf, symidx, 1);
if (addr == 0)
return (-1);
*where = addr + addend;
@@ -248,7 +249,7 @@
printf("%s: addend ignored for OPD relocation\n",
__func__);
}
- addr = lookup_fdesc(lf, symidx);
+ addr = lookup_fdesc(lf, symidx, lu);
if (addr == 0)
return (-1);
*where = addr;
@@ -256,7 +257,7 @@
case R_IA64_REL64LSB: /* word64 LSB BD + A */
break;
case R_IA64_IPLTLSB:
- addr = lookup_fdesc(lf, symidx);
+ addr = lookup_fdesc(lf, symidx, lu);
if (addr == 0)
return (-1);
where[0] = *((Elf_Addr*)addr) + addend;
@@ -272,17 +273,19 @@
}
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 lu)
{
- return (elf_reloc_internal(lf, data, type, 0));
+ return (elf_reloc_internal(lf, relocbase, data, type, 0, lu));
}
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 lu)
{
- return (elf_reloc_internal(lf, data, type, 1));
+ return (elf_reloc_internal(lf, relocbase, data, type, 1, lu));
}
int
==== //depot/projects/hammer/sys/powerpc/powerpc/elf_machdep.c#9 (text+ko) ====
@@ -106,9 +106,9 @@
/* 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 lu)
{
- Elf_Addr relocbase = (Elf_Addr) lf->address;
Elf_Addr *where;
Elf_Addr addr;
Elf_Addr addend;
@@ -141,7 +141,7 @@
break;
case R_PPC_GLOB_DAT:
- addr = elf_lookup(lf, symidx, 1);
+ addr = lu(lf, symidx, 1);
if (addr == 0)
return -1;
addr += addend;
@@ -151,7 +151,7 @@
case R_PPC_JMP_SLOT:
/* No point in lazy binding for kernel modules. */
- addr = elf_lookup(lf, symidx, 1);
+ addr = lu(lf, symidx, 1);
if (addr == 0)
return -1;
if (*where != addr)
@@ -181,17 +181,19 @@
}
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 lu)
{
- return (elf_reloc_internal(lf, data, type, 0));
+ return (elf_reloc_internal(lf, relocbase, data, type, 0, lu));
}
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 lu)
{
- return (elf_reloc_internal(lf, data, type, 1));
+ return (elf_reloc_internal(lf, relocbase, data, type, 1, lu));
}
int
==== //depot/projects/hammer/sys/sparc64/sparc64/elf_machdep.c#10 (text+ko) ====
@@ -252,7 +252,8 @@
#define RELOC_VALUE_BITMASK(t) (reloc_target_bitmask[t])
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 lu)
{
const Elf_Rela *rela;
Elf_Addr value;
@@ -275,7 +276,8 @@
/* Process one elf relocation with addend. */
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 lu)
{
const Elf_Rela *rela;
Elf_Addr relocbase;
@@ -289,7 +291,6 @@
if (type != ELF_RELOC_RELA)
return (-1);
- relocbase = (Elf_Addr)lf->address;
rela = (const Elf_Rela *)data;
where = (Elf_Addr *)(relocbase + rela->r_offset);
where32 = (Elf_Half *)where;
@@ -309,7 +310,7 @@
value = rela->r_addend;
if (RELOC_RESOLVE_SYMBOL(rtype)) {
- addr = elf_lookup(lf, symidx, 1);
+ addr = lu(lf, symidx, 1);
if (addr == 0)
return (-1);
value += addr;
More information about the p4-projects
mailing list