PERFORCE change 31749 for review

Peter Wemm peter at FreeBSD.org
Fri May 23 18:33:23 PDT 2003


http://perforce.freebsd.org/chv.cgi?CH=31749

Change 31749 by peter at peter_hammer on 2003/05/23 18:32:50

	bah.  When using addend, do not use *where += ...

Affected files ...

.. //depot/projects/hammer/libexec/rtld-elf/amd64/reloc.c#7 edit

Differences ...

==== //depot/projects/hammer/libexec/rtld-elf/amd64/reloc.c#7 (text+ko) ====

@@ -145,7 +145,7 @@
 		    if (def == NULL)
 			goto done;
 
-		    *where += (Elf_Addr) (defobj->relocbase + def->st_value /* + rela->r_addend*/);
+		    *where = (Elf_Addr) (defobj->relocbase + def->st_value + rela->r_addend);
 		}
 		break;
 
@@ -164,8 +164,8 @@
 		    if (def == NULL)
 			goto done;
 
-		    *where +=
-		      (Elf_Addr) (defobj->relocbase + def->st_value /* + rela->r_addend */) -
+		    *where =
+		      (Elf_Addr) (defobj->relocbase + def->st_value + rela->r_addend) -
 		      (Elf_Addr) where;
 		}
 		break;
@@ -200,7 +200,7 @@
 		break;
 
 	    case R_X86_64_RELATIVE:
-		*where += (Elf_Addr)(obj->relocbase /*+ rela->r_addend*/);
+		*where = (Elf_Addr)(obj->relocbase + rela->r_addend);
 		break;
 
 	/* missing: R_X86_64_GOTPCREL, R_X86_64_32, R_X86_64_32S, R_X86_64_16, R_X86_64_PC16, R_X86_64_8, R_X86_64_PC8 */
@@ -259,7 +259,7 @@
 	def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj, true, NULL);
 	if (def == NULL)
 	    return -1;
-	target = (Elf_Addr)(defobj->relocbase + def->st_value /* + rela->r_addend */);
+	target = (Elf_Addr)(defobj->relocbase + def->st_value + rela->r_addend);
 	reloc_jmpslot(where, target, defobj, obj, (const Elf_Rel *)rela);
     }
     obj->jmpslots_done = true;


More information about the p4-projects mailing list