# HG changeset patch # User lost # Date 1232590492 0 # Node ID 6084a3859fb4e887385bbe63b83be2adbfd4fd19 # Parent 2ece9adb4e4b7765f30f0633919a604d7b46ac04 Added basic raw output module diff -r 2ece9adb4e4b -r 6084a3859fb4 lwlink/trunk/src/output.c --- a/lwlink/trunk/src/output.c Thu Jan 22 02:05:30 2009 +0000 +++ b/lwlink/trunk/src/output.c Thu Jan 22 02:14:52 2009 +0000 @@ -100,4 +100,23 @@ void do_output_raw(FILE *of) { + int nskips = 0; // used to output blanks for BSS inline + int sn; + + for (sn = 0; sn < nsects; sn++) + { + if (sectlist[sn].ptr -> flags & SECTION_BSS) + { + // no output for a BSS section + nskips += sectlist[sn].ptr -> codesize; + continue; + } + while (nskips > 0) + { + // the "" is not an error - it turns into a single NUL byte! + writebytes("", 1, 1, of); + nskips--; + } + writebytes(sectlist[sn].ptr -> code, 1, sectlist[sn].ptr -> codesize, of); + } }