Add em22 compile, change EM machine executable format to put proc table in text
[Ack-5.5.git] / util / ass / assrl.c
index 4d0f27e..e63197a 100644 (file)
@@ -98,6 +98,10 @@ copyout() {
         *      |      <UNUSED>          | /
         *      |________________________|
         *      |                        |
+        *      |      PROCTABLE         |
+        *      |                        |
+        *      |_ _ _ _ _ _ _ _ _ _ _ _ |
+        *      |                        |
         *      |      TEXT              |        zero filled
         *      |                        |        if not word multiple
         *      |________________________|
@@ -105,14 +109,11 @@ copyout() {
         *      |      DATA              |
         *      |                        |
         *      |________________________|
-        *      |                        |
-        *      |      PROCTABLE         |
-        *      |                        |
-        *      |________________________|
         *
         *
         */
 
+       procbytes = procnum * 3 * ptrsize;
        remtext = textbytes%wordsize ;
        if ( remtext != 0 ) remtext = wordsize-remtext ;
 
@@ -133,7 +134,7 @@ copyout() {
        xput16(ptrsize,ifile);
        xput16(0,ifile);
        xput16(0,ifile);
-       xputa(textbytes+remtext ,ifile);
+       xputa(procbytes+textbytes+remtext,ifile);
        xputa((cons_t)datablocks,ifile);
        xputa((cons_t)procnum,ifile);
        xputa((cons_t)searchproc(MAIN,xprocs,oursize->n_xproc)->p_num,
@@ -143,14 +144,16 @@ copyout() {
        xputa((cons_t)0,ifile);
        xputa((cons_t)0,ifile);
 
+       for (i=0;i<procnum;i++) {
+               xputarb(ptrsize,proctab[i].pr_loc,ifile);
+               xputarb(ptrsize,proctab[i].pr_off+procbytes,ifile);
+               xputarb(ptrsize,proctab[i].pr_len,ifile);
+       }
+
        textprocess(tfile,ifile);
        while ( remtext-- ) xputc(0,ifile) ;
 
        dataprocess(dfile,ifile);
-       for (i=0;i<procnum;i++) {
-               xputarb(ptrsize,proctab[i].pr_loc,ifile);
-               xputarb(ptrsize,proctab[i].pr_off,ifile);
-       }
        if ( fclose(ifile)==EOF ) ;
 }
 
@@ -169,6 +172,9 @@ dataprocess(f1,f2) FILE *f1,*f2; {
        for (i=0 ; i<dataoff && !ieof ; i++) {
                if (i==datareloc.r_off) {
                        switch(datareloc.r_typ) {
+                       case RELLOC:
+                               datareloc.r_val.rel_i += procbytes;
+                               /* fallthru */
                        case RELADR:
                                xputa(xgeta(f1)+datareloc.r_val.rel_i,f2) ;
                                i += ptrsize-1 ;