+
+ case ALCYON:
+ /*
+ * Compute size of symbol table;
+ * assign numbers to the symbols...
+ */
+ ssize = 0;
+
+ if (prg_flag != 1)
+ ssize = ((LONG)sy_assign(NULL, NULL)) * 14;
+
+ /*
+ * Alloc memory for header+text+data, symbol and
+ * relocation information construction.
+ */
+ t = tds = sect[TEXT].sloc + sect[DATA].sloc;
+
+ if (t < ssize)
+ t = ssize;
+
+ buf = malloc((t + HDRSIZE) + HDRSIZE);
+
+ /*
+ * Build object file header
+ * just before the text+data image
+ */
+ chptr = buf - HDRSIZE; /* -> base of header */
+ D_word(0x601a); /* magic number */
+ t = sect[TEXT].sloc; /* TEXT size */
+ D_long(t);
+ t = sect[DATA].sloc; /* DATA size */
+ D_long(t);
+ t = sect[BSS].sloc; /* BSS size */
+ D_long(t);
+ D_long(ssize); /* symbol table size */
+ D_long(0); /* stack size (unused) */
+ D_long(0); /* entry point (unused) */
+ D_word(0); /* relocation information exists */
+
+ /*
+ * Construct text and data segments;
+ * fixup relocatable longs in .PRG mode;
+ * finally write the header+text+data
+ */
+ p = buf;
+
+ for(i=TEXT; i<=DATA; i++)
+ {
+ for (cp=sect[i].sfcode; cp!=NULL; cp=cp->chnext)
+ {
+ memcpy(p, cp->chptr, cp->ch_size);
+ p += cp->ch_size;
+ }
+ }
+
+ if (prg_flag)
+ markimg(buf, tds, sect[TEXT].sloc, 0);
+
+ write(fd, buf - HDRSIZE, tds + HDRSIZE);
+
+ /*
+ * Construct and write symbol table
+ */
+ if (prg_flag != 1)
+ {
+ sy_assign(buf, constr_symtab);
+ write(fd, buf, ssize);
+ }
+
+ /*
+ * Construct and write relocation information;
+ * the size of it changes if we're writing a RELMODed executable.
+ */
+ tds = markimg(buf, tds, sect[TEXT].sloc, 1);
+ write(fd, buf, tds);
+ break;