comparison lwlink/trunk/src/output.c @ 123:6084a3859fb4

Added basic raw output module
author lost
date Thu, 22 Jan 2009 02:14:52 +0000
parents 7bc853cb2ca9
children b972e45b5e07
comparison
equal deleted inserted replaced
122:2ece9adb4e4b 123:6084a3859fb4
98 writebytes(buf, 1, 5, of); 98 writebytes(buf, 1, 5, of);
99 } 99 }
100 100
101 void do_output_raw(FILE *of) 101 void do_output_raw(FILE *of)
102 { 102 {
103 int nskips = 0; // used to output blanks for BSS inline
104 int sn;
105
106 for (sn = 0; sn < nsects; sn++)
107 {
108 if (sectlist[sn].ptr -> flags & SECTION_BSS)
109 {
110 // no output for a BSS section
111 nskips += sectlist[sn].ptr -> codesize;
112 continue;
113 }
114 while (nskips > 0)
115 {
116 // the "" is not an error - it turns into a single NUL byte!
117 writebytes("", 1, 1, of);
118 nskips--;
119 }
120 writebytes(sectlist[sn].ptr -> code, 1, sectlist[sn].ptr -> codesize, of);
121 }
103 } 122 }