From 4cdf77e16f7f3e4b94f8c1ae0c0941857a364078 Mon Sep 17 00:00:00 2001 From: John Reiser Date: Sun, 11 Dec 2022 14:41:38 -0800 Subject: [PATCH] Stupid MSVC 14.2, 14.3; obtuse clang 14.0.5 (and MemBuffer vs alignment) MSVC: cannot say "if (0)" to get "check symtax+semantics, but do not emit code" clang+MemBuffer: must fight too much to get pointer to wider-than-char modified: src/p_lx_elf.cpp --- src/p_lx_elf.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/p_lx_elf.cpp b/src/p_lx_elf.cpp index d01ffd85..90a3ef42 100644 --- a/src/p_lx_elf.cpp +++ b/src/p_lx_elf.cpp @@ -4837,8 +4837,9 @@ PackLinuxElf64::unRela64( if (jump_slots.getSize() < (r_offset - plt_va)) { throwInternalError("bad r_offset for jump_slots"); } - upx_uint64_t *slot = (upx_uint64_t *)(r_offset - plt_va - + (unsigned char *)jump_slots); + // really upx_uint64_t *, but clang makes it hard to say that + unsigned char *slot = r_offset - plt_va + + (unsigned char *)jump_slots.getVoidPtr(); upx_uint64_t w = get_te64(slot); if (xct_off <= w) { set_te64(slot, w - asl_delta); @@ -4925,10 +4926,12 @@ void PackLinuxElf64::un_shlib_1( adjABS(sym, 0ul - (unsigned long)asl_delta); } } +#if 0 //{ Stupid MSVC 14.2, 14.3 if (0 && fo) { fo->seek(off_dynsym, SEEK_SET); fo->rewrite(sym0, sz_dynsym); } +#endif //} } }