1
0
mirror of https://github.com/upx/upx synced 2025-09-28 19:06:07 +08:00

Fix msvc build.

This commit is contained in:
Markus F.X.J. Oberhumer 2016-09-28 13:34:39 +02:00
parent 51eab2a4b7
commit 32de5d0d7f
2 changed files with 11 additions and 6 deletions

View File

@ -5,9 +5,9 @@ os: Visual Studio 2015
environment:
matrix:
# - { C: msvc-10.0-x86, CL_VERSION: 16.00, VS_VERSION: 2010 } # missing strtoull()
- { C: msvc-10.0-x86, CL_VERSION: 16.00, VS_VERSION: 2010 }
### - { C: msvc-10.0-x64, CL_VERSION: 16.00, VS_VERSION: 2010 } # AppVeyor: x64 compiler is not installed
# - { C: msvc-11.0-x86, CL_VERSION: 17.00, VS_VERSION: 2012 } # missing strtoull()
- { C: msvc-11.0-x86, CL_VERSION: 17.00, VS_VERSION: 2012 }
### - { C: msvc-11.0-x64, CL_VERSION: 17.00, VS_VERSION: 2012 } # AppVeyor: x64 compiler is not installed
- { C: msvc-12.0-x86, CL_VERSION: 18.00, VS_VERSION: 2013 }
- { C: msvc-12.0-x64, CL_VERSION: 18.00, VS_VERSION: 2013 }

View File

@ -307,13 +307,18 @@ void ElfLinker::preprocessRelocations(char *start, char *end)
char sign = *p;
*p = 0; // terminate the symbol name
p += 3;
assert(strlen(p) == 8 || strlen(p) == 16);
#if (ACC_CC_MSC && (_MSC_VER < 1800))
unsigned a = 0, b = 0;
if (sscanf(p, "%08x%08x", &a, &b) == 2)
add = ((upx_uint64_t)a << 32) | b;
else
add = a;
#else
char *endptr = NULL;
upx_uint64_t ull = strtoull(p, &endptr, 16);
add = (upx_uint64_t) ull;
assert(add == ull);
add = strtoull(p, &endptr, 16);
assert(endptr && *endptr == '\0');
#endif
if (sign == '-')
add = 0 - add;
}