Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 May 2004 12:55:02 -0700 (PDT)
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 52941 for review
Message-ID:  <200405171955.i4HJt2Pl053203@repoman.freebsd.org>

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

Change 52941 by peter@peter_hammer on 2004/05/17 12:55:01

	deal with REL records which have variable old-value sizes

Affected files ...

.. //depot/projects/hammer/sys/amd64/amd64/elf_machdep.c#25 edit

Differences ...

==== //depot/projects/hammer/sys/amd64/amd64/elf_machdep.c#25 (text+ko) ====

@@ -119,9 +119,18 @@
 	case ELF_RELOC_REL:
 		rel = (const Elf_Rel *)data;
 		where = (Elf_Addr *) (relocbase + rel->r_offset);
-		addend = *where;
 		rtype = ELF_R_TYPE(rel->r_info);
 		symidx = ELF_R_SYM(rel->r_info);
+		/* Addend is 32 bit on 32 bit relocs */
+		switch (rtype) {
+		case R_X86_64_PC32:
+		case R_X86_64_32S:
+			addend = *(Elf32_Addr *)where;
+			break;
+		default:
+			addend = *where;
+			break;
+		}
 		break;
 	case ELF_RELOC_RELA:
 		rela = (const Elf_Rela *)data;
@@ -136,7 +145,6 @@
 
 	switch (rtype) {
 
-
 		case R_X86_64_NONE:	/* none */
 			break;
 



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