summaryrefslogtreecommitdiff
path: root/output/outbin.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-07-05 14:45:12 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-07-05 14:45:12 -0700
commit0cba10757976294d034ae5d8cd38784555a7ac8b (patch)
tree9c5f816527d88c2195a83ebad6f5e7b392272559 /output/outbin.c
parentfe1ca5a09fb3e82535a40aad3c5caa84d72d7d3a (diff)
downloadnasm-0cba10757976294d034ae5d8cd38784555a7ac8b.tar.gz
nasm-0cba10757976294d034ae5d8cd38784555a7ac8b.tar.bz2
nasm-0cba10757976294d034ae5d8cd38784555a7ac8b.zip
Make it possible for outputs to be either text or binary
Allow the backend to specify that an output format is either text or binary. For future uses, define this as a flag word so we can define other flags in the future if it would make sense. Currently, the ieee and dbg formats are text; all the others are binary. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'output/outbin.c')
-rw-r--r--output/outbin.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/output/outbin.c b/output/outbin.c
index fdfbe8e..b3ebc2a 100644
--- a/output/outbin.c
+++ b/output/outbin.c
@@ -594,8 +594,13 @@ static void bin_cleanup(int debuginfo)
/* Step 6: Write the section data to the output file. */
/* Write the progbits sections to the output file. */
- for (pend = origin, s = sections; s && (s->flags & TYPE_PROGBITS); s = s->next) { /* Skip zero-length sections. */
- if (s->length == 0)
+ pend = origin;
+ for (s = sections; s; s = s->next) {
+ /* Skip non-progbits sections */
+ if (!(s->flags & TYPE_PROGBITS))
+ continue;
+ /* Skip zero-length sections */
+ if (s->length == 0)
continue;
/* Pad the space between sections. */
for (h = s->start - pend; h; h--)
@@ -1401,7 +1406,7 @@ static int bin_set_info(enum geninfo type, char **val)
return 0;
}
-static void bin_init(FILE * afp, efunc errfunc, ldfunc ldef, evalfunc eval)
+static void bin_init(FILE *afp, efunc errfunc, ldfunc ldef, evalfunc eval)
{
fp = afp;
error = errfunc;
@@ -1436,7 +1441,7 @@ static void bin_init(FILE * afp, efunc errfunc, ldfunc ldef, evalfunc eval)
struct ofmt of_bin = {
"flat-form binary files (e.g. DOS .COM, .SYS)",
"bin",
- NULL,
+ 0,
null_debug_arr,
&null_debug_form,
bin_stdmac,