PERFORCE change 50160 for review
Peter Wemm
peter at FreeBSD.org
Thu Apr 1 18:44:47 PST 2004
http://perforce.freebsd.org/chv.cgi?CH=50160
Change 50160 by peter at peter_hammer on 2004/04/01 18:44:32
implement another relocation type. try and fix PC32 while here.
Affected files ...
.. //depot/projects/hammer/sys/amd64/amd64/elf_machdep.c#16 edit
Differences ...
==== //depot/projects/hammer/sys/amd64/amd64/elf_machdep.c#16 (text+ko) ====
@@ -107,8 +107,8 @@
elf_reloc_internal(linker_file_t lf, const void *data, int type, int local, elf_lookup_fn lu)
{
Elf_Addr relocbase = (Elf_Addr) lf->address;
- Elf_Addr *where;
- int32_t *where32;
+ Elf64_Addr *where;
+ Elf32_Addr *where32, val32;
Elf_Addr addr;
Elf_Addr addend;
Elf_Word rtype, symidx;
@@ -173,11 +173,23 @@
printf("addr 0x%lx, addend 0x%lx\n", addr, addend);
if (addr == 0)
return -1;
- addr += addend - (Elf_Addr)where;
- /* XXX needs to be 32 bit *where, not 64 bit */
+ val32 = (Elf32_Addr)(addr + addend - (Elf_Addr)where);
where32 = (int32_t *)where;
- if (*where32 != addr)
- *where32 = addr;
+ if (*where32 != val32)
+ *where32 = val32;
+printf("*where32 = 0x%x\n", *where32);
+ break;
+
+ case R_X86_64_32S: /* S + A sign extend */
+printf("R_X86_64_32\n");
+ addr = lu(lf, symidx, 1);
+printf("addr 0x%lx, addend 0x%lx\n", addr, addend);
+ if (addr == 0)
+ return -1;
+ val32 = (Elf32_Addr)(addr + addend);
+ where32 = (Elf32_Addr *)where;
+ if (*where32 != val32)
+ *where32 = val32;
printf("*where32 = 0x%x\n", *where32);
break;
More information about the p4-projects
mailing list