Minor portability fixes.
This commit is contained in:
+9
-4
@@ -306,7 +306,7 @@ void ElfLinker::preprocessRelocations(char *start, char *end)
|
|||||||
|
|
||||||
assert(strlen(p) == 8 || strlen(p) == 16);
|
assert(strlen(p) == 8 || strlen(p) == 16);
|
||||||
char *endptr = NULL;
|
char *endptr = NULL;
|
||||||
unsigned long long ull = strtoull(p, &endptr, 16);
|
acc_uint64l_t ull = strtoull(p, &endptr, 16);
|
||||||
add = (u64) ull;
|
add = (u64) ull;
|
||||||
assert(add == ull);
|
assert(add == ull);
|
||||||
assert(endptr && *endptr == '\0');
|
assert(endptr && *endptr == '\0');
|
||||||
@@ -549,8 +549,11 @@ void ElfLinker::dumpSymbol(const Symbol *symbol, unsigned flags, FILE *fp) const
|
|||||||
{
|
{
|
||||||
if ((flags & 1) && symbol->section->output == NULL)
|
if ((flags & 1) && symbol->section->output == NULL)
|
||||||
return;
|
return;
|
||||||
fprintf(fp, "%-28s 0x%016llx | %-28s 0x%016llx\n",
|
char d0[16+1], d1[16+1];
|
||||||
symbol->name, (unsigned long long) symbol->offset, symbol->section->name, (unsigned long long) symbol->section->offset);
|
upx_snprintf(d0, sizeof(d0), "%016llx", (acc_uint64_t) symbol->offset);
|
||||||
|
upx_snprintf(d1, sizeof(d1), "%016llx", (acc_uint64_t) symbol->section->offset);
|
||||||
|
fprintf(fp, "%-28s 0x%-16s | %-28s 0x%-16s\n",
|
||||||
|
symbol->name, d0, symbol->section->name, d1);
|
||||||
}
|
}
|
||||||
void ElfLinker::dumpSymbols(unsigned flags, FILE *fp) const
|
void ElfLinker::dumpSymbols(unsigned flags, FILE *fp) const
|
||||||
{
|
{
|
||||||
@@ -561,7 +564,9 @@ void ElfLinker::dumpSymbols(unsigned flags, FILE *fp) const
|
|||||||
// default: dump symbols in used section order
|
// default: dump symbols in used section order
|
||||||
for (const Section *section = head; section; section = section->next)
|
for (const Section *section = head; section; section = section->next)
|
||||||
{
|
{
|
||||||
fprintf(fp, "%-42s%-28s 0x%016llx\n", "", section->name, (unsigned long long) section->offset);
|
char d1[16+1];
|
||||||
|
upx_snprintf(d1, sizeof(d1), "%016llx", (acc_uint64_t) section->offset);
|
||||||
|
fprintf(fp, "%-42s%-28s 0x%-16s\n", "", section->name, d1);
|
||||||
for (unsigned ic = 0; ic < nsymbols; ic++)
|
for (unsigned ic = 0; ic < nsymbols; ic++)
|
||||||
{
|
{
|
||||||
const Symbol *symbol = symbols[ic];
|
const Symbol *symbol = symbols[ic];
|
||||||
|
|||||||
+2
-2
@@ -512,7 +512,7 @@ void PackW64Pep::processTls(Interval *iv) // pass 1
|
|||||||
throwCantPack("invalid TLS callback");
|
throwCantPack("invalid TLS callback");
|
||||||
else if (tlsp->callbacks - ih.imagebase + 4 >= ih.imagesize)
|
else if (tlsp->callbacks - ih.imagebase + 4 >= ih.imagesize)
|
||||||
throwCantPack("invalid TLS callback");
|
throwCantPack("invalid TLS callback");
|
||||||
unsigned long long v = get_le64(ibuf + (tlsp->callbacks - ih.imagebase));
|
acc_uint64l_t v = get_le64(ibuf + (tlsp->callbacks - ih.imagebase));
|
||||||
if (v != 0)
|
if (v != 0)
|
||||||
{
|
{
|
||||||
//count number of callbacks, just for information string - Stefan Widmann
|
//count number of callbacks, just for information string - Stefan Widmann
|
||||||
@@ -580,7 +580,7 @@ void PackW64Pep::processTls(Reloc *rel,const Interval *iv,unsigned newaddr) // p
|
|||||||
for (ic = 0; ic < iv->ivnum; ic += 4)
|
for (ic = 0; ic < iv->ivnum; ic += 4)
|
||||||
{
|
{
|
||||||
void *p = otls + iv->ivarr[ic].start - (tlsp->datastart - ih.imagebase) + sizeof(tls);
|
void *p = otls + iv->ivarr[ic].start - (tlsp->datastart - ih.imagebase) + sizeof(tls);
|
||||||
unsigned long long kc = get_le64(p); //changed to LE64 - Stefan Widmann
|
acc_uint64l_t kc = get_le64(p); //changed to LE64 - Stefan Widmann
|
||||||
if (kc < tlsp->dataend && kc >= tlsp->datastart)
|
if (kc < tlsp->dataend && kc >= tlsp->datastart)
|
||||||
{
|
{
|
||||||
kc += newaddr + sizeof(tls) - tlsp->datastart;
|
kc += newaddr + sizeof(tls) - tlsp->datastart;
|
||||||
|
|||||||
Reference in New Issue
Block a user