PackLinuxElf64amd works (except for lzma)

This commit is contained in:
John Reiser
2006-07-15 13:46:37 -07:00
parent e64555aca0
commit cfc5631d5d
8 changed files with 452 additions and 415 deletions
+11 -2
View File
@@ -464,8 +464,17 @@ void ElfLinker::preprocessRelocations(char *start, const char *end)
unsigned add = 0;
if (char *p = strstr(symbol, "+0x"))
{
*p = 0;
sscanf(p + 3, "%x", &add);
// Beware: sscanf("0xfffffffffffffffc", "%x", &add) ==> -1 == add
// because conversion stops after 32 bits for a non-long.
// Also, glibc-2.3.5 has a bug: even using "%lx" still gives -1 instead of -4.
long addend;
*p = 0; // terminate the symbol name
p+=3;
if ('f'==p[0] && 0==strncmp(p, "ffffffff", 8)) {
p+=8; // workaround a bug in glibc-2.3.5
}
sscanf(p, "%lx", &addend);
add = (unsigned)addend;
}
addRelocation(section->name, offset, t, symbol, add);