-R
authorBill Joy <bill@ucbvax.Berkeley.EDU>
Sun, 17 Aug 1980 06:00:07 +0000 (22:00 -0800)
committerBill Joy <bill@ucbvax.Berkeley.EDU>
Sun, 17 Aug 1980 06:00:07 +0000 (22:00 -0800)
SCCS-vsn: old/as.vax/as.h 4.5
SCCS-vsn: old/as.vax/assyms.c 4.3

usr/src/old/as.vax/as.h
usr/src/old/as.vax/assyms.c

index ef84371..e3907f4 100644 (file)
@@ -1,5 +1,5 @@
 /* Copyright (c) 1980 Regents of the University of California */
 /* Copyright (c) 1980 Regents of the University of California */
-/* "@(#)as.h 4.4 %G%" */
+/* "@(#)as.h 4.5 %G%" */
 #ifdef VMS
 # define       vax     1
 # define       VAX     1
 #ifdef VMS
 # define       vax     1
 # define       VAX     1
@@ -389,6 +389,7 @@ struct      Quad {
        extern  int     orgwarn;                /* questionable origin ? */
        extern  int     useVM;                  /*use virtual memory temp file*/
        extern  int     jxxxJUMP;               /*use jmp instead of brw for jxxx */
        extern  int     orgwarn;                /* questionable origin ? */
        extern  int     useVM;                  /*use virtual memory temp file*/
        extern  int     jxxxJUMP;               /*use jmp instead of brw for jxxx */
+       extern  int     readonlydata;           /*initialized data into text space*/
 #ifdef DEBUG
        extern  int     debug;
        extern  int     toktrace;
 #ifdef DEBUG
        extern  int     debug;
        extern  int     toktrace;
index a4cedb9..1d9d9b7 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[] = "@(#)assyms.c 4.2 %G%";
+static char sccsid[] = "@(#)assyms.c 4.2 8/15/80";
 #include <stdio.h>
 #include <ctype.h>
 #include "as.h"
 #include <stdio.h>
 #include <ctype.h>
 #include "as.h"
@@ -544,7 +544,7 @@ outrel(pval,reftype,reltype,xsym)
        if (reltype != XABS || reftype & PCREL) {
                reloc = (reftype & PCREL)? r_can_1PC : r_can_0PC;
                reloc.r_address = dotp->e_xvalue -
        if (reltype != XABS || reftype & PCREL) {
                reloc = (reftype & PCREL)? r_can_1PC : r_can_0PC;
                reloc.r_address = dotp->e_xvalue -
-                       ( (dotp < &usedot[NLOC]) ? 0 : datbase );
+                   ( (dotp < &usedot[NLOC] || readonlydata) ? 0 : datbase );
                reloc.r_length = lgreflen[reftype];
                switch(reltype){
                        case XXTRN | XUNDEF:
                reloc.r_length = lgreflen[reftype];
                switch(reltype){
                        case XXTRN | XUNDEF:
@@ -552,6 +552,8 @@ outrel(pval,reftype,reltype,xsym)
                                reloc.r_extern = 1;
                                break;
                        default:
                                reloc.r_extern = 1;
                                break;
                        default:
+                               if (readonlydata && (reltype&~XXTRN) == XDATA)
+                                       reltype = XTEXT | (reltype&XXTRN);
                                reloc.r_symbolnum = reltype;
                                break;
                }
                                reloc.r_symbolnum = reltype;
                                break;
                }
@@ -676,6 +678,8 @@ int symwrite(symfile)
                }
 #endif
                sp->s_type = (sp->s_ptype != 0) ? sp->s_ptype : (sp->s_type & (~XFORW));
                }
 #endif
                sp->s_type = (sp->s_ptype != 0) ? sp->s_ptype : (sp->s_type & (~XFORW));
+               if (readonlydata && (sp->s_type&~N_EXT) == N_DATA)
+                       sp->s_type = N_TEXT | (sp->s_type & N_EXT);
                bwrite(&sp->s_nm, sizeof (struct nlist), symfile);
 #ifdef FLEXNAMES
                sp->s_name = name;              /* restore pointer */
                bwrite(&sp->s_nm, sizeof (struct nlist), symfile);
 #ifdef FLEXNAMES
                sp->s_name = name;              /* restore pointer */