From 218c1c46c44f8b8a43eb43b58fe4036878735764 Mon Sep 17 00:00:00 2001 From: ceriel Date: Mon, 13 Apr 1987 15:57:33 +0000 Subject: [PATCH] Bug fix, program was not partable. it assumed same byte order as i86. --- mach/i86/cv/cv.c | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/mach/i86/cv/cv.c b/mach/i86/cv/cv.c index 5fbb73746..63ab94d17 100644 --- a/mach/i86/cv/cv.c +++ b/mach/i86/cv/cv.c @@ -163,7 +163,14 @@ main(argc, argv) } /* Action at last */ - write(output, (char *) e, 32); + write(output, (char *) e, 6); + wr_int2(e->a_version); + wr_long(e->a_text); + wr_long(e->a_data); + wr_long(e->a_bss); + wr_long(e->a_entry); + wr_long(e->a_misc); + wr_long(e->a_syms); emits(&outsect[TEXTSG]) ; emits(&outsect[ROMSG]) ; emits(&outsect[DATASG]) ; @@ -172,6 +179,27 @@ main(argc, argv) return 0; } +wr_int2(n) +{ + char buf[2]; + + buf[0] = n; + buf[1] = (n >> 8); + write(output, buf, 2); +} + +wr_long(l) + long l; +{ + char buf[4]; + + buf[0] = l; + buf[1] = (l >> 8); + buf[2] = (l >> 16); + buf[3] = (l >> 24); + write(output, buf, 4); +} + /* * Transfer the emitted byted from one file to another. */ @@ -260,7 +288,10 @@ emit_symtab() for (j++; j < 8; j++) { IX_name.n_name[j] = 0; } - write(output, (char *) &IX_name, sizeof(struct nlist)); + write(output, (char *) &IX_name, 8); + wr_long(IX_name.n_value); + write(output, &(IX_name.n_sclass), 2); + wr_int2(IX_name.n_type); } }