summaryrefslogtreecommitdiff
path: root/lib/linker.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/linker.c')
-rw-r--r--lib/linker.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/linker.c b/lib/linker.c
index 0228a9f..0be4cfc 100644
--- a/lib/linker.c
+++ b/lib/linker.c
@@ -98,7 +98,7 @@ static char *readstring(FILE * f)
static void addsymbol(char *name, int offset, int type)
{
symbol_t *newsymbol;
-
+
newsymbol = (symbol_t *) Emalloc(sizeof(symbol_t));
newsymbol->next = NULL;
newsymbol->type = type;
@@ -210,6 +210,7 @@ static void dumprelog(FILE * f)
{
symbol_t *s = symbols, *t;
char trouve, err[BUFSIZ];
+ Uint32 decal;
for (s = s->next; s; s = s->next) {
if (s->type & 1) {
@@ -222,21 +223,22 @@ static void dumprelog(FILE * f)
case 1: /* text */
switch (t->type) {
case 0:
- objects[s->objindex]->text[s->offset] +=
+ decal =
objects[t->objindex]->textstart + t->offset;
break;
case 2:
- objects[s->objindex]->text[s->offset] +=
+ decal =
textsize + objects[t->objindex]->datastart + t->offset;
break;
case 4:
- objects[s->objindex]->text[s->offset] +=
+ decal =
textsize + datasize + objects[t->objindex]->bssstart + t->offset;
break;
default:
exception(1, _("Internal error"));
break;
}
+ objects[s->objindex]->text[s->offset] += decal;
writeword(objects[s->objindex]->textstart + s->offset, f);
break;
case 3: /* data */