Annotation of coherent/b/bin/ld386/data.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * ld/data.c
                      3:  * General Loader-Binder
                      4:  *
                      5:  * Knows about FILE struct to the extent it is revealed in putc
                      6:  * if BREADBOX is non-zero
                      7:  */
                      8: 
                      9: #include "data.h"
                     10: 
                     11: /*
                     12:  * Start variables & constants
                     13:  */
                     14: 
                     15: sym_t  *symtable[NHASH];       /* hashed symbol table */
                     16: mod_t  *modhead, *modtail;     /* module list head and tail */
                     17: seg_t  oseg[NLSEG];            /* output segment descriptors */
                     18: int    nundef;                 /* number of undefined symbols */
                     19: uaddr_t        comnb;                  /* byte aligned commons */
                     20: uaddr_t        comns;                  /* short aligned commons */
                     21: uaddr_t        comnl;                  /* long aligned commons */
                     22: sym_t  *etext_s, *edata_s, *end_s;     /* special loader generated symbols */
                     23: char   etext_id[SYMNMLEN] = "etext",   /* and their names */
                     24:        edata_id[SYMNMLEN] = "edata",
                     25:        end_id[SYMNMLEN]   = "end";
                     26: 
                     27: FILEHDR fileh                  /* output load file header */
                     28:                = { C_386_MAGIC };
                     29: AOUTHDR aouth;
                     30: SCNHDR secth[NLSEG];
                     31: 
                     32: char   *mchname[]              /* names of known machines */
                     33:                = {     "Turing Machine",
                     34:                        "PDP-11",
                     35:                        "VAX-11",
                     36:                        "3sickly",
                     37:                        "Z8001",
                     38:                        "Z8002",
                     39:                        "iAPX 86",
                     40:                        "i8080",
                     41:                        "6800",
                     42:                        "6809",
                     43:                        "68000",
                     44:                        "80386",
                     45:                        "68020"
                     46:                };
                     47: uaddr_t        segsize[]               /* size of segment on target machine */
                     48:                = {     0,
                     49:                        8192,
                     50:                        512,
                     51:                        2048,
                     52:                        0,
                     53:                        512,
                     54:                        16,
                     55:                        0,
                     56:                        0,
                     57:                        0,
                     58:                        0,
                     59:                        16,
                     60:                        0
                     61:                },
                     62:        drvbase[]               /* base of loadable driver */
                     63:                = {     0,
                     64:                        0120000,
                     65:                        0,
                     66:                        0,
                     67:                        0,
                     68:                        0xD000,
                     69:                        0xD000,
                     70:                        0,
                     71:                        0,
                     72:                        0,
                     73:                        0,
                     74:                        0xFFC00000L,
                     75:                        0
                     76:                },
                     77:        drvtop[]                /* address limit of loadable driver */
                     78:                = {     0,
                     79:                        0140000,
                     80:                        0,
                     81:                        0,
                     82:                        0,
                     83:                        0xF000,
                     84:                        0xF000,
                     85:                        0,
                     86:                        0,
                     87:                        0,
                     88:                        0,
                     89:                        0xFFFFFFFFL,
                     90:                        0
                     91:                };
                     92: flag_t noilcl,                 /* discard internal symbols `L...' */
                     93:        nolcl,                  /* discard local symbols */
                     94:        watch,                  /* watch everything happen */
                     95:        worder,                 /* byte order in word; depends on machine */
                     96:        comflag,                /* don't flag comm of diff size */
                     97:        reloc,                  /* write reloc symbols */
                     98:        dcomm;                  /* define commons even if reloc out */
                     99: 
                    100: int    errCount;               /* Count of errors */
                    101: char   *outbuf;                /* buffer for in-memory load */
                    102: FILE   *outputf[NLSEG];        /* output ptrs (for each segment) */
                    103: FILE   *outputr[NLSEG];        /* output pointerf for relocation */
                    104: /*
                    105:  * Structures associated with storage economy
                    106:  */
                    107: mod_t  *mtemp;                 /* only one module in core at a time */
                    108: FILE   *mfp;                   /* temp file for module structures */
                    109: int    mdisk,                  /* flag <>0 means module struct to disk */
                    110:        nmod,                   /* module count */
                    111:        mxmsym;                 /* max # of symbols ref'd by 1 module */
                    112: 
                    113: /*
                    114:  * Seconds between ranlib update and archive modify times
                    115:  */
                    116: #define        SLOPTIME 150
                    117: 
                    118: /* values for worder */
                    119: #define        LOHI    0
                    120: #define        HILO    1
                    121: 
                    122: /*
                    123:  * For pass 2; these will change if format of relocation changed
                    124:  */
                    125: #define        getaddr getlohi
                    126: #define        putaddr(addr, fp, sgp)  putlohi((short)(addr), fp, sgp)
                    127: #define        getsymno getlohi
                    128: #define        putsymno putlohi
                    129: 
                    130: /*
                    131:  * C requires this...
                    132:  */
                    133: void   setbase(), endbind(), undef();
                    134: uaddr_t newpage(), lentry();
                    135: void   symredef(), rdsystem();
                    136: sym_t  *addsym(), *symref(), *newsym();
                    137: fsize_t        symoff(), baseall();
                    138: void   loadmod();
                    139: unsigned short getword(), getlohi(), gethilo();
                    140: void   message(), fatal(), usage(), filemsg(), modmsg(), mpmsg(), spmsg();

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.