Added class BeLinker.

committer: mfx <mfx> 978797683 +0000
This commit is contained in:
Markus F.X.J. Oberhumer
2001-01-06 16:14:43 +00:00
parent dee289e2d9
commit 47168972da
4 changed files with 40 additions and 12 deletions
+7 -7
View File
@@ -60,12 +60,12 @@ Linker::Linker(const void *pdata, int plen, int pinfo)
sections = new section[200];
char *p = iloader + info;
while (get_le32(p) != (unsigned)(-1))
while (get32(p) != (unsigned)(-1))
{
if (get_le32(p))
if (get32(p))
{
memcpy(sections[nsections].name,p,8);
sections[nsections].istart = get_le32(p+8);
sections[nsections].istart = get32(p+8);
sections[nsections++].ostart = -1;
p += 12;
assert(nsections < 200);
@@ -73,13 +73,13 @@ Linker::Linker(const void *pdata, int plen, int pinfo)
else
{
int l;
for (l = get_le32(p+4) - 1; iloader[l] == 0; l--)
for (l = get32(p+4) - 1; iloader[l] == 0; l--)
;
jumps[njumps].pos = l+1;
jumps[njumps].len = get_le32(p+4)-jumps[njumps].pos;
jumps[njumps].len = get32(p+4)-jumps[njumps].pos;
memcpy(jumps[njumps].tsect,p+8,8);
jumps[njumps++].toffs = get_le32(p+16);
jumps[njumps++].toffs = get32(p+16);
p += 20;
assert(njumps < 200);
}
@@ -177,7 +177,7 @@ const char *Linker::getLoader(int *llen)
if (jumps[ic].len == 1)
assert(-128 <= offs && offs <= 127);
set_le32(&offs,offs);
set32(&offs,offs);
memcpy(oloader+sections[jc].ostart+jumps[ic].pos-sections[jc].istart,&offs,jumps[ic].len);
}
frozen=1;