Partial backout of previous delta; align to no more than full word
authorRobert R. Henry <henry@ucbvax.Berkeley.EDU>
Thu, 21 Aug 1980 03:10:30 +0000 (19:10 -0800)
committerRobert R. Henry <henry@ucbvax.Berkeley.EDU>
Thu, 21 Aug 1980 03:10:30 +0000 (19:10 -0800)
SCCS-vsn: old/as.vax/asmain.c 4.8
SCCS-vsn: old/as.vax/asjxxx.c 4.5

usr/src/old/as.vax/asjxxx.c
usr/src/old/as.vax/asmain.c

index 42985e0..36ced59 100644 (file)
@@ -1,5 +1,5 @@
 /* Copyright (c) 1980 Regents of the University of California */
 /* Copyright (c) 1980 Regents of the University of California */
-static char sccsid[] = "@(#)asjxxx.c 4.4 %G%";
+static char sccsid[] = "@(#)asjxxx.c 4.5 %G%";
 #include       <stdio.h>
 #include       "as.h"
 #include       "assyms.h"
 #include       <stdio.h>
 #include       "as.h"
 #include       "assyms.h"
@@ -116,6 +116,24 @@ jalign(xp, sp)
        register struct symtab *sp;
 {
        register        int     mask;
        register struct symtab *sp;
 {
        register        int     mask;
+       /*
+        *      Problem with .align
+        *
+        *      When the loader constructs an executable file from
+        *      a number of objects, it effectively concatnates
+        *      together all of the text segments from all objects,
+        *      and then all of the data segments.
+        *
+        *      If we do an align by a large value, we can align
+        *      within the a.out this assembly produces, but
+        *      after the loader concatnates, the alignment can't
+        *      be guaranteed if the objects preceding this one
+        *      in the load are also aligned to the same size.
+        *
+        *      Currently, the loader guarantees full word alignment.
+        *      So, ridiculous aligns are caught here and converted
+        *      to a .align 2, if possible.
+        */
        if (   (xp->e_xtype != XABS)
            || (xp->e_xvalue < 0)
            || (xp->e_xvalue > 16)
        if (   (xp->e_xtype != XABS)
            || (xp->e_xvalue < 0)
            || (xp->e_xvalue > 16)
@@ -123,11 +141,14 @@ jalign(xp, sp)
                yyerror("Illegal `align' argument");
                return;
        }
                yyerror("Illegal `align' argument");
                return;
        }
-       if (   (xp->e_xvalue > 3)
-           && (dotp != &usedot[0])
-           ) {
-               yywarning("Alignment by %d in segments other than text 0 may not work.", xp->e_xvalue);
-               yywarning("Phase errors may occur after this .align in the second pass.");
+       if (xp->e_xvalue > 2){
+               if (passno == 1){
+                 yywarning(".align %d in any segment is NOT preserved by the loader",
+                       xp->e_xvalue);
+                 yywarning(".align %d converted to .align 2",
+                       xp->e_xvalue);
+               }
+               xp->e_xvalue = 2;
        }
        flushfield(NBPW/4);
        if (passno == 1) {
        }
        flushfield(NBPW/4);
        if (passno == 1) {
index ef9c83e..936eaf1 100644 (file)
@@ -1,5 +1,5 @@
 /* Copyright (c) 1980 Regents of the University of California */
 /* Copyright (c) 1980 Regents of the University of California */
-static char sccsid[] = "@(#)asmain.c 4.7 %G%";
+static char sccsid[] = "@(#)asmain.c 4.8 %G%";
 #include <stdio.h>
 #include <ctype.h>
 #include <signal.h>
 #include <stdio.h>
 #include <ctype.h>
 #include <signal.h>
@@ -10,7 +10,7 @@ static        char sccsid[] = "@(#)asmain.c 4.7 %G%";
 #include "asscan.h"
 
 #ifdef UNIX
 #include "asscan.h"
 
 #ifdef UNIX
-#define        unix_lang_name "VAX/UNIX Assembler V%G% 4.7"
+#define        unix_lang_name "VAX/UNIX Assembler V%G% 4.8"
 #endif
 
 #ifdef VMS
 #endif
 
 #ifdef VMS
@@ -190,14 +190,14 @@ main(argc, argv)
        if (anyerrs) delexit();
 
        open_a_out();                   /* open a.out */
        if (anyerrs) delexit();
 
        open_a_out();                   /* open a.out */
-       roundsegments();                /* round segments to DW */
+       roundsegments();                /* round segments to FW */
        build_hdr();                    /* build initial header, and output */
        
        i_pass2();                      /* reopen temporary file, etc */
        pass2();                        /* second pass through the virtual .s */
        if (anyerrs) delexit();
 
        build_hdr();                    /* build initial header, and output */
        
        i_pass2();                      /* reopen temporary file, etc */
        pass2();                        /* second pass through the virtual .s */
        if (anyerrs) delexit();
 
-       fillsegments();                 /* fill segments with 0 to DW */
+       fillsegments();                 /* fill segments with 0 to FW */
        reloc_syms();                   /* dump relocation and symbol table */
 
        delete();                       /* remove tmp file */
        reloc_syms();                   /* dump relocation and symbol table */
 
        delete();                       /* remove tmp file */
@@ -438,7 +438,7 @@ roundsegments()
         */
        tsize = 0;
        for (locindex=0; locindex<NLOC; locindex++) {
         */
        tsize = 0;
        for (locindex=0; locindex<NLOC; locindex++) {
-               v = round(usedot[locindex].e_xvalue, DW);
+               v = round(usedot[locindex].e_xvalue, FW);
                usedot[locindex].e_xvalue = tsize;
                if ((locindex == 0) || (v != 0) ){
                        usefile[locindex] = (BFILE *)Calloc(1, sizeof(BFILE));
                usedot[locindex].e_xvalue = tsize;
                if ((locindex == 0) || (v != 0) ){
                        usefile[locindex] = (BFILE *)Calloc(1, sizeof(BFILE));
@@ -454,9 +454,9 @@ roundsegments()
        /*
         *              Round and assign data segment origins.
         */
        /*
         *              Round and assign data segment origins.
         */
-       datbase = round(tsize, DW);
+       datbase = round(tsize, FW);
        for (locindex=0; locindex<NLOC; locindex++) {
        for (locindex=0; locindex<NLOC; locindex++) {
-               v = round(usedot[NLOC+locindex].e_xvalue, DW);
+               v = round(usedot[NLOC+locindex].e_xvalue, FW);
                usedot[NLOC+locindex].e_xvalue = datbase + dsize;
                if (v != 0){
                        usefile[NLOC + locindex] = (BFILE *)Calloc(1,sizeof(BFILE));
                usedot[NLOC+locindex].e_xvalue = datbase + dsize;
                if (v != 0){
                        usefile[NLOC + locindex] = (BFILE *)Calloc(1,sizeof(BFILE));
@@ -540,13 +540,13 @@ fillsegments()
 {
        int     locindex;
        /*
 {
        int     locindex;
        /*
-        *      Round text and data segments to DW by appending zeros
+        *      Round text and data segments to FW by appending zeros
         */
        for (locindex = 0; locindex < NLOC + NLOC; locindex++) {
                if (usefile[locindex]) {
                        txtfil = usefile[locindex];
                        dotp = &usedot[locindex];
         */
        for (locindex = 0; locindex < NLOC + NLOC; locindex++) {
                if (usefile[locindex]) {
                        txtfil = usefile[locindex];
                        dotp = &usedot[locindex];
-                       while (usedot[locindex].e_xvalue & DW)
+                       while (usedot[locindex].e_xvalue & FW)
                                outb(0);
                }
        }
                                outb(0);
                }
        }