more atari/tos work

This commit is contained in:
László Molnár 2006-07-07 09:20:43 +02:00
parent d35211328e
commit 76e705e7ee
2 changed files with 43 additions and 6 deletions

View File

@ -78,7 +78,34 @@ const int *PackTos::getFilters() const
Linker* PackTos::newLinker() const
{
return new SimpleBELinker;
class ElfLinkerM68k : public ElfLinker
{
typedef ElfLinker super;
virtual void relocate1(Relocation *rel, upx_byte *location,
unsigned value, const char *type)
{
if (strncmp(type, "R_68K_", 6))
return super::relocate1(rel, location, value, type);
type += 6;
if (strncmp(type, "PC", 2) == 0)
{
value -= rel->section->offset + rel->offset;
type += 2;
}
if (strcmp(type, "8") == 0)
*location += value;
if (strcmp(type, "16") == 0)
set_be16(location, get_be16(location) + value);
else if (strcmp(type, "32") == 0)
set_be32(location, get_be32(location) + value);
else
super::relocate1(rel, location, value, type);
}
};
return new ElfLinkerM68k;
}
@ -101,10 +128,20 @@ int PackTos::buildLoader(const Filter *ft)
p = opt->small ? nrv2e_loader_small : nrv2e_loader;
l = opt->small ? sizeof(nrv2e_loader_small) : sizeof(nrv2e_loader);
}
initLoader(p, l);
addLoader("tos0",
true ? "subql_1d0" : "subqw_1d0",
"s_bneloop0",
true ? "subql_1d6" : "subqw_1d6",
"s_bneloop3",
"IDENTSTR,+40,UP1HEAD",
"CUTPOINT",
true ? "reloc" : "",
"jmpastack",
NULL
);
delete linker;
linker = newLinker();
linker->init(p, l, -1);
freezeLoader();
return getLoaderSize();
}

View File

@ -475,7 +475,7 @@ clear_bss_end:
// relocations and the original fileheader).
**************************************************************************/
cutpoint:
section CUTPOINT
// ------------- decompress (from a3 to a4)
@ -536,7 +536,7 @@ L(loopx2): move.b (a0)+,d3
reloc_end:
section jmpastack
// ------------- clear dirty bss & start program
// We are currently running in the dirty bss.