Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/libexec/ld.elf_so/arch/powerpc Use existing lo() and hi() ma...



details:   https://anonhg.NetBSD.org/src/rev/da0fe05b0120
branches:  trunk
changeset: 466007:da0fe05b0120
user:      uwe <uwe%NetBSD.org@localhost>
date:      Sun Dec 08 23:49:16 2019 +0000

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

diffstat:

 libexec/ld.elf_so/arch/powerpc/ppc_reloc.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (41 lines):

diff -r 1dd4009723a4 -r da0fe05b0120 libexec/ld.elf_so/arch/powerpc/ppc_reloc.c
--- a/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c        Sun Dec 08 22:57:51 2019 +0000
+++ b/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c        Sun Dec 08 23:49:16 2019 +0000
@@ -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 @@
                        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 @@
                        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)



Home | Main Index | Thread Index | Old Index