Module Name: src
Committed By: christos
Date: Sun Nov 3 03:15:59 UTC 2019
Modified Files:
src/libexec/ld.elf_so/arch/mips: mips_reloc.c
Log Message:
simplify pointer gymnastics that sprained gcc-8
To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/libexec/ld.elf_so/arch/mips/mips_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/mips/mips_reloc.c
diff -u src/libexec/ld.elf_so/arch/mips/mips_reloc.c:1.72 src/libexec/ld.elf_so/arch/mips/mips_reloc.c:1.73
--- src/libexec/ld.elf_so/arch/mips/mips_reloc.c:1.72 Fri Jan 19 18:17:41 2018
+++ src/libexec/ld.elf_so/arch/mips/mips_reloc.c Sat Nov 2 23:15:59 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: mips_reloc.c,v 1.72 2018/01/19 23:17:41 christos Exp $ */
+/* $NetBSD: mips_reloc.c,v 1.73 2019/11/03 03:15:59 christos Exp $ */
/*
* Copyright 1997 Michael L. Hitch <[email protected]>
@@ -30,7 +30,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: mips_reloc.c,v 1.72 2018/01/19 23:17:41 christos Exp $");
+__RCSID("$NetBSD: mips_reloc.c,v 1.73 2019/11/03 03:15:59 christos Exp $");
#endif /* not lint */
#include <sys/types.h>
@@ -95,7 +95,8 @@ load_ptr(void *where, size_t len)
(void)memcpy(&val, where, len);
#endif
#if BYTE_ORDER == BIG_ENDIAN
- (void)memcpy((uint8_t *)((&val)+1) - len, where, len);
+ uint8_t *valp = (void *)&val;
+ (void)memcpy(valp + sizeof(val) - len, where, len);
#endif
return (len == sizeof(Elf_Sxword)) ? val : (Elf_Sword)val;
}
@@ -117,7 +118,8 @@ store_ptr(void *where, Elf_Sxword val, s
(void)memcpy(where, &val, len);
#endif
#if BYTE_ORDER == BIG_ENDIAN
- (void)memcpy(where, (const uint8_t *)((&val)+1) - len, len);
+ const uint8_t *valp = (const void *)&val;
+ (void)memcpy(where, valp + sizeof(val) - len, len);
#endif
}