Module Name:    src
Committed By:   uwe
Date:           Sun Dec  8 23:49:16 UTC 2019

Modified Files:
        src/libexec/ld.elf_so/arch/powerpc: ppc_reloc.c

Log Message:
Use existing lo() and hi() macros.  Same object code is generated.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c
diff -u src/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c:1.59 src/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c:1.60
--- src/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c:1.59	Sun Dec  8 22:57:51 2019
+++ src/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c	Sun Dec  8 23:49:16 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ppc_reloc.c,v 1.59 2019/12/08 22:57:51 uwe Exp $	*/
+/*	$NetBSD: ppc_reloc.c,v 1.60 2019/12/08 23:49:16 uwe Exp $	*/
 
 /*-
  * Copyright (C) 1998	Tsubai Masanari
@@ -30,7 +30,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: ppc_reloc.c,v 1.59 2019/12/08 22:57:51 uwe Exp $");
+__RCSID("$NetBSD: ppc_reloc.c,v 1.60 2019/12/08 23:49:16 uwe Exp $");
 #endif /* not lint */
 
 #include <stdarg.h>
@@ -246,7 +246,7 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 			tmp = (Elf_Addr)(defobj->relocbase + def->st_value +
 			    rela->r_addend);
 
-			uint16_t tmp16 = (uint16_t)(tmp & 0xffff);
+			uint16_t tmp16 = lo(tmp);
 
 			uint16_t *where16 = (uint16_t *)where;
 			if (*where16 != tmp16)
@@ -262,10 +262,10 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 			tmp = (Elf_Addr)(defobj->relocbase + def->st_value +
 			    rela->r_addend);
 
-			uint16_t tmp16 = (uint16_t)((tmp >> 16) & 0xffff);
+			uint16_t tmp16 = hi(tmp);
 			if (ELF_R_TYPE(rela->r_info) == R_TYPE(ADDR16_HA)
-			    && (tmp & 0x8000))
-				++tmp16;
+			    && (tmp & __ha16))
+				++tmp16; /* adjust to ha(tmp) */
 
 			uint16_t *where16 = (uint16_t *)where;
 			if (*where16 != tmp16)

Reply via email to