Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Apr 2004 18:44:46 -0800 (PST)
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 50160 for review
Message-ID:  <200404020244.i322iknq030324@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=50160

Change 50160 by peter@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;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200404020244.i322iknq030324>