X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?p=rmac;a=blobdiff_plain;f=object.c;fp=object.c;h=7545866fd8a9f10106aad0adf726715fb0f951d4;hp=0828eff69dad2c5dad86d5702268dafb42e356d8;hb=8f287ee72236774216a11a3062f9a26dc8dc66b6;hpb=e1087cbdea2503c3462546d52919f4012d1ab115 diff --git a/object.c b/object.c index 0828eff..7545866 100644 --- a/object.c +++ b/object.c @@ -327,7 +327,9 @@ int WriteObject(int fd) // Write requested object file... if ((obj_format == BSD) || ((obj_format == ALCYON) && (prg_flag == 0))) - { + { + ch_size = 0; + // Force BSD format (if it was ALCYON format) obj_format = BSD; @@ -425,6 +427,8 @@ int WriteObject(int fd) } else if (obj_format == ALCYON) { + ch_size = 0; + if (verb_flag) { if (prg_flag) @@ -435,6 +439,7 @@ int WriteObject(int fd) // Assign index numbers to the symbols, get # of symbols (we assume // that all symbols can potentially be extended, hence the x28) + // (To clarify: 28 bytes is the size of an extended symbol) uint32_t symbolMaxSize = sy_assign(NULL, NULL) * 28; // Alloc memory for header + text + data, symbol and relocation @@ -807,13 +812,52 @@ for(int j=0; jchnext) + { + memcpy(p, cp->chptr, cp->ch_size); + p += cp->ch_size; + } + } + + if (MarkABSImage(buf, tds, sect[TEXT].sloc, TEXT) != OK) // Do TEXT relocation table + { + return ERROR; + } + if (MarkABSImage(buf, tds, sect[TEXT].sloc, DATA) != OK) // Do DATA relocation table + { + return ERROR; + } + // Write out the header + text & data + symbol table (if any) + unused = write(fd, buf, tds); + + } return 0; }