Annotation of gas/gas-1.37-coff-new, revision 1.1.1.1

1.1       root        1: *** /dev/null  Wed Nov  7 08:15:02 1990
                      2: --- Makefile.new       Wed Nov  7 08:03:16 1990
                      3: ***************
                      4: *** 0 ****
                      5: --- 1,203 ----
                      6: + # Makefile for GAS.
                      7: + # Copyright (C) 1989, Free Software Foundation
                      8: + # 
                      9: + # This file is part of GAS, the GNU Assembler.
                     10: + # 
                     11: + # GAS is free software; you can redistribute it and/or modify
                     12: + # it under the terms of the GNU General Public License as published by
                     13: + # the Free Software Foundation; either version 1, or (at your option)
                     14: + # any later version.
                     15: + # 
                     16: + # GAS is distributed in the hope that it will be useful,
                     17: + # but WITHOUT ANY WARRANTY; without even the implied warranty of
                     18: + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     19: + # GNU General Public License for more details.
                     20: + # 
                     21: + # You should have received a copy of the GNU General Public License
                     22: + # along with GAS; see the file COPYING.  If not, write to
                     23: + # the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
                     24: + 
                     25: + BINDIR = /usr/local/bin
                     26: + 
                     27: + BINARY = gas
                     28: + 
                     29: + #
                     30: + # Add these flags to XCFLAGS below for specific use.
                     31: + #
                     32: + # If you machine does not have vfprintf, but does have _doprnt(),
                     33: + # -DNO_VARARGS
                     34: + #
                     35: + # If the return-type of a signal-hander is void (instead of int),
                     36: + # -DSIGTY
                     37: + #
                     38: + # To include the mc68851 mmu coprocessor instructions in the 68020 assembler,
                     39: + # -Dm68851 
                     40: + #
                     41: + # If you want the 80386 assembler to correctly handle fsub/fsubr and fdiv/fdivr
                     42: + # opcodes (unlike most 80386 assemblers)
                     43: + # -DNON_BROKEN_WORDS
                     44: + #
                     45: + XCFLAGS =
                     46: + 
                     47: + # Your favorite compiler
                     48: + CC = gcc
                     49: + 
                     50: + # Uncomment the following lines if you use USG
                     51: + 
                     52: + INCLUDE_DIRS = -I.
                     53: + COFF_OBJECTS = stack.o
                     54: + CPPFLAGS = -DUSG
                     55: + CFLAGS = -g $(CPPFLAGS) $(XCFLAGS)
                     56: + LDFLAGS = 
                     57: + #LOADLIBES = -lPW
                     58: + 
                     59: + # Uncomment the following lines if you use BSD
                     60: + #INCLUDE_DIRS = -I.
                     61: + #CPPFLAGS = 
                     62: + #CFLAGS = -g $(CPPFLAGS) $(XCFLAGS)
                     63: + #LDFLAGS = 
                     64: + #LOADLIBES =
                     65: + 
                     66: + CONFIG_FILES = \
                     67: +      machine.c machine.h atof.c oformat.c oformat.h opcode.h
                     68: + 
                     69: + OBJECTS = \
                     70: +      as.o xrealloc.o xmalloc.o hash.o hex-value.o \
                     71: +      atof-generic.o append.o messages.o expr.o app.o \
                     72: +      frags.o input-file.o input-scrub.o output-file.o \
                     73: +      subsegs.o symbols.o version.o flonum-const.o flonum-copy.o \
                     74: +      flonum-mult.o strstr.o bignum-copy.o obstack.o write.o read.o \
                     75: +      oformat.o machine.o atof.o $(COFF_OBJECTS)
                     76: + 
                     77: + SOURCES = $(OBJECTS:.o=.c)
                     78: + 
                     79: + all : $(BINARY)
                     80: + 
                     81: + install : all
                     82: +      cp $(BINARY) $(BINDIR)
                     83: + 
                     84: + clean : 
                     85: +      rm -f $(OBJECTS)
                     86: + 
                     87: + clobber : clean
                     88: +      rm -f $(BINARY) $(CONFIG_FILES) dependencies TAGS m68k.h
                     89: + 
                     90: + $(BINARY) : $(OBJECTS)
                     91: +      $(CC) -o $(BINARY) $(LDFLAGS) $(OBJECTS) $(LOADLIBES)
                     92: + 
                     93: + TAGS : $(SOURCES)
                     94: +      etags $(SOURCES) *.h
                     95: + 
                     96: + CXREF : $(SOURCES)
                     97: +      cxref -c $(INCLUDE_DIRS) $(SOURCES)
                     98: + 
                     99: + stack.o: stack.c
                    100: +      $(CC) $(CFLAGS) -c stack.c
                    101: + 
                    102: + atof.o: \
                    103: +      flonum.h \
                    104: +      bignum.h
                    105: + oformat.o: \
                    106: +      as.h \
                    107: +      md.h \
                    108: +      aout.h \
                    109: +      a.out.gnu.h \
                    110: +      struc-symbol.h \
                    111: +      write.h \
                    112: +      append.h
                    113: + read.o: \
                    114: +      oformat.h \
                    115: +      a.out.gnu.h \
                    116: +      as.h \
                    117: +      read.h \
                    118: +      md.h \
                    119: +      hash.h \
                    120: +      obstack.h \
                    121: +      frags.h \
                    122: +      flonum.h \
                    123: +      bignum.h \
                    124: +      struc-symbol.h \
                    125: +      expr.h \
                    126: +      symbols.h \
                    127: +      sparc.h
                    128: + write.o: \
                    129: +      oformat.h \
                    130: +      a.out.gnu.h \
                    131: +      as.h \
                    132: +      md.h \
                    133: +      subsegs.h \
                    134: +      obstack.h \
                    135: +      struc-symbol.h \
                    136: +      write.h \
                    137: +      symbols.h \
                    138: +      append.h \
                    139: +      sparc.h
                    140: + obstack.o: \
                    141: +      obstack.h
                    142: + bignum-copy.o: \
                    143: +      bignum.h
                    144: + flonum-mult.o: \
                    145: +      flonum.h \
                    146: +      bignum.h
                    147: + flonum-copy.o: \
                    148: +      flonum.h \
                    149: +      bignum.h
                    150: + flonum-const.o: \
                    151: +      flonum.h \
                    152: +      bignum.h
                    153: + symbols.o: \
                    154: +      oformat.h \
                    155: +      a.out.gnu.h \
                    156: +      as.h \
                    157: +      hash.h \
                    158: +      obstack.h \
                    159: +      struc-symbol.h \
                    160: +      symbols.h \
                    161: +      frags.h
                    162: + subsegs.o: \
                    163: +      oformat.h \
                    164: +      a.out.gnu.h \
                    165: +      as.h \
                    166: +      subsegs.h \
                    167: +      obstack.h \
                    168: +      frags.h \
                    169: +      struc-symbol.h \
                    170: +      write.h
                    171: + input-scrub.o: \
                    172: +      as.h \
                    173: +      read.h \
                    174: +      input-file.h
                    175: + input-file.o: \
                    176: +      input-file.h
                    177: + frags.o: \
                    178: +      oformat.h \
                    179: +      a.out.gnu.h \
                    180: +      as.h \
                    181: +      subsegs.h \
                    182: +      obstack.h \
                    183: +      frags.h \
                    184: +      struc-symbol.h
                    185: + expr.o: \
                    186: +      oformat.h \
                    187: +      a.out.gnu.h \
                    188: +      as.h \
                    189: +      flonum.h \
                    190: +      bignum.h \
                    191: +      read.h \
                    192: +      struc-symbol.h \
                    193: +      expr.h \
                    194: +      obstack.h \
                    195: +      symbols.h
                    196: + messages.o: \
                    197: +      as.h
                    198: + atof-generic.o: \
                    199: +      flonum.h \
                    200: +      bignum.h
                    201: + hash.o: \
                    202: +      hash.h
                    203: + as.o: \
                    204: +      oformat.h \
                    205: +      a.out.gnu.h \
                    206: +      as.h \
                    207: +      struc-symbol.h \
                    208: +      write.h
                    209: *** /dev/null  Wed Nov  7 08:15:02 1990
                    210: --- README.coff        Wed Nov  7 07:33:23 1990
                    211: ***************
                    212: *** 0 ****
                    213: --- 1,79 ----
                    214: + The coff patches intend to do the following :
                    215: + 
                    216: +    . Generate coff files very compatible with vanilla linker.
                    217: +    . Understands coff debug directives.
                    218: + 
                    219: + Here are the guidelines of the work I have done :
                    220: + 
                    221: +    . Encapsulate format dependent code in macros where it is possible.
                    222: +    . Where not possible differenciate with #ifdef
                    223: +    . try not to change the calling conventions of the existing functions. 
                    224: +      I made one exception : symbol_new. I would be pleased to hear about
                    225: +      a better solution. (symbols.c)
                    226: +    . Extend the use of N_TYPE_seg seg_N_TYPE tables so that segments can
                    227: +      be manipulated without using their format dependent name. (subsegs.c)
                    228: +    . Write a function to parse the .def debug directives
                    229: +    . Write two small peaces of code to handle the .ln directive.
                    230: +    . In write.c try to move all the cross compilation specifics (md_..) to
                    231: +      format dependent files.
                    232: +    . Encapsulate the data structures using generic types, macros calls.
                    233: +    . Added too much code to resolve the complexity of the symbol table
                    234: +      generated. Most of the code deals with debug stuff.
                    235: +    . Create another makefile, shorter, cleaner.
                    236: +    . Create a config.gas shell script to mimic the gcc,gdb... configuration
                    237: +      mechanism. This reduce the complexity of the makefile.
                    238: +    . Isolate the format dependent code in two files 
                    239: +      coff.c coff.h
                    240: +      aout.c aout.h
                    241: +      elf.c elf.h    [ Not yet ;-]
                    242: +    . added a little stack management routine for coff in file stack.c
                    243: +    . isolate os specific flags in m- files
                    244: + 
                    245: + If further development is planed on it is should solve the following problems :
                    246: + 
                    247: +    . Encapsulate DESC & OTHER tests in a macro call. I'm not aware
                    248: +      of their exact semantics.
                    249: +    . Clean up the seg_N_TYPE N_TYPE_seg naming scheme
                    250: +    . Try to remove as much reference to segment dependent names as possible
                    251: +    . Find a cleaner solution for symbol_new.
                    252: +    . Report the modifications on vax, ns32k, sparc machine dependent files.
                    253: +      To acheive this goal, search for \<N_, sy_, symbol_new and symbolS.
                    254: +    . Allow an arbitrary number of segments (spare sections .ctor .dtor .bletch)
                    255: +    . Find a way to extend the debug information without breaking sdb
                    256: +      compatibility. Mainly intended for G++.
                    257: +    . should it do something to generate shared libraries objects ?
                    258: + 
                    259: + I have tested this code on the following processor/os. gcc-1.37.1 was
                    260: +    used for all the tests.
                    261: + 
                    262: + 386  SCO unix ODT
                    263: +      gcc-1.37.1, gas, emacs-18.55
                    264: + 
                    265: + 386  Esix rev C
                    266: +      gas-1.37/write.s
                    267: + 
                    268: + 386  Ix 2.02
                    269: +      gas, all the X11R4 mit clients
                    270: + 
                    271: + 386  CTIX 3.2
                    272: +      xsol (X11R4 solitary game), gas
                    273: + 
                    274: + 68030        unisoft 1.3     
                    275: +      the kernel (V.3.2) + tcp/ip extensions
                    276: +      bash-1.05, bison-1.11, compress-4.0, cproto, shar-3.49, diff-1.14,
                    277: +      dist-18.55, flex-2.3, gas-1.37, gcc-1.37.1, gdb-3.6, grep-1.5,
                    278: +      kermit, make-3.58, makedep, patch, printf, makeinfo, g++-1.37.1,
                    279: +      tar-1.08, texi2roff, uuencode, uutraf-1.2, libg++-1.37.2, groff-0.5
                    280: + 
                    281: + 68020        sunos 3.5 (no, not coff, just to be sure that I didn't
                    282: +                      introduce errors)
                    283: +      gcc-1.37.1, gas, emacs-18.55, gdb-3.6, bison-1.11, diff-1.14, 
                    284: +      make-3.58, tar-1.08
                    285: + 
                    286: + 68030   sunos 4.0.3 (idem)
                    287: +      gas
                    288: + 
                    289: + I would be glad to hear about new experiences
                    290: + 
                    291: +      Loic  ([email protected] or [email protected])
                    292: + 
                    293: *** /dev/null  Wed Nov  7 08:15:02 1990
                    294: --- aout.c     Wed Nov  7 07:33:24 1990
                    295: ***************
                    296: *** 0 ****
                    297: --- 1,146 ----
                    298: + #include "as.h"
                    299: + #include "md.h"
                    300: + #include "aout.h"
                    301: + #include "struc-symbol.h"
                    302: + #include "write.h"
                    303: + #include "append.h"
                    304: + 
                    305: + /* Relocation. */
                    306: + 
                    307: + /*
                    308: +  * In: length of relocation (or of address) in chars: 1, 2 or 4.
                    309: +  * Out: GNU LD relocation length code: 0, 1, or 2.
                    310: +  */
                    311: + 
                    312: + static unsigned char
                    313: + 
                    314: + nbytes_r_length [] = {
                    315: +   42, 0, 1, 42, 2
                    316: +   };
                    317: + 
                    318: + 
                    319: + /* The sparc needs its own emit_relocations() */
                    320: + #if !defined(SPARC) && !defined(I860)
                    321: + /*
                    322: +  *           emit_relocations()
                    323: +  *
                    324: +  * Crawl along a fixS chain. Emit the segment's relocations.
                    325: +  */
                    326: + void
                    327: + emit_relocations (fixP, segment_address_in_file)
                    328: +      register fixS * fixP;   /* Fixup chain for this segment. */
                    329: +      relax_addressT  segment_address_in_file;
                    330: + {
                    331: +   struct relocation_info     ri;
                    332: +   register symbolS *         symbolP;
                    333: + 
                    334: +      /* JF this is for paranoia */
                    335: +   bzero((char *)&ri,sizeof(ri));
                    336: +   for ( ;  fixP;  fixP = fixP -> fx_next)
                    337: +     {
                    338: +       if (symbolP = fixP -> fx_addsy)
                    339: +      {
                    340: + 
                    341: + #ifdef NS32K
                    342: +              /* These two 'cuz of NS32K */
                    343: +        ri . r_bsr            = fixP -> fx_bsr;
                    344: +        ri . r_disp           = fixP -> fx_im_disp;
                    345: + #endif
                    346: + 
                    347: +        ri . r_length         = nbytes_r_length [fixP -> fx_size];
                    348: +        ri . r_pcrel          = fixP -> fx_pcrel;
                    349: +        ri . r_address        = fixP -> fx_frag -> fr_address
                    350: +          +   fixP -> fx_where
                    351: +            - segment_address_in_file;
                    352: +        if ((symbolP -> sy_type & N_TYPE) == N_UNDF)
                    353: +          {
                    354: +            ri . r_extern     = 1;
                    355: +            ri . r_symbolnum  = symbolP -> sy_number;
                    356: +          }
                    357: +        else
                    358: +          {
                    359: +            ri . r_extern     = 0;
                    360: +            ri . r_symbolnum  = symbolP -> sy_type & N_TYPE;
                    361: +          }
                    362: + 
                    363: +        /* 
                    364: +          The 68k machines assign bit-fields from higher bits to 
                    365: +          lower bits ("left-to-right") within the int.  VAXen assign 
                    366: +          bit-fields from lower bits to higher bits ("right-to-left").
                    367: +          Both handle multi-byte numbers in their usual fashion
                    368: +          (Big-endian and little-endian stuff).
                    369: +          Thus we need a machine dependent routine to make
                    370: +          sure the structure is written out correctly.  FUN!
                    371: +         */
                    372: +        md_ri_to_chars((char *) &ri, ri); 
                    373: +        append (&next_object_file_charP, (char *)& ri, (unsigned long)sizeof(ri));
                    374: +      }
                    375: +     }
                    376: + 
                    377: + }
                    378: + #endif
                    379: + 
                    380: + /* Aout file generation & utilities */
                    381: + 
                    382: + /* Convert a lvalue to machine dependent data */
                    383: + #define MD(v)        \
                    384: +   md_number_to_chars((char *)&header->v,header->v, sizeof(header->v))
                    385: + 
                    386: + void a_header_append(header, where)
                    387: + struct exec * header;
                    388: + char** where;
                    389: + {
                    390: +     MD(a_text);
                    391: +     MD(a_data);
                    392: +     MD(a_bss);
                    393: +     MD(a_trsize);
                    394: +     MD(a_drsize);
                    395: +     MD(a_syms);
                    396: +     MD(a_info);
                    397: +     MD(a_entry);
                    398: + #ifdef EXEC_MACHINE_TYPE
                    399: +     MD(a_machtype);
                    400: + #endif /* EXEC_MACHINE_TYPE */
                    401: + #ifdef EXEC_VERSION
                    402: +     MD(a_version);
                    403: + #endif /* EXEC_VERSION */
                    404: +     append(where, (char *)header, sizeof(struct exec));
                    405: + }
                    406: + 
                    407: + #undef MD
                    408: + /* Convert a lvalue to machine dependent data */
                    409: + #define MD(v)        \
                    410: +   md_number_to_chars((char *)&symbolP->v,symbolP->v, sizeof(symbolP->v))
                    411: + 
                    412: + void a_symbol_append(symbolP, where)
                    413: + symbolS *    symbolP;
                    414: + char**               where;
                    415: + {
                    416: +     MD(sy_strx);
                    417: +     MD(sy_desc);
                    418: +     MD(sy_value);
                    419: +     append(where, (char *)&symbolP->sy_symbol, sizeof(symbol_type));
                    420: + }
                    421: + 
                    422: + void emit_symbols(symbol_rootP, where)
                    423: + symbolS *    symbol_rootP;
                    424: + char**               where;
                    425: + {
                    426: +     symbolS *        symbolP;
                    427: +     /*
                    428: +      * Emit all symbols left in the symbol chain.
                    429: +      */
                    430: +     for(symbolP = symbol_rootP; symbolP; symbolP = symbolP -> sy_next) {
                    431: +      /* Used to save the offset of the name. It is used to point
                    432: +         to the string in memory but must be a file offset. */
                    433: +      register char * temp;
                    434: + 
                    435: +      temp = S_GET_NAME(symbolP);
                    436: +      S_SET_OFFSET(symbolP, symbolP->sy_name_offset);
                    437: +      /* Any symbol still undefined and is not a dbg symbol is made N_EXT. */
                    438: +      if (symbolP->sy_type == N_UNDF)
                    439: +          S_SET_EXTERNAL(symbolP);
                    440: +      SYMBOL_OUTPUT(symbolP, where);
                    441: +      S_SET_NAME(symbolP,temp);
                    442: +     }
                    443: + }
                    444: *** /dev/null  Wed Nov  7 08:15:02 1990
                    445: --- aout.h     Wed Nov  7 07:33:25 1990
                    446: ***************
                    447: *** 0 ****
                    448: --- 1,166 ----
                    449: + #ifndef AOUT_H
                    450: + #define AOUT_H
                    451: + 
                    452: + #include "machine.h"
                    453: + 
                    454: + #ifndef              VMS
                    455: + #include "a.out.gnu.h"               /* Needed to define struct nlist. Sigh. */
                    456: + #else
                    457: + #include "a_out.h"
                    458: + #endif
                    459: + 
                    460: + /* Tag to validate a.out object file format processing */
                    461: + #define aout
                    462: + 
                    463: + /* RELOCATION INFORMATION */
                    464: + 
                    465: + #define relocation_type struct relocation_info       /* Relocation table entry */
                    466: + #define RELSZ sizeof(relocation_type)                /* For coff compatibility */
                    467: +  
                    468: + /* SYMBOL TABLE */
                    469: + /* Symbol table entry data type */
                    470: + 
                    471: + #define symbol_type struct nlist     /* Symbol table entry */
                    472: + 
                    473: + /* If compiler generate leading underscores, remove them. */
                    474: + 
                    475: + #ifndef STRIP_UNDERSCORE
                    476: + #define STRIP_UNDERSCORE 0
                    477: + #endif /* STRIP_UNDERSCORE */
                    478: + 
                    479: + /* Symbol table macros and constants */
                    480: + 
                    481: + /*
                    482: +  *  Macros to extract information from a symbol table entry.
                    483: +  *  This syntaxic indirection allows independence regarding a.out or coff.
                    484: +  *  The argument (s) of all these macros is a pointer to a symbol table entry.
                    485: +  */
                    486: + 
                    487: + /* Predicates */
                    488: + /* True if in text segment */
                    489: + #define S_IS_TEXT(s)         (((s)->sy_type & N_TYPE) == N_TEXT)
                    490: + /* True if in data segment */
                    491: + #define S_IS_DATA(s)         (((s)->sy_type & N_TYPE) == N_DATA)
                    492: + /* True if in bss segment */
                    493: + #define S_IS_BSS(s)          (((s)->sy_type & N_TYPE) == N_BSS)
                    494: + /* True if in abs segment */
                    495: + #define S_IS_ABS(s)          (((s)->sy_type & N_TYPE) == N_ABS)
                    496: + /* True if the symbol is external */
                    497: + #define S_IS_EXTERNAL(s)     ((s)->sy_type & N_EXT)
                    498: + /* True if symbol has been defined, ie is in N_{TEXT,DATA,BSS,ABS} or N_EXT */
                    499: + #define S_IS_DEFINED(s)              (((s)->sy_type & N_TYPE) != N_UNDF)
                    500: + /* True if a debug special symbol entry */
                    501: + #define S_IS_DEBUG(s)                ((s)->sy_type & N_STAB)
                    502: + /* True if a symbol is local symbol name */
                    503: + /* A symbol name whose name begin with ^A is a gas internal pseudo symbol
                    504: +    nameless symbols come from .stab directives. */
                    505: + #define S_IS_LOCAL(s)                (S_GET_NAME(s) && \
                    506: +                               !S_IS_DEBUG(s) && \
                    507: +                               (S_GET_NAME(s)[0] == '\001' || \
                    508: +                                (S_LOCAL_NAME(s) && !flagseen['L'])))
                    509: + /* True if a symbol is not defined in this file */
                    510: + #define S_IS_EXTERN(s)               ((s)->sy_type & N_EXT)
                    511: + /* True if the symbol has been generated because of a .stabd directive */
                    512: + #define S_IS_STABD(s)                ((s)->sy_name == (char *)0)
                    513: + 
                    514: + /* Accessors */
                    515: + /* The value of the symbol */
                    516: + #define S_GET_VALUE(s)               ((s)->sy_value)
                    517: + /* The name of the symbol */
                    518: + #define S_GET_NAME(s)                ((s)->sy_name)
                    519: + /* The pointer to the string table */
                    520: + #define S_GET_OFFSET(s)              ((s)->sy_strx)
                    521: + /* The numeric value of the segment */
                    522: + #define S_GET_SEGMENT(s)     ((s)->sy_type & N_TYPE)
                    523: + /* The n_other expression value */
                    524: + #define S_GET_OTHER(s)               ((s)->sy_other)
                    525: + /* The n_desc expression value */
                    526: + #define S_GET_DESC(s)                ((s)->sy_desc)
                    527: + 
                    528: + /* Modifiers */
                    529: + /* Set the value of the symbol */
                    530: + #define S_SET_VALUE(s,v)     ((s)->sy_value = (v))
                    531: + /* Assume that a symbol cannot be simultaneously in more than on segment */
                    532: + /* Set the segment to text */
                    533: + #define S_SET_TEXT(s)                ((s)->sy_type &= ~N_TYPE,(s)->sy_type|=N_TEXT)
                    534: + /* Set the segment to data */
                    535: + #define S_SET_DATA(s)                ((s)->sy_type &= ~N_TYPE,(s)->sy_type|=N_DATA)
                    536: + /* Set the segment to bss */
                    537: + #define S_SET_BSS(s)         ((s)->sy_type &= ~N_TYPE,(s)->sy_type|=N_BSS)
                    538: + /* Set the segment to abs */
                    539: + #define S_SET_ABS(s)         ((s)->sy_type &= ~N_TYPE,(s)->sy_type|=N_ABS)
                    540: + /* The symbol is external */
                    541: + #define S_SET_EXTERNAL(s)    ((s)->sy_type |= N_EXT)
                    542: + /* The symbol is not external */
                    543: + #define S_CLEAR_EXTERNAL(s)  ((s)->sy_type &= ~N_EXT)
                    544: + /* Set the name of the symbol */
                    545: + #define S_SET_NAME(s,v)              ((s)->sy_name = v)
                    546: + /* Set the offset in the string table */
                    547: + #define S_SET_OFFSET(s,v)    ((s)->sy_strx = v)
                    548: + /* Set the n_other expression value */
                    549: + #define S_SET_OTHER(s,v)     ((s)->sy_other = (v))
                    550: + /* Set the n_desc expression value */
                    551: + #define S_SET_DESC(s,v)              ((s)->sy_desc = (v))
                    552: + 
                    553: + /* File header macro and type definition */
                    554: + 
                    555: + #define H_GET_FILE_SIZE(h)   (sizeof(struct exec) + \
                    556: +                               H_GET_TEXT_SIZE(h) + H_GET_DATA_SIZE(h) + \
                    557: +                               H_GET_SYMBOL_TABLE_SIZE(h) + \
                    558: +                               H_GET_TEXT_RELOCATION_SIZE(h) + \
                    559: +                               H_GET_DATA_RELOCATION_SIZE(h) + \
                    560: +                               (h)->string_table_size)
                    561: + 
                    562: + #define H_GET_TEXT_SIZE(h)           ((h)->header.a_text)
                    563: + #define H_GET_DATA_SIZE(h)           ((h)->header.a_data)
                    564: + #define H_GET_BSS_SIZE(h)            ((h)->header.a_bss)
                    565: + #define H_GET_TEXT_RELOCATION_SIZE(h)        ((h)->header.a_trsize)
                    566: + #define H_GET_DATA_RELOCATION_SIZE(h)        ((h)->header.a_drsize)
                    567: + #define H_GET_SYMBOL_TABLE_SIZE(h)   ((h)->header.a_syms)
                    568: + #define H_GET_MAGIC_NUMBER(h)                ((h)->header.a_info)
                    569: + #define H_GET_ENTRY_POINT(h)         ((h)->header.a_entry)
                    570: + #define H_GET_STRING_SIZE(h)         ((h)->string_table_size)
                    571: + #ifdef EXEC_MACHINE_TYPE
                    572: + #define H_GET_MACHINE_TYPE(h)                ((h)->header.a_machtype)
                    573: + #endif /* EXEC_MACHINE_TYPE */
                    574: + #ifdef EXEC_VERSION
                    575: + #define H_GET_VERSION(h)             ((h)->header.a_version)
                    576: + #endif /* EXEC_VERSION */
                    577: + 
                    578: + #define H_SET_TEXT_SIZE(h,v)         ((h)->header.a_text = (v))
                    579: + #define H_SET_DATA_SIZE(h,v)         ((h)->header.a_data = (v))
                    580: + #define H_SET_BSS_SIZE(h,v)          ((h)->header.a_bss = (v))
                    581: + #define H_SET_RELOCATION_SIZE(h,t,d) (H_SET_TEXT_RELOCATION_SIZE((h),(t)),\
                    582: +                                       H_SET_DATA_RELOCATION_SIZE((h),(d)))
                    583: + #define H_SET_TEXT_RELOCATION_SIZE(h,v)      ((h)->header.a_trsize = (v))
                    584: + #define H_SET_DATA_RELOCATION_SIZE(h,v)      ((h)->header.a_drsize = (v))
                    585: + #define H_SET_SYMBOL_TABLE_SIZE(h,v) ((h)->header.a_syms = (v) * \
                    586: +                                       sizeof(struct nlist))
                    587: + #define H_SET_MAGIC_NUMBER(h,v)              ((h)->header.a_info = (v))
                    588: + #define H_SET_ENTRY_POINT(h,v)               ((h)->header.a_entry = (v))
                    589: + #define H_SET_STRING_SIZE(h,v)               ((h)->string_table_size = (v))
                    590: + #ifdef EXEC_MACHINE_TYPE
                    591: + #define H_SET_MACHINE_TYPE(h,v)              ((h)->header.a_machtype = (v))
                    592: + #endif /* EXEC_MACHINE_TYPE */
                    593: + #ifdef EXEC_VERSION
                    594: + #define H_SET_VERSION(h,v)           ((h)->header.a_version = (v))
                    595: + #endif /* EXEC_VERSION */
                    596: + 
                    597: + /* Output the file(s) header(s) in a character array */
                    598: + #define H_OUTPUT(h,where)    a_header_append(&(h)->header,(where))
                    599: + 
                    600: + /* Output a symbol entry */
                    601: + #define SYMBOL_OUTPUT(s,w)   a_symbol_append((s), (w))
                    602: + 
                    603: + typedef struct {
                    604: +     struct exec      header;                 /* a.out header */
                    605: +     long int string_table_size;      /* names + '\0' + sizeof(int) */
                    606: + } object_headers;
                    607: + 
                    608: + /* Format independent interface functions */
                    609: + extern void          emit_relocations();
                    610: + extern void          emit_symbols();
                    611: + extern void          a_header_append();
                    612: + extern void          a_symbol_append();
                    613: + 
                    614: + #endif /* AOUT_H */
                    615: *** /dev/null  Wed Nov  7 08:15:02 1990
                    616: --- append.h   Wed Nov  7 07:33:26 1990
                    617: ***************
                    618: *** 0 ****
                    619: --- 1,1 ----
                    620: + extern void  append();
                    621: *** /dev/null  Wed Nov  7 08:15:02 1990
                    622: --- coff.c     Wed Nov  7 07:33:27 1990
                    623: ***************
                    624: *** 0 ****
                    625: --- 1,364 ----
                    626: + #include "oformat.h"
                    627: + #include "as.h"
                    628: + #include "md.h"
                    629: + #include "struc-symbol.h"
                    630: + #include "symbols.h"    
                    631: + #include "write.h"
                    632: + 
                    633: + /* Relocation. */
                    634: + 
                    635: + /*
                    636: +  *           emit_relocations()
                    637: +  *
                    638: +  * Crawl along a fixS chain. Emit the segment's relocations.
                    639: +  */
                    640: +     
                    641: + void
                    642: + emit_relocations (fixP, segment_address_in_file)
                    643: + register fixS *      fixP;   /* Fixup chain for this segment. */
                    644: + relax_addressT       segment_address_in_file;
                    645: + {
                    646: +     RELOC                    ri;
                    647: +     register symbolS *               symbolP;
                    648: +     
                    649: +     bzero((char *)&ri,sizeof(ri));
                    650: +     for ( ;  fixP;  fixP = fixP->fx_next) {
                    651: +      if (symbolP = fixP->fx_addsy) {
                    652: + #if defined(PROCESSOR_68000)
                    653: +          ri.r_type = (fixP->fx_pcrel ? 
                    654: +                       ( fixP->fx_size == 1 ? R_PCRBYTE :
                    655: +                        fixP->fx_size == 2 ? R_PCRWORD :
                    656: +                        R_PCRLONG):
                    657: +                       ( fixP->fx_size == 1 ? R_RELBYTE :
                    658: +                        fixP->fx_size == 2 ? R_RELWORD :
                    659: +                        R_RELLONG));
                    660: + #elif defined(PROCESSOR_i386)
                    661: +          /* !!!! R_OFF8 & R_DIR16 are a vague guess, completly unested. */
                    662: +          ri.r_type = (fixP->fx_pcrel ? 
                    663: +                       ( fixP->fx_size == 1 ? R_PCRBYTE :
                    664: +                        fixP->fx_size == 2 ? R_PCRWORD :
                    665: +                        R_PCRLONG):
                    666: +                       ( fixP->fx_size == 1 ? R_OFF8 :
                    667: +                        fixP->fx_size == 2 ? R_DIR16 :
                    668: +                        R_DIR32));
                    669: + #else
                    670: +          you lose
                    671: + #endif /* PROCESSOR_68000 || PROCESSOR_i386 */
                    672: +              ri.r_vaddr = fixP->fx_frag->fr_address + fixP->fx_where;
                    673: +          /* If symbol associated to relocation entry is a bss symbol 
                    674: +             or undefined symbol just remember the index of the symbol.
                    675: +             Otherwise store the index of the symbol describing the 
                    676: +             section the symbol belong to. This heuristic speeds up ld.
                    677: +             */
                    678: +          /* Local symbols can generate relocation information. In case
                    679: +             of structure return for instance. But they have no symbol
                    680: +             number because they won't be emitted in the final object.
                    681: +             In the case where they are in the BSS section, this leads
                    682: +             to an incorrect r_symndx.
                    683: +             Under bsd the loader do not care if the symbol reference is
                    684: +             incorrect. But the SYS V ld complains about this. To avoid
                    685: +             this we associate the symbol to the associated section, 
                    686: +             *even* if it is the BSS section. */
                    687: +          /* If someone can tell me why the other symbols of the bss 
                    688: +             section are not associated with the .bss section entry, 
                    689: +             I'd be gratefull. I guess that it has to do with the special
                    690: +             nature of the .bss section. Or maybe this is because the 
                    691: +             bss symbols are declared in the common section and can
                    692: +             be resized later. Can it break code some where ? */
                    693: +          ri.r_symndx =
                    694: +      S_GET_SEGMENT(symbolP) == C_TEXT_SECTION ? dot_text_symbol->sy_number :
                    695: +      S_GET_SEGMENT(symbolP) == C_DATA_SECTION ? dot_data_symbol->sy_number :
                    696: +             (SF_GET_LOCAL(symbolP) ? dot_bss_symbol->sy_number :
                    697: +              symbolP->sy_number); /* bss or undefined */
                    698: +          
                    699: +          /* md_ri_to_chars((char *) &ri, ri);  /* Last step : write md f */
                    700: +          append (&next_object_file_charP,
                    701: +                  (char *)& ri,
                    702: +                  (unsigned long)RELSZ);
                    703: +      }
                    704: +     }
                    705: + }
                    706: + 
                    707: + /* Coff file generation & utilities */
                    708: + 
                    709: + /* Convert a lvalue to machine dependent data */
                    710: + #define MD(s,v)   \
                    711: +   md_number_to_chars((char *)&(s)->v,(s)->v, sizeof((s)->v))
                    712: + 
                    713: + void
                    714: + c_header_append(aouthdr, filehdr, where)
                    715: + AOUTHDR*     aouthdr;
                    716: + FILHDR*              filehdr;
                    717: + char**               where;
                    718: + {
                    719: +     /* Eventually swap bytes for cross compilation for file header */
                    720: +     MD(filehdr, f_magic);
                    721: +     MD(filehdr, f_nscns);
                    722: +     MD(filehdr, f_timdat);
                    723: +     MD(filehdr, f_symptr);
                    724: +     MD(filehdr, f_nsyms);
                    725: +     MD(filehdr, f_opthdr);
                    726: +     MD(filehdr, f_flags);
                    727: +     append(where, (char *)filehdr, FILHSZ);
                    728: + 
                    729: +     /* Eventually swap bytes for cross compilation for a.out header */
                    730: +     MD(aouthdr, magic);
                    731: +     MD(aouthdr, vstamp);
                    732: +     MD(aouthdr, tsize);
                    733: +     MD(aouthdr, dsize);
                    734: +     MD(aouthdr, bsize);
                    735: +     MD(aouthdr, entry);
                    736: +     MD(aouthdr, text_start);
                    737: +     MD(aouthdr, data_start);
                    738: +     append(where, (char *)aouthdr, sizeof(struct aouthdr));
                    739: + }
                    740: + 
                    741: + /*
                    742: +  * Beware ! If you cross compile to another ENDIAN machine,
                    743: +  * the symbol table values will not be valid any more.
                    744: +  */
                    745: + 
                    746: + void
                    747: + c_symbol_append(symbolP, where)
                    748: + symbolS *    symbolP;
                    749: + char**               where;
                    750: + {
                    751: +     SYMENT                   *syment = &symbolP->sy_symbol;
                    752: +     char                     numaux  = syment->n_numaux;
                    753: +     register AUXENT*         auxP    = &symbolP->sy_auxent;
                    754: +     register unsigned short  type    = S_GET_DATA_TYPE(symbolP);
                    755: + 
                    756: +     MD(syment, n_value);
                    757: +     MD(syment, n_scnum);
                    758: +     MD(syment, n_type);
                    759: +     MD(syment, n_sclass);
                    760: +     MD(syment, n_numaux);
                    761: +     append(where, (char *)syment, SYMESZ);
                    762: + 
                    763: +     /* Should do the following : if(.file entry) MD(..)... else
                    764: +        if(static entry) MD(..)
                    765: +      */
                    766: +     if(numaux == 1) {
                    767: + #if 0 /* This code has never been tested */
                    768: +      /* The most common case, x_sym entry. */
                    769: +      if((SF_GET(symbolP) & (SF_FILE | SF_STATICS)) == 0) {
                    770: +          MD(auxP, x_sym.x_tagndx);
                    771: +          if(ISFCN(type))
                    772: +              MD(auxP, x_sym.x_misc.x_fsize);
                    773: +          else {
                    774: +              MD(auxP, x_sym.x_misc.x_lnno);
                    775: +              MD(auxP, x_sym.x_misc.x_size);
                    776: +          }
                    777: +          if(ISARY(type)) {
                    778: +              register int index;
                    779: +              for(index = 0; index < DIMNUM; index++)
                    780: +                  MD(auxP, x_sym.x_fcnary.x_ary.x_dimen[index]);
                    781: +          } else {
                    782: +              MD(auxP, x_sym.x_fcnary.x_fcn.x_lnnoptr);
                    783: +              MD(auxP, x_sym.x_fcnary.x_fcn.x_endndx);
                    784: +          }
                    785: +          MD(auxP, x_sym.x_tvndx);
                    786: +      } else if(SF_GET_FILE(symbolP)) /* .file */
                    787: +          ;
                    788: +      else if(SF_GET_STATICS(symbolP)) { /* .text, .data, .bss symbols */
                    789: +          MD(auxP, x_scn.x_scnlen);
                    790: +          MD(auxP, x_scn.x_nreloc);
                    791: +          MD(auxP, x_scn.x_nlinno);
                    792: +      }
                    793: + #endif /* 0 */
                    794: +      append(where, (char *)auxP, AUXESZ);
                    795: +     } else if(numaux > 0)
                    796: +      as_warn("more than one auxent for symbol");
                    797: +     
                    798: +     return;
                    799: + }
                    800: + 
                    801: + void
                    802: + c_section_header_append(header, where)
                    803: + SCNHDR*              header;
                    804: + char**               where;
                    805: + {
                    806: +     MD(header, s_paddr);
                    807: +     MD(header, s_vaddr);
                    808: +     MD(header, s_size);
                    809: +     MD(header, s_scnptr);
                    810: +     MD(header, s_relptr);
                    811: +     MD(header, s_lnnoptr);
                    812: +     MD(header, s_nreloc);
                    813: +     MD(header, s_nlnno);
                    814: +     MD(header, s_flags);
                    815: +     append(where, (char *)header, SCNHSZ);
                    816: + 
                    817: +     return;
                    818: + }
                    819: + 
                    820: + 
                    821: + void emit_symbols(symbol_rootP, where)
                    822: + symbolS *    symbol_rootP;
                    823: + char**               where;
                    824: + {
                    825: +     symbolS *        symbolP;
                    826: +     /*
                    827: +      * Emit all symbols left in the symbol chain.
                    828: +      */
                    829: +     for(symbolP = symbol_rootP; symbolP; symbolP = symbolP -> sy_next) {
                    830: +      /* Used to save the offset of the name. It is used to point
                    831: +         to the string in memory but must be a file offset. */
                    832: +      register char * temp;
                    833: + 
                    834: +      temp = S_GET_NAME(symbolP);
                    835: +      if (SF_GET_STRING(symbolP)) {
                    836: +          S_SET_OFFSET(symbolP, symbolP->sy_name_offset);
                    837: +          S_SET_ZEROES(symbolP, 0);
                    838: +      } else {
                    839: +          memset(symbolP->sy_name, '\0', SYMNMLEN);
                    840: +          strncpy(symbolP->sy_name, temp, SYMNMLEN);
                    841: +      }
                    842: +      SYMBOL_OUTPUT(symbolP, where);
                    843: +      S_SET_NAME(symbolP,temp);
                    844: +     }
                    845: + }
                    846: + 
                    847: + /* Merge a debug symbol containing debug information into a normal
                    848: +    symbol. */
                    849: + 
                    850: + void
                    851: + c_symbol_merge(debug, normal)
                    852: + symbolS* debug;
                    853: + symbolS* normal;
                    854: + {
                    855: +     S_SET_DATA_TYPE(normal, S_GET_DATA_TYPE(debug));
                    856: +     S_SET_STORAGE_CLASS(normal, S_GET_STORAGE_CLASS(debug));
                    857: +     S_SET_NUMBER_AUXILIARY(normal, S_GET_NUMBER_AUXILIARY(debug));
                    858: +     /* Move all the auxiliary information */
                    859: +     if(S_GET_NUMBER_AUXILIARY(debug))
                    860: +      memcpy((char*)&normal->sy_auxent, (char*)&debug->sy_auxent,
                    861: +             AUXESZ);
                    862: +     /* Move the debug flags. */
                    863: +     SF_SET_DEBUG_FIELD(normal, SF_GET_DEBUG_FIELD(debug));
                    864: + }
                    865: + 
                    866: + c_dot_file_symbol(filename)
                    867: + char*        filename;
                    868: + {
                    869: +     symbolS* symbolP;
                    870: +     
                    871: +     symbolP = symbol_new(".file", SEG_DEBUG, 0,
                    872: +                             C_FILE, &zero_address_frag);
                    873: +     S_SET_NUMBER_AUXILIARY(symbolP, 1);
                    874: +     SA_SET_FILE_FNAME(symbolP, filename);
                    875: +     SF_SET_DEBUG(symbolP);
                    876: + 
                    877: +     /* Make sure that the symbol is first on the symbol chain */
                    878: +     if(symbol_rootP != symbolP) {
                    879: +      symbol_lastP = symbol_lastP->sy_previous;
                    880: +      DL_REMOVE(symbolP);
                    881: +      DL_INSERT(symbolP, symbol_rootP);
                    882: +      symbol_rootP = symbolP;
                    883: +     }
                    884: + }
                    885: + /* 
                    886: +  * Build a 'section static' symbol.
                    887: +  */
                    888: + 
                    889: + char* 
                    890: + c_section_symbol(name, value, length, nreloc, nlnno)
                    891: + char* name;
                    892: + long value;
                    893: + long length;
                    894: + unsigned short nreloc;
                    895: + unsigned short nlnno;
                    896: + {
                    897: +     symbolS* symbolP;
                    898: + 
                    899: +     symbolP = symbol_new(name,
                    900: +                             (name[1] == 't' ? SEG_TEXT : 
                    901: +                              name[1] == 'd' ? SEG_DATA :
                    902: +                                               SEG_BSS),
                    903: +                             value,
                    904: +                             C_STAT,
                    905: +                             &zero_address_frag);
                    906: + 
                    907: +     S_SET_NUMBER_AUXILIARY(symbolP, 1);
                    908: + 
                    909: +     SA_SET_SCN_SCNLEN(symbolP, length);
                    910: +     SA_SET_SCN_NRELOC(symbolP, nreloc);
                    911: +     SA_SET_SCN_NLINNO(symbolP, nlnno);
                    912: + 
                    913: +     SF_SET_STATICS(symbolP);
                    914: + 
                    915: +     return (char*)symbolP;
                    916: + }
                    917: + 
                    918: + void
                    919: + c_section_header(header, name, core_address, size,
                    920: +               data_ptr, reloc_ptr, lineno_ptr,
                    921: +               reloc_number, lineno_number)
                    922: + SCNHDR*                      header;
                    923: + char*                        name;
                    924: + long                 core_address;
                    925: + long                 size;
                    926: + long                 data_ptr;
                    927: + long                 reloc_ptr;
                    928: + long                 lineno_ptr;
                    929: + long                 reloc_number;
                    930: + long                 lineno_number;
                    931: + {
                    932: +     strncpy(header->s_name, name, 8);
                    933: +     header->s_paddr = header->s_vaddr = core_address;
                    934: +     header->s_size = size;
                    935: +     header->s_scnptr = data_ptr;
                    936: +     header->s_relptr = reloc_ptr;
                    937: +     header->s_lnnoptr = lineno_ptr;
                    938: +     header->s_nreloc = reloc_number;
                    939: +     header->s_nlnno = lineno_number;
                    940: +     header->s_flags = STYP_REG | ( name[1] == 't' ? STYP_TEXT :
                    941: +                                 name[1] == 'd' ? STYP_DATA :
                    942: +                                 name[1] == 'b' ? STYP_BSS  :
                    943: +                                 STYP_INFO );
                    944: +     return ;
                    945: + }
                    946: + 
                    947: + /* Line number handling */
                    948: + 
                    949: + int text_lineno_number = 0;
                    950: + lineno* lineno_rootP = (lineno*)0;
                    951: + lineno* lineno_lastP = (lineno*)0;
                    952: + 
                    953: + lineno*
                    954: + c_line_new(paddr, line_number, frag)
                    955: + long paddr;
                    956: + unsigned short line_number;
                    957: + fragS* frag;
                    958: + {
                    959: +     lineno* new_line = (lineno*)xmalloc(sizeof(lineno));
                    960: + 
                    961: +     new_line->line.l_addr.l_paddr = paddr;
                    962: +     new_line->line.l_lnno = line_number;
                    963: +     new_line->frag = (char*)frag;
                    964: +     new_line->next = (lineno*)0;
                    965: + 
                    966: +     if(lineno_rootP == (lineno*)0)
                    967: +      lineno_rootP = new_line;
                    968: +     else 
                    969: +      lineno_lastP->next = new_line;
                    970: +     lineno_lastP = new_line;
                    971: + }
                    972: + 
                    973: + void
                    974: + emit_lineno(line, where)
                    975: + lineno* line;
                    976: + char** where;
                    977: + {
                    978: +     register LINENO* line_entry;
                    979: + 
                    980: +     for(;line;line = line->next) {
                    981: +      line_entry = &line->line;
                    982: +      /* No matter which member of the union we process, they are
                    983: +         both long. */
                    984: +      MD(line_entry, l_addr.l_paddr);
                    985: +      MD(line_entry, l_lnno);
                    986: +      append(where, (char *)line_entry, LINESZ);
                    987: +     }
                    988: +     return ;
                    989: + }
                    990: *** /dev/null  Wed Nov  7 08:15:02 1990
                    991: --- coff.h     Wed Nov  7 07:33:28 1990
                    992: ***************
                    993: *** 0 ****
                    994: --- 1,400 ----
                    995: + #ifndef COFF_H
                    996: + #define COFF_H
                    997: + 
                    998: + #include <filehdr.h>
                    999: + #include <aouthdr.h>
                   1000: + #include <scnhdr.h>
                   1001: + #include <storclass.h>
                   1002: + #include <linenum.h>
                   1003: + #include <syms.h>
                   1004: + #include <reloc.h>
                   1005: + 
                   1006: + #include "machine.h"
                   1007: + #include "stack.h"
                   1008: + 
                   1009: + /* Tag to validate coff object file format processing */
                   1010: + #define coff
                   1011: + 
                   1012: + /* Define some processor dependent values according to the processor we are
                   1013: +    on. */
                   1014: + #if defined(PROCESSOR_68000)
                   1015: + 
                   1016: + #define BYTE_ORDERING                F_AR32W    /* See filehdr.h for more info. */
                   1017: + #ifndef FILE_HEADER_MAGIC
                   1018: + #define FILE_HEADER_MAGIC    MC68MAGIC  /* ... */
                   1019: + #endif /* FILE_HEADER_MAGIC */
                   1020: + 
                   1021: + #elif defined(PROCESSOR_i386)
                   1022: + 
                   1023: + #define BYTE_ORDERING                F_AR32WR   /* See filehdr.h for more info. */
                   1024: + #ifndef FILE_HEADER_MAGIC
                   1025: + #define FILE_HEADER_MAGIC    I386MAGIC  /* ... */
                   1026: + #endif /* FILE_HEADER_MAGIC */
                   1027: + 
                   1028: + #elif
                   1029: + you lose
                   1030: + #endif 
                   1031: + 
                   1032: + /* Magic number of paged executable. */
                   1033: + #define OMAGIC       0413
                   1034: + 
                   1035: + /* Add these definitions to have a consistent convention for all the
                   1036: +    types used in COFF format. */
                   1037: + #define AOUTHDR                      struct aouthdr
                   1038: + #define AOUTHDRSZ            sizeof(AOUTHDR)
                   1039: + 
                   1040: + /* RELOCATION INFORMATION */
                   1041: + 
                   1042: + #define relocation_type RELOC        /* Relocation table entry */
                   1043: +  
                   1044: + /* SYMBOL TABLE */
                   1045: + 
                   1046: + /* Symbol table entry data type */
                   1047: + 
                   1048: + #define symbol_type SYMENT   /* Symbol table entry */
                   1049: + 
                   1050: + /* If compiler generate leading underscores, remove them. */
                   1051: + 
                   1052: + #ifndef STRIP_UNDERSCORE
                   1053: + #define STRIP_UNDERSCORE 0
                   1054: + #endif /* STRIP_UNDERSCORE */
                   1055: + #define DO_NOT_STRIP 0
                   1056: + #define DO_STRIP     1
                   1057: + 
                   1058: + /* Double linked list manipulations macros. */
                   1059: + /* See struc-symbol.h for a definition of symbolS. */
                   1060: + 
                   1061: + /* Remove the argument from the list. */
                   1062: + #define DL_REMOVE(p) \
                   1063: +     (((p)->sy_next && ((p)->sy_next->sy_previous = (p)->sy_previous)),\
                   1064: +      ((p)->sy_previous && ((p)->sy_previous->sy_next = (p)->sy_next)))
                   1065: + 
                   1066: + /* Set the chain symbols to null. */
                   1067: + #define DL_CLEAR(p)  \
                   1068: +     ((p)->sy_next = (symbolS*)0, (p)->sy_previous = (symbolS*)0)
                   1069: + 
                   1070: + /* Link symbol p after symbol w in the chain. */
                   1071: + #define DL_APPEND(p,w)       \
                   1072: +     (((w)->sy_next && ((w)->sy_next->sy_previous = (p))),    \
                   1073: +      ((p)->sy_next = (w)->sy_next),                          \
                   1074: +      ((w)->sy_next = (p)),                                   \
                   1075: +      ((p)->sy_previous = (w)))
                   1076: + 
                   1077: + /* Link symbol p before symbol w in the chain. */
                   1078: + #define DL_INSERT(p,w)       \
                   1079: +     (((w)->sy_previous && ((w)->sy_previous->sy_next = (p))),        \
                   1080: +      ((p)->sy_previous = (w)->sy_previous),                  \
                   1081: +      ((w)->sy_previous = (p)),                                       \
                   1082: +      ((p)->sy_next = (w)))
                   1083: + 
                   1084: + /* Symbol table macros and constants */
                   1085: + 
                   1086: + /* Possible and usefull section number in symbol table 
                   1087: +  * The values of TEXT, DATA and BSS may not be portable.
                   1088: +  */
                   1089: + 
                   1090: + #define C_TEXT_SECTION               1
                   1091: + #define C_DATA_SECTION               2
                   1092: + #define C_BSS_SECTION                3
                   1093: + #define C_ABS_SECTION                N_ABS
                   1094: + #define C_UNDEF_SECTION              N_UNDEF
                   1095: + #define C_DEBUG_SECTION              N_DEBUG
                   1096: + #define C_NTV_SECTION                N_TV
                   1097: + #define C_PTV_SECTION                P_TV
                   1098: + 
                   1099: + /*
                   1100: +  *  Macros to extract information from a symbol table entry.
                   1101: +  *  This syntaxic indirection allows independence regarding a.out or coff.
                   1102: +  *  The argument (s) of all these macros is a pointer to a symbol table entry.
                   1103: +  */
                   1104: + 
                   1105: + /* Predicates */
                   1106: + /* True if in text segment */
                   1107: + #define S_IS_TEXT(s)         ((s)->sy_scnum == C_TEXT_SECTION)
                   1108: + /* True if in data segment */
                   1109: + #define S_IS_DATA(s)         ((s)->sy_scnum == C_DATA_SECTION)
                   1110: + /* True if in bss segment */
                   1111: + #define S_IS_BSS(s)          ((s)->sy_scnum == C_BSS_SECTION)
                   1112: + /* True if in bss segment */
                   1113: + #define S_IS_ABS(s)          ((s)->sy_scnum == C_ABS_SECTION)
                   1114: + /* True if the symbol is external */
                   1115: + #define S_IS_EXTERNAL(s)        ((s)->sy_scnum == C_UNDEF_SECTION)
                   1116: + /* True if symbol has been defined, ie :
                   1117: +   section > 0 (DATA, TEXT or BSS)
                   1118: +   section == 0 and value > 0 (external bss symbol) */
                   1119: + #define S_IS_DEFINED(s)         ((s)->sy_scnum > C_UNDEF_SECTION || \
                   1120: +                               ((s)->sy_scnum == C_UNDEF_SECTION && \
                   1121: +                                (s)->sy_value > 0))
                   1122: + /* True if a debug special symbol entry */
                   1123: + #define S_IS_DEBUG(s)                ((s)->sy_scnum == C_DEGUG_SECTION)
                   1124: + /* True if a symbol is local symbol name */
                   1125: + /* A symbol name whose name begin with ^A is a gas internal pseudo symbol */
                   1126: + #define S_IS_LOCAL(s)                (S_GET_NAME(s)[0] == '\001' || \
                   1127: +                               (S_LOCAL_NAME(s) && !flagseen['L']))
                   1128: + /* True if a symbol is not defined in this file */
                   1129: + #define S_IS_EXTERN(s)               ((s)->sy_scnum == 0 && (s)->sy_value == 0)
                   1130: + /*
                   1131: +  * True if a symbol can be multiply defined (bss symbols have this def
                   1132: +  * though it is bad practice)
                   1133: +  */
                   1134: + #define S_IS_COMMON(s)               ((s)->sy_scnum == 0 && (s)->sy_value != 0)
                   1135: + /* True if a symbol name is in the string table, i.e. its length is > 8. */
                   1136: + #define S_IS_STRING(s)               (strlen(S_GET_NAME(s)) > 8 ? 1 : 0)
                   1137: + 
                   1138: + /* Accessors */
                   1139: + /* The name of the symbol */
                   1140: + #define S_GET_NAME(s)                ((char*)(s)->sy_offset)
                   1141: + /* The pointer to the string table */
                   1142: + #define S_GET_OFFSET(s)         ((s)->sy_offset)
                   1143: + /* The zeroes if symbol name is longer than 8 chars */
                   1144: + #define S_GET_ZEROES(s)              ((s)->sy_zeroes)
                   1145: + /* The value of the symbol */
                   1146: + #define S_GET_VALUE(s)               ((s)->sy_value)
                   1147: + /* The numeric value of the segment */
                   1148: + #define S_GET_SEGMENT(s)        ((s)->sy_scnum)
                   1149: + /* The data type */
                   1150: + #define S_GET_DATA_TYPE(s)   ((s)->sy_type)
                   1151: + /* The storage class */
                   1152: + #define S_GET_STORAGE_CLASS(s)       ((s)->sy_sclass)
                   1153: + /* The number of auxiliary entries */
                   1154: + #define S_GET_NUMBER_AUXILIARY(s)    ((s)->sy_numaux)
                   1155: + 
                   1156: + /* Modifiers */
                   1157: + /* Set the name of the symbol */
                   1158: + #define S_SET_NAME(s,v)              ((s)->sy_offset = (unsigned long)(v))
                   1159: + /* Set the offset of the symbol */
                   1160: + #define S_SET_OFFSET(s,v)    ((s)->sy_offset = (v))
                   1161: + /* The zeroes if symbol name is longer than 8 chars */
                   1162: + #define S_SET_ZEROES(s,v)            ((s)->sy_zeroes = (v))
                   1163: + /* Set the value of the symbol */
                   1164: + #define S_SET_VALUE(s,v)     ((s)->sy_value = (v))
                   1165: + /* The numeric value of the segment */
                   1166: + #define S_SET_SEGMENT(s,v)        ((s)->sy_scnum = (v))
                   1167: + /* The data type */
                   1168: + #define S_SET_DATA_TYPE(s,v) ((s)->sy_type = (v))
                   1169: + /* The storage class */
                   1170: + #define S_SET_STORAGE_CLASS(s,v)     ((s)->sy_sclass = (v))
                   1171: + /* The number of auxiliary entries */
                   1172: + #define S_SET_NUMBER_AUXILIARY(s,v)  ((s)->sy_numaux = (v))
                   1173: + 
                   1174: + /* Additional modifiers */
                   1175: + /* Assume that a symbol cannot be simultaneously in more than on segment */
                   1176: + /* Set the segment to text */
                   1177: + #define S_SET_TEXT(s)                ((s)->sy_scnum = C_TEXT_SECTION)
                   1178: + /* Set the segment to data */
                   1179: + #define S_SET_DATA(s)                ((s)->sy_scnum = C_DATA_SECTION)
                   1180: + /* Set the segment to bss */
                   1181: + #define S_SET_BSS(s)         ((s)->sy_scnum = C_BSS_SECTION)
                   1182: + /* Set the segment to abs */
                   1183: + #define S_SET_ABS(s)         ((s)->sy_scnum = C_ABS_SECTION)
                   1184: + /* The symbol is external (does not mean undefined) */
                   1185: + #define S_SET_EXTERNAL(s)       S_SET_STORAGE_CLASS(s,C_EXT)
                   1186: + 
                   1187: + /* Auxiliary entry macros. SA_ stands for symbol auxiliary */
                   1188: + /* Omit the tv related fields */
                   1189: + /* Accessors */
                   1190: + #define SA_GET_SYM_TAGNDX(s) ((s)->sy_auxent.x_sym.x_tagndx)
                   1191: + #define SA_GET_SYM_LNNO(s)   ((s)->sy_auxent.x_sym.x_misc.x_lnsz.x_lnno)
                   1192: + #define SA_GET_SYM_SIZE(s)   ((s)->sy_auxent.x_sym.x_misc.x_lnsz.x_size)
                   1193: + #define SA_GET_SYM_FSIZE(s)  ((s)->sy_auxent.x_sym.x_misc.x_fsize)
                   1194: + #define SA_GET_SYM_LNNOPTR(s)        ((s)->sy_auxent.x_sym.x_fcnary.x_fcn.x_lnnoptr)
                   1195: + #define SA_GET_SYM_ENDNDX(s) ((s)->sy_auxent.x_sym.x_fcnary.x_fcn.x_endndx)
                   1196: + #define SA_GET_SYM_DIMEN(s,i)        ((s)->sy_auxent.x_sym.x_fcnary.x_ary.x_dimen[(i)])
                   1197: + #define SA_GET_FILE_FNAME(s) ((s)->sy_auxent.x_file.x_fname)
                   1198: + #define SA_GET_SCN_SCNLEN(s) ((s)->sy_auxent.x_scn.x_scnlen)
                   1199: + #define SA_GET_SCN_NRELOC(s) ((s)->sy_auxent.x_scn.x_nreloc)
                   1200: + #define SA_GET_SCN_NLINNO(s) ((s)->sy_auxent.x_scn.x_nlinno)
                   1201: + 
                   1202: + /* Modifiers */
                   1203: + #define SA_SET_SYM_TAGNDX(s,v)       ((s)->sy_auxent.x_sym.x_tagndx=(v))
                   1204: + #define SA_SET_SYM_LNNO(s,v) ((s)->sy_auxent.x_sym.x_misc.x_lnsz.x_lnno=(v))
                   1205: + #define SA_SET_SYM_SIZE(s,v) ((s)->sy_auxent.x_sym.x_misc.x_lnsz.x_size=(v))
                   1206: + #define SA_SET_SYM_FSIZE(s,v)        ((s)->sy_auxent.x_sym.x_misc.x_fsize=(v))
                   1207: + #define SA_SET_SYM_LNNOPTR(s,v)      ((s)->sy_auxent.x_sym.x_fcnary.x_fcn.x_lnnoptr=(v))
                   1208: + #define SA_SET_SYM_ENDNDX(s,v)       ((s)->sy_auxent.x_sym.x_fcnary.x_fcn.x_endndx=(v))
                   1209: + #define SA_SET_SYM_DIMEN(s,i,v)      ((s)->sy_auxent.x_sym.x_fcnary.x_ary.x_dimen[(i)]=(v))
                   1210: + #define SA_SET_FILE_FNAME(s,v)       strncpy((s)->sy_auxent.x_file.x_fname,(v),FILNMLEN)
                   1211: + #define SA_SET_SCN_SCNLEN(s,v)       ((s)->sy_auxent.x_scn.x_scnlen=(v))
                   1212: + #define SA_SET_SCN_NRELOC(s,v)       ((s)->sy_auxent.x_scn.x_nreloc=(v))
                   1213: + #define SA_SET_SCN_NLINNO(s,v)       ((s)->sy_auxent.x_scn.x_nlinno=(v))
                   1214: + 
                   1215: + /* Internal use only definitions. SF_ stands for symbol flags. */
                   1216: + 
                   1217: + /* These values can be assigned to sy_flags field of a symbolS */
                   1218: + /* The first 16 bits are general purpose. The last 16 bits are debug info */
                   1219: + 
                   1220: + #define SF_STATICS           0x00000001 /* Mark the .text & all symbols */
                   1221: + #define SF_DEFINED           0x00000002 /* Symbol is defined in this file */
                   1222: + #define SF_STRING            0x00000004 /* Symbol name length > 8 */
                   1223: + #define SF_LOCAL             0x00000008 /* Symbol must not be emitted */
                   1224: + 
                   1225: + #define SF_FUNCTION          0x00010000 /* The symbol is a function */
                   1226: + #define SF_PROCESS           0x00020000 /* Process symbol before write */
                   1227: + #define SF_TAGGED            0x00040000 /* Is associated with a tag */
                   1228: + #define SF_TAG                       0x00080000 /* Is a tag */
                   1229: + #define SF_DEBUG             0x00100000 /* Is in debug or abs section */
                   1230: + #define SF_GET_SEGMENT               0x00200000 /* Get the section of the forward
                   1231: +                                            symbol. */
                   1232: + 
                   1233: + /* Masks */
                   1234: + #define SF_NORMAL_MASK               0x0000ffff /* Non debug information */
                   1235: + #define SF_DEBUG_MASK                0xffff0000 /* Debug information */
                   1236: + 
                   1237: + /* Accessors */
                   1238: + #define SF_GET(s)            ((s)->sy_flags)
                   1239: + #define SF_GET_NORMAL_FIELD(s)       ((s)->sy_flags & SF_NORMAL_MASK)
                   1240: + #define SF_GET_DEBUG_FIELD(s)        ((s)->sy_flags & SF_DEBUG_MASK)
                   1241: + #define SF_GET_FILE(s)               ((s)->sy_flags & SF_FILE)
                   1242: + #define SF_GET_STATICS(s)    ((s)->sy_flags & SF_STATICS)
                   1243: + #define SF_GET_DEFINED(s)    ((s)->sy_flags & SF_DEFINED)
                   1244: + #define SF_GET_STRING(s)     ((s)->sy_flags & SF_STRING)
                   1245: + #define SF_GET_LOCAL(s)              ((s)->sy_flags & SF_LOCAL)
                   1246: + #define SF_GET_FUNCTION(s)      ((s)->sy_flags & SF_FUNCTION)
                   1247: + #define SF_GET_PROCESS(s)    ((s)->sy_flags & SF_PROCESS)
                   1248: + #define SF_GET_DEBUG(s)              ((s)->sy_flags & SF_DEBUG)
                   1249: + #define SF_GET_TAGGED(s)     ((s)->sy_flags & SF_TAGGED)
                   1250: + #define SF_GET_TAG(s)                ((s)->sy_flags & SF_TAG)
                   1251: + #define SF_GET_GET_SEGMENT(s)        ((s)->sy_flags & SF_GET_SEGMENT)
                   1252: + 
                   1253: + /* Modifiers */
                   1254: + #define SF_SET(s,v)          ((s)->sy_flags = (v))
                   1255: + #define SF_SET_NORMAL_FIELD(s,v)((s)->sy_flags |= ((v) & SF_NORMAL_MASK))
                   1256: + #define SF_SET_DEBUG_FIELD(s,v)      ((s)->sy_flags |= ((v) & SF_DEBUG_MASK))
                   1257: + #define SF_SET_FILE(s)               ((s)->sy_flags |= SF_FILE)
                   1258: + #define SF_SET_STATICS(s)    ((s)->sy_flags |= SF_STATICS)
                   1259: + #define SF_SET_DEFINED(s)    ((s)->sy_flags |= SF_DEFINED)
                   1260: + #define SF_SET_STRING(s)     ((s)->sy_flags |= SF_STRING)
                   1261: + #define SF_SET_LOCAL(s)              ((s)->sy_flags |= SF_LOCAL)
                   1262: + #define SF_SET_FUNCTION(s)      ((s)->sy_flags |= SF_FUNCTION)
                   1263: + #define SF_SET_PROCESS(s)    ((s)->sy_flags |= SF_PROCESS)
                   1264: + #define SF_SET_DEBUG(s)              ((s)->sy_flags |= SF_DEBUG)
                   1265: + #define SF_SET_TAGGED(s)     ((s)->sy_flags |= SF_TAGGED)
                   1266: + #define SF_SET_TAG(s)                ((s)->sy_flags |= SF_TAG)
                   1267: + #define SF_SET_GET_SEGMENT(s)        ((s)->sy_flags |= SF_GET_SEGMENT)
                   1268: + 
                   1269: + /* File header macro and type definition */
                   1270: + 
                   1271: + /*
                   1272: +  * File position calculators. Beware to use them when all the
                   1273: +  * appropriate fields are set in the header.
                   1274: +  */
                   1275: + 
                   1276: + #define H_GET_FILE_SIZE(h) \
                   1277: +     (long)(FILHSZ + AOUTHDRSZ + \
                   1278: +         H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ + \
                   1279: +         H_GET_TEXT_SIZE(h) + H_GET_DATA_SIZE(h) + \
                   1280: +         H_GET_RELOCATION_SIZE(h) + H_GET_LINENO_SIZE(h) + \
                   1281: +         H_GET_SYMBOL_TABLE_SIZE(h) * SYMESZ + \
                   1282: +         (h)->string_table_size)
                   1283: + #define H_GET_TEXT_FILE_OFFSET(h) \
                   1284: +     (long)(FILHSZ + AOUTHDRSZ + \
                   1285: +         H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ)
                   1286: + #define H_GET_DATA_FILE_OFFSET(h) \
                   1287: +     (long)(FILHSZ + AOUTHDRSZ + \
                   1288: +         H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ + \
                   1289: +         H_GET_TEXT_SIZE(h))
                   1290: + #define H_GET_BSS_FILE_OFFSET(h) 0
                   1291: + #define H_GET_RELOCATION_FILE_OFFSET(h) \
                   1292: +     (long)(FILHSZ + AOUTHDRSZ + \
                   1293: +         H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ + \
                   1294: +         H_GET_TEXT_SIZE(h) + H_GET_DATA_SIZE(h))
                   1295: + #define H_GET_LINENO_FILE_OFFSET(h) \
                   1296: +     (long)(FILHSZ + AOUTHDRSZ + \
                   1297: +         H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ + \
                   1298: +         H_GET_TEXT_SIZE(h) + H_GET_DATA_SIZE(h) + \
                   1299: +         H_GET_RELOCATION_SIZE(h))
                   1300: + #define H_GET_SYMBOL_TABLE_FILE_OFFSET(h) \
                   1301: +     (long)(FILHSZ + AOUTHDRSZ + \
                   1302: +         H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ + \
                   1303: +         H_GET_TEXT_SIZE(h) + H_GET_DATA_SIZE(h) + \
                   1304: +         H_GET_RELOCATION_SIZE(h) + H_GET_LINENO_SIZE(h))
                   1305: + 
                   1306: + /* Accessors */
                   1307: + /* aouthdr */
                   1308: + #define H_GET_MAGIC_NUMBER(h)           ((h)->aouthdr.magic)
                   1309: + #define H_GET_VERSION_STAMP(h)               ((h)->aouthdr.vstamp)
                   1310: + #define H_GET_TEXT_SIZE(h)              ((h)->aouthdr.tsize)
                   1311: + #define H_GET_DATA_SIZE(h)              ((h)->aouthdr.dsize)
                   1312: + #define H_GET_BSS_SIZE(h)               ((h)->aouthdr.bsize)
                   1313: + #define H_GET_ENTRY_POINT(h)            ((h)->aouthdr.entry)
                   1314: + #define H_GET_TEXT_START(h)          ((h)->aouthdr.text_start)
                   1315: + #define H_GET_DATA_START(h)          ((h)->aouthdr.data_start)
                   1316: + /* filehdr */
                   1317: + #define H_GET_FILE_MAGIC_NUMBER(h)   ((h)->filehdr.f_magic)
                   1318: + #define H_GET_NUMBER_OF_SECTIONS(h)  ((h)->filehdr.f_nscns)
                   1319: + #define H_GET_TIME_STAMP(h)          ((h)->filehdr.f_timdat)
                   1320: + #define H_GET_SYMBOL_TABLE_POINTER(h)        ((h)->filehdr.f_symptr)
                   1321: + #define H_GET_SYMBOL_TABLE_SIZE(h)   ((h)->filehdr.f_nsyms)
                   1322: + #define H_GET_SIZEOF_OPTIONAL_HEADER(h)      ((h)->filehdr.f_opthdr)
                   1323: + #define H_GET_FLAGS(h)                       ((h)->filehdr.f_flags)
                   1324: + /* Extra fields to achieve bsd a.out compatibility and for convinience */
                   1325: + #define H_GET_RELOCATION_SIZE(h)     ((h)->relocation_size)
                   1326: + #define H_GET_STRING_SIZE(h)            ((h)->string_table_size)
                   1327: + #define H_GET_LINENO_SIZE(h)            ((h)->lineno_size)
                   1328: + 
                   1329: + /* Modifiers */
                   1330: + /* aouthdr */
                   1331: + #define H_SET_MAGIC_NUMBER(h,v)         ((h)->aouthdr.magic = (v))
                   1332: + #define H_SET_VERSION_STAMP(h,v)     ((h)->aouthdr.vstamp = (v))
                   1333: + #define H_SET_TEXT_SIZE(h,v)            ((h)->aouthdr.tsize = (v))
                   1334: + #define H_SET_DATA_SIZE(h,v)            ((h)->aouthdr.dsize = (v))
                   1335: + #define H_SET_BSS_SIZE(h,v)             ((h)->aouthdr.bsize = (v))
                   1336: + #define H_SET_ENTRY_POINT(h,v)          ((h)->aouthdr.entry = (v))
                   1337: + #define H_SET_TEXT_START(h,v)                ((h)->aouthdr.text_start = (v))
                   1338: + #define H_SET_DATA_START(h,v)                ((h)->aouthdr.data_start = (v))
                   1339: + /* filehdr */
                   1340: + #define H_SET_FILE_MAGIC_NUMBER(h,v) ((h)->filehdr.f_magic = (v))
                   1341: + #define H_SET_NUMBER_OF_SECTIONS(h,v)        ((h)->filehdr.f_nscns = (v))
                   1342: + #define H_SET_TIME_STAMP(h,v)                ((h)->filehdr.f_timdat = (v))
                   1343: + #define H_SET_SYMBOL_TABLE_POINTER(h,v)      ((h)->filehdr.f_symptr = (v))
                   1344: + #define H_SET_SYMBOL_TABLE_SIZE(h,v)    ((h)->filehdr.f_nsyms = (v))
                   1345: + #define H_SET_SIZEOF_OPTIONAL_HEADER(h,v) ((h)->filehdr.f_opthdr = (v))
                   1346: + #define H_SET_FLAGS(h,v)             ((h)->filehdr.f_flags = (v))
                   1347: + /* Extra fields to achieve bsd a.out compatibility and for convinience */
                   1348: + #define H_SET_RELOCATION_SIZE(h,t,d)         ((h)->relocation_size = (t)+(d))
                   1349: + #define H_SET_STRING_SIZE(h,v)          ((h)->string_table_size = (v))
                   1350: + #define H_SET_LINENO_SIZE(h,v)          ((h)->lineno_size = (v))
                   1351: + 
                   1352: + /* Output the file(s) header(s) in a character array */
                   1353: + #define H_OUTPUT(h,where) c_header_append(&(h)->aouthdr, &(h)->filehdr,(where))
                   1354: + 
                   1355: + /* Output a symbol entry */
                   1356: + #define SYMBOL_OUTPUT(s,w)   c_symbol_append((s), (w))
                   1357: + 
                   1358: + typedef struct {
                   1359: +     AOUTHDR     aouthdr;             /* a.out header */
                   1360: +     FILHDR      filehdr;             /* File header, not machine dep. */
                   1361: +     long int       string_table_size;   /* names + '\0' + sizeof(int) */
                   1362: +     long int    relocation_size;     /* Cumulated size of relocation
                   1363: +                                         information for all sections in
                   1364: +                                         bytes. */
                   1365: +     long int    lineno_size;         /* Size of the line number information
                   1366: +                                         table in bytes */
                   1367: + } object_headers;
                   1368: + 
                   1369: + /* Format independent interface functions */
                   1370: + extern void             emit_relocations();
                   1371: + extern void          emit_symbols();
                   1372: + extern void          c_symbol_merge();
                   1373: + extern void             c_header_append();
                   1374: + extern void             c_symbol_append();
                   1375: + extern void          c_section_header_append();
                   1376: + extern char*         c_section_symbol();
                   1377: + extern void          c_section_header();
                   1378: + 
                   1379: + /* --------------  Line number handling ------- */
                   1380: + extern int           text_lineno_number;
                   1381: + 
                   1382: + typedef struct internal_lineno {
                   1383: +     LINENO line;                     /* The lineno structure itself */
                   1384: +     char* frag;                              /* Frag the line number is related to*/
                   1385: +     struct internal_lineno* next;    /* Forward chain pointer */
                   1386: + } lineno;
                   1387: + 
                   1388: + extern lineno* c_new_file();
                   1389: + extern void    emit_lineno();
                   1390: + extern lineno* lineno_rootP;
                   1391: + extern lineno* lineno_lastP;
                   1392: + #endif /* COFF_H */
                   1393: + 
                   1394: + 
                   1395: *** /dev/null  Wed Nov  7 08:15:02 1990
                   1396: --- config.gas Wed Nov  7 07:33:29 1990
                   1397: ***************
                   1398: *** 0 ****
                   1399: --- 1,70 ----
                   1400: + # Set the appropriate links for machine dependent files
                   1401: +  
                   1402: + # Chose one of
                   1403: + #
                   1404: + # i386                               for 386 box running SCO unix (ODT),
                   1405: + #                                                Esix rev C
                   1406: + #                                                Ix 2.02
                   1407: + #                                                CTIX 3.2
                   1408: + #
                   1409: + # sun-3                              for sun3 running SunOs 3.5
                   1410: + #                                             SunOs 4.0.3
                   1411: + #                                    
                   1412: + # motorola-3600-unisoft-1.3  for Motorola 3600 running Unisoft 1.3 (V.3.2)
                   1413: + # microlec-2030-lectra-1     for Microlec 2030 running Lectra 1.1
                   1414: + 
                   1415: + case $1 in
                   1416: +      default)
                   1417: +              cp /dev/null dependencies
                   1418: +              ln aout.h oformat.h
                   1419: +              exit
                   1420: +      ;;
                   1421: +      sun-3)
                   1422: +              [ -f m68k.h ] && rm -f m68k.h
                   1423: +              ln m-sun3.h m68k.h
                   1424: +              machine_file=m68k.c
                   1425: +              atof_file=atof-ieee.c
                   1426: +              machine_header=m-sun3.h
                   1427: +              opcode_header=m68k-opcode.h
                   1428: +              object_format=aout
                   1429: +      ;;
                   1430: +      motorola-3600-unisoft-1.3|microlec-2030-lectra-1.1)
                   1431: +              [ -f m68k.h ] && rm -f m68k.h
                   1432: +              ln m-sun3.h m68k.h
                   1433: +              machine_file=m68k.c
                   1434: +              atof_file=atof-ieee.c
                   1435: +              machine_header=m-motor.h
                   1436: +              opcode_header=m68k-opcode.h
                   1437: +              object_format=coff
                   1438: +      ;;
                   1439: +      dpx2)
                   1440: +                 [ -f m68k.h ] && rm -f m68k.h
                   1441: +                 ln m-sun3.h m68k.h
                   1442: +                 machine_file=m68k.c
                   1443: +                 atof_file=atof-ieee.c
                   1444: +                 machine_header=m-dpx2.h
                   1445: +                 opcode_header=m68k-opcode.h
                   1446: +                 object_format=coff
                   1447: +      ;;
                   1448: +      i386)
                   1449: +              [ -f m68k.h ] && rm -f m68k.h
                   1450: +              machine_file=i386.c
                   1451: +              atof_file=atof-ieee.c
                   1452: +              machine_header=m-i386.h
                   1453: +              opcode_header=i386-opcode.h
                   1454: +              object_format=coff
                   1455: +      ;;
                   1456: +      *)
                   1457: +              echo $1 not a known configuration
                   1458: +              exit 1
                   1459: +      ;;
                   1460: + esac
                   1461: + 
                   1462: + rm -f machine.c atof.c machine.h oformat.h oformat.c opcode.h
                   1463: + set -x
                   1464: + ln $machine_file machine.c
                   1465: + ln $atof_file atof.c
                   1466: + ln $machine_header machine.h
                   1467: + ln ${object_format}.c oformat.c
                   1468: + ln ${object_format}.h oformat.h
                   1469: + ln ${opcode_header} opcode.h
                   1470: *** /dev/null  Wed Nov  7 08:15:02 1990
                   1471: --- m-dpx2.h   Wed Nov  7 07:33:29 1990
                   1472: ***************
                   1473: *** 0 ****
                   1474: --- 1,14 ----
                   1475: + /* Machine specific defines for the dpx2 machine */
                   1476: + #define dpx2
                   1477: + #define PROCESSOR_68000
                   1478: + 
                   1479: + /* Return true if s (a non null string pointer), points to a local variable
                   1480: +    name. */
                   1481: + #define S_LOCAL_NAME(s)  (S_GET_NAME(s)[0] == 'L')
                   1482: + 
                   1483: + /* Preserve leading underscore in symbol names. */
                   1484: + #define STRIP_UNDERSCORE 0
                   1485: + 
                   1486: + /* The magic number is not the usual MC68MAGIC. */
                   1487: + #define FILE_HEADER_MAGIC       MC68KBCSMAGIC
                   1488: + 
                   1489: *** /dev/null  Wed Nov  7 08:15:02 1990
                   1490: --- m-i386.h   Wed Nov  7 07:33:30 1990
                   1491: ***************
                   1492: *** 0 ****
                   1493: --- 1,10 ----
                   1494: + /* Machine specific defines for the SCO Unix V.3.2 ODT */
                   1495: + #define scounix
                   1496: + #define PROCESSOR_i386
                   1497: + 
                   1498: + /* Return true if s (a non null string pointer), points to a local variable
                   1499: +    name. */
                   1500: + #define S_LOCAL_NAME(s)  (S_GET_NAME(s)[0] == '.' && S_GET_NAME(s)[1] == 'L')
                   1501: + 
                   1502: + /* Compiler does not generate symbol names with a leading underscore. */
                   1503: + #define STRIP_UNDERSCORE 0
                   1504: *** /dev/null  Wed Nov  7 08:15:02 1990
                   1505: --- m-motor.h  Wed Nov  7 07:33:30 1990
                   1506: ***************
                   1507: *** 0 ****
                   1508: --- 1,10 ----
                   1509: + /* Machine specific defines for the unisoft 680x0 V.3.2 version 1.3 */
                   1510: + #define unisoft
                   1511: + #define PROCESSOR_68000
                   1512: + 
                   1513: + /* Return true if s (a non null string pointer), points to a local variable
                   1514: +    name. */
                   1515: + #define S_LOCAL_NAME(s)  (S_GET_NAME(s)[0] == 'L')
                   1516: + 
                   1517: + /* Remove leading underscore from the gcc generated symbol names */
                   1518: + #define STRIP_UNDERSCORE 1
                   1519: *** /dev/null  Wed Nov  7 08:15:02 1990
                   1520: --- stack.c    Wed Nov  7 07:33:31 1990
                   1521: ***************
                   1522: *** 0 ****
                   1523: --- 1,59 ----
                   1524: + #include "stack.h"
                   1525: + 
                   1526: + extern char* malloc();
                   1527: + extern char* realloc();
                   1528: + 
                   1529: + stack* stack_init(chunk_size, element_size)
                   1530: + unsigned long chunk_size;
                   1531: + unsigned long element_size;
                   1532: + {
                   1533: +     stack* st;
                   1534: +     if((st = (stack*)malloc(sizeof(stack))) == (stack*)0)
                   1535: +      return (stack*)0;
                   1536: +     if((st->data = malloc(chunk_size)) == (char*)0) {
                   1537: +      free(st);
                   1538: +      return (stack*)0;
                   1539: +     }
                   1540: +     st->pointer = 0;
                   1541: +     st->size = chunk_size;
                   1542: +     st->chunk_size = chunk_size;
                   1543: +     st->element_size = element_size;
                   1544: +     return st;
                   1545: + }
                   1546: + 
                   1547: + void stack_delete(st)
                   1548: + stack* st;
                   1549: + {
                   1550: +     free(st->data);
                   1551: +     free(st);
                   1552: + }
                   1553: + 
                   1554: + char* stack_push(st, element)
                   1555: + stack* st;
                   1556: + char* element;
                   1557: + {
                   1558: +     if(st->pointer + st->element_size >= st->size) {
                   1559: +      st->size += st->chunk_size;
                   1560: +      if((st->data = realloc(st->data, st->size)) == (char*)0)
                   1561: +          return (char*)0;
                   1562: +     }
                   1563: +     memcpy(st->data + st->pointer, element, st->element_size);
                   1564: +     st->pointer += st->element_size;
                   1565: +     return st->data + st->pointer;
                   1566: + }
                   1567: + 
                   1568: + char* stack_pop(st)
                   1569: + stack* st;
                   1570: + {
                   1571: +     if((st->pointer -= st->element_size) < 0) {
                   1572: +      st->pointer = 0;
                   1573: +      return (char*)0;
                   1574: +     }
                   1575: +     return st->data + st->pointer;
                   1576: + }
                   1577: + 
                   1578: + char* stack_top(st)
                   1579: + stack* st;
                   1580: + {
                   1581: +     return st->data + st->pointer - st->element_size;
                   1582: + }
                   1583: *** /dev/null  Wed Nov  7 08:15:02 1990
                   1584: --- stack.h    Wed Nov  7 07:33:31 1990
                   1585: ***************
                   1586: *** 0 ****
                   1587: --- 1,13 ----
                   1588: + typedef struct {
                   1589: +     unsigned long chunk_size;
                   1590: +     unsigned long element_size;
                   1591: +     unsigned long size;
                   1592: +     char*      data;
                   1593: +     unsigned long pointer;
                   1594: + } stack;
                   1595: + 
                   1596: + extern stack* stack_init();
                   1597: + extern void stack_delete();
                   1598: + extern char* stack_push();
                   1599: + extern char* stack_pop();
                   1600: + extern char* stack_top();
                   1601: *** /lasvegas/spare/usenet/work/gas-1.37.genuine/./as.c        Thu Oct 11 18:26:17 1990
                   1602: --- ./as.c     Wed Nov  7 07:33:32 1990
                   1603: ***************
                   1604: *** 38,43 ****
                   1605: --- 38,44 ----
                   1606:   #include <signal.h>
                   1607:   
                   1608:   #define COMMON
                   1609: + #include "oformat.h"
                   1610:   #include "as.h"
                   1611:   #include "struc-symbol.h"
                   1612:   #include "write.h"
                   1613: *** /lasvegas/spare/usenet/work/gas-1.37.genuine/./as.h        Thu Oct 11 18:26:18 1990
                   1614: --- ./as.h     Wed Nov  7 07:33:33 1990
                   1615: ***************
                   1616: *** 162,170 ****
                   1617:                                /* Invented so we don't crash printing */
                   1618:                                /* error message involving weird segment. */
                   1619:        SEG_BIG,                        /* Bigger than 32 bits constant. */
                   1620: !      SEG_DIFFERENCE          /* Mythical Segment: absolute difference. */
                   1621:   }            segT;
                   1622:   #define SEG_MAXIMUM_ORDINAL (SEG_DIFFERENCE)
                   1623:   
                   1624:   typedef unsigned char        subsegT;
                   1625:   
                   1626: --- 162,179 ----
                   1627:                                /* Invented so we don't crash printing */
                   1628:                                /* error message involving weird segment. */
                   1629:        SEG_BIG,                        /* Bigger than 32 bits constant. */
                   1630: !      SEG_DIFFERENCE,         /* Mythical Segment: absolute difference. */
                   1631: ! #ifdef coff
                   1632: !      SEG_DEBUG,              /* Debug segment */
                   1633: !      SEG_NTV,                /* Transfert vector preload segment */
                   1634: !      SEG_PTV,                /* Transfert vector postload segment */
                   1635: ! #endif /* coff */
                   1636:   }            segT;
                   1637: + #ifdef coff
                   1638: + #define SEG_MAXIMUM_ORDINAL (SEG_PTV)
                   1639: + #else /* coff */
                   1640:   #define SEG_MAXIMUM_ORDINAL (SEG_DIFFERENCE)
                   1641: + #endif /* coff */
                   1642:   
                   1643:   typedef unsigned char        subsegT;
                   1644:   
                   1645: ***************
                   1646: *** 180,185 ****
                   1647: --- 189,211 ----
                   1648:   extern char *const seg_name[];
                   1649:   extern const int   seg_N_TYPE[];
                   1650:   extern const segT  N_TYPE_seg[];
                   1651: + #ifdef coff
                   1652: + #define              segment_name(v) (seg_name[(v)])
                   1653: + /* Machine independent -> machine dependent */
                   1654: + #define              seg_SEG(v)      (seg_N_TYPE[(v)])
                   1655: + /*
                   1656: +  * +4 shift the value of the mnemonics from -4, -3, -2, -1, 0, 1, 2, 3
                   1657: +  * to 0, 1, 2, 3, 4, 5, 6, 7
                   1658: +  */
                   1659: + /* Machine dependent -> machine independent */
                   1660: + #define              SEG_seg(v)      (N_TYPE_seg[(v) + 4])
                   1661: + #else /* coff */
                   1662: + #define              segment_name(v) (seg_name[(v)])
                   1663: + /* Machine independent -> machine dependent */
                   1664: + #define              seg_SEG(v)      (seg_N_TYPE[(v)])
                   1665: + /* Machine dependent -> machine independent */
                   1666: + #define              SEG_seg(v)      (N_TYPE_seg[(v)])
                   1667: + #endif /* coff */
                   1668:   void subsegs_begin();
                   1669:   void subseg_change();
                   1670:   void subseg_new();
                   1671: *** /lasvegas/spare/usenet/work/gas-1.37.genuine/./expr.c      Thu Oct 11 18:26:21 1990
                   1672: --- ./expr.c   Wed Nov  7 07:33:36 1990
                   1673: ***************
                   1674: *** 25,30 ****
                   1675: --- 25,31 ----
                   1676:    */
                   1677:   
                   1678:   #include <ctype.h>
                   1679: + #include "oformat.h"
                   1680:   #include "as.h"
                   1681:   #include "flonum.h"
                   1682:   #include "read.h"
                   1683: ***************
                   1684: *** 84,90 ****
                   1685:   {
                   1686:     register char              c;
                   1687:     register char *name;       /* points to name of symbol */
                   1688: !   register struct symbol *   symbolP; /* Points to symbol */
                   1689:   
                   1690:     extern  char hex_value[];  /* In hex_value.c */
                   1691:     char       *local_label_name();
                   1692: --- 85,91 ----
                   1693:   {
                   1694:     register char              c;
                   1695:     register char *name;       /* points to name of symbol */
                   1696: !   register symbolS * symbolP; /* Points to symbol */
                   1697:   
                   1698:     extern  char hex_value[];  /* In hex_value.c */
                   1699:     char       *local_label_name();
                   1700: ***************
                   1701: *** 250,264 ****
                   1702:                       */
                   1703:                      name = local_label_name ((int)number, 0);
                   1704:                      if ( (symbolP = symbol_table_lookup(name)) /* seen before */
                   1705: !                        && (symbolP -> sy_type & N_TYPE) != N_UNDF /* symbol is defined: OK */
                   1706: !                        )
                   1707:                        {               /* Expected path: symbol defined. */
                   1708:                          /* Local labels are never absolute. Don't waste time checking absoluteness. */
                   1709: !                        know(   (symbolP -> sy_type & N_TYPE) == N_DATA
                   1710: !                             || (symbolP -> sy_type & N_TYPE) == N_TEXT );
                   1711:                          expressionP -> X_add_symbol = symbolP;
                   1712:                          expressionP -> X_add_number = 0;
                   1713: !                        expressionP -> X_seg        = N_TYPE_seg [symbolP -> sy_type];
                   1714:                        }
                   1715:                      else
                   1716:                        {               /* Either not seen or not defined. */
                   1717: --- 251,263 ----
                   1718:                       */
                   1719:                      name = local_label_name ((int)number, 0);
                   1720:                      if ( (symbolP = symbol_table_lookup(name)) /* seen before */
                   1721: !                        && (S_IS_DEFINED(symbolP)))
                   1722:                        {               /* Expected path: symbol defined. */
                   1723:                          /* Local labels are never absolute. Don't waste time checking absoluteness. */
                   1724: !                        know((S_IS_DATA(symbolP)) || S_IS_TEXT(symbolP));
                   1725:                          expressionP -> X_add_symbol = symbolP;
                   1726:                          expressionP -> X_add_number = 0;
                   1727: !                        expressionP -> X_seg = SEG_seg(S_GET_SEGMENT(symbolP));
                   1728:                        }
                   1729:                      else
                   1730:                        {               /* Either not seen or not defined. */
                   1731: ***************
                   1732: *** 289,301 ****
                   1733:                          if ( symbolP = symbol_table_lookup( name ))
                   1734:                            {
                   1735:                              /* We have no need to check symbol properties. */
                   1736: !                            know(   (symbolP -> sy_type & N_TYPE) == N_UNDF
                   1737: !                                 || (symbolP -> sy_type & N_TYPE) == N_DATA
                   1738: !                                 || (symbolP -> sy_type & N_TYPE) == N_TEXT);
                   1739:                            }
                   1740:                          else
                   1741:                            {
                   1742: !                            symbolP = symbol_new (name, N_UNDF, 0,0,0, & zero_address_frag);
                   1743:                              symbol_table_insert (symbolP);
                   1744:                            }
                   1745:                          expressionP -> X_add_symbol      = symbolP;
                   1746: --- 288,306 ----
                   1747:                          if ( symbolP = symbol_table_lookup( name ))
                   1748:                            {
                   1749:                              /* We have no need to check symbol properties. */
                   1750: !                            know(!S_IS_DEFINED(symbolP) ||
                   1751: !                                 S_IS_DATA(symbolP) || S_IS_TEXT(symbolP));
                   1752:                            }
                   1753:                          else
                   1754:                            {
                   1755: ! #ifdef coff
                   1756: !                              symbolP = symbol_new(name, SEG_UNKNOWN,
                   1757: !                                                   0, 0,
                   1758: !                                                   &zero_address_frag);
                   1759: ! #else /* coff */
                   1760: !                            symbolP = symbol_new (name, N_UNDF, 0,0,0, 
                   1761: !                                                  & zero_address_frag);
                   1762: ! #endif /* coff */
                   1763:                              symbol_table_insert (symbolP);
                   1764:                            }
                   1765:                          expressionP -> X_add_symbol      = symbolP;
                   1766: ***************
                   1767: *** 358,369 ****
                   1768:          JF:  '.' is pseudo symbol with value of current location in current
                   1769:          segment. . .
                   1770:        */
                   1771:       symbolP = symbol_new("L0\001",
                   1772: !                       (unsigned char)(seg_N_TYPE[(int)now_seg]),
                   1773:                         0,
                   1774:                         0,
                   1775:                         (valueT)(obstack_next_free(&frags)-frag_now->fr_literal),
                   1776:                         frag_now);
                   1777:       expressionP->X_add_number=0;
                   1778:       expressionP->X_add_symbol=symbolP;
                   1779:       expressionP->X_seg = now_seg;
                   1780: --- 363,379 ----
                   1781:          JF:  '.' is pseudo symbol with value of current location in current
                   1782:          segment. . .
                   1783:        */
                   1784: + #ifdef coff
                   1785: +     symbolP = symbol_new("L0\001", now_seg, (valueT)(obstack_next_free(&frags)-
                   1786: +                               frag_now->fr_literal), 0, frag_now);
                   1787: + #else /* coff */
                   1788:       symbolP = symbol_new("L0\001",
                   1789: !                       (unsigned char)(seg_SEG((int)now_seg)),
                   1790:                         0,
                   1791:                         0,
                   1792:                         (valueT)(obstack_next_free(&frags)-frag_now->fr_literal),
                   1793:                         frag_now);
                   1794: + #endif /* coff */
                   1795:       expressionP->X_add_number=0;
                   1796:       expressionP->X_add_symbol=symbolP;
                   1797:       expressionP->X_seg = now_seg;
                   1798: ***************
                   1799: *** 384,390 ****
                   1800:              */
                   1801:             register segT      seg;
                   1802:   
                   1803: !           seg = N_TYPE_seg [(int) symbolP -> sy_type & N_TYPE];
                   1804:             if ((expressionP -> X_seg = seg) == SEG_ABSOLUTE )
                   1805:            {
                   1806:              expressionP -> X_add_number = symbolP -> sy_value;
                   1807: --- 394,400 ----
                   1808:              */
                   1809:             register segT      seg;
                   1810:   
                   1811: !           seg = SEG_seg((int)S_GET_SEGMENT(symbolP));
                   1812:             if ((expressionP -> X_seg = seg) == SEG_ABSOLUTE )
                   1813:            {
                   1814:              expressionP -> X_add_number = symbolP -> sy_value;
                   1815: ***************
                   1816: *** 399,405 ****
                   1817: --- 409,419 ----
                   1818:        {
                   1819:          expressionP -> X_add_symbol
                   1820:                = symbolP
                   1821: + #ifdef coff
                   1822: +              = symbol_new (name, SEG_UNKNOWN, 0, 0, &zero_address_frag);
                   1823: + #else /* coff */
                   1824:                = symbol_new (name, N_UNDF, 0,0,0, & zero_address_frag);
                   1825: + #endif /* coff */
                   1826:   
                   1827:          expressionP -> X_add_number  = 0;
                   1828:          expressionP -> X_seg         = SEG_UNKNOWN;
                   1829: ***************
                   1830: *** 554,579 ****
                   1831:   
                   1832:   static segT
                   1833:   expr_part (symbol_1_PP, symbol_2_P)
                   1834: !      struct symbol **        symbol_1_PP;
                   1835: !      struct symbol * symbol_2_P;
                   1836:   {
                   1837:     segT                       return_value;
                   1838:   
                   1839:     know(    (* symbol_1_PP)                           == NULL
                   1840: !        || ((* symbol_1_PP) -> sy_type & N_TYPE) == N_TEXT
                   1841: !        || ((* symbol_1_PP) -> sy_type & N_TYPE) == N_DATA
                   1842: !        || ((* symbol_1_PP) -> sy_type & N_TYPE) == N_BSS
                   1843: !        || ((* symbol_1_PP) -> sy_type & N_TYPE) == N_UNDF
                   1844:          );
                   1845:     know(      symbol_2_P             == NULL
                   1846: !        ||    (symbol_2_P   -> sy_type & N_TYPE) == N_TEXT
                   1847: !        ||    (symbol_2_P   -> sy_type & N_TYPE) == N_DATA
                   1848: !        ||    (symbol_2_P   -> sy_type & N_TYPE) == N_BSS
                   1849: !        ||    (symbol_2_P   -> sy_type & N_TYPE) == N_UNDF
                   1850:          );
                   1851:     if (* symbol_1_PP)
                   1852:       {
                   1853: !       if (((* symbol_1_PP) -> sy_type & N_TYPE) == N_UNDF)
                   1854:        {
                   1855:          if (symbol_2_P)
                   1856:            {
                   1857: --- 568,593 ----
                   1858:   
                   1859:   static segT
                   1860:   expr_part (symbol_1_PP, symbol_2_P)
                   1861: !      symbolS **      symbol_1_PP;
                   1862: !      symbolS *       symbol_2_P;
                   1863:   {
                   1864:     segT                       return_value;
                   1865:   
                   1866:     know(    (* symbol_1_PP)                           == NULL
                   1867: !        || (S_IS_TEXT(* symbol_1_PP))
                   1868: !        || (S_IS_DATA(* symbol_1_PP))
                   1869: !        || (S_IS_BSS(* symbol_1_PP))
                   1870: !        || (!S_IS_DEFINED(* symbol_1_PP))
                   1871:          );
                   1872:     know(      symbol_2_P             == NULL
                   1873: !        || (S_IS_TEXT(symbol_2_P))
                   1874: !        || (S_IS_DATA(symbol_2_P))
                   1875: !        || (S_IS_BSS(symbol_2_P))
                   1876: !        || (!S_IS_DEFINED(symbol_2_P))
                   1877:          );
                   1878:     if (* symbol_1_PP)
                   1879:       {
                   1880: !       if (!S_IS_DEFINED(* symbol_1_PP))
                   1881:        {
                   1882:          if (symbol_2_P)
                   1883:            {
                   1884: ***************
                   1885: *** 582,588 ****
                   1886:            }
                   1887:          else
                   1888:            {
                   1889: !            know( ((* symbol_1_PP) -> sy_type & N_TYPE) == N_UNDF)
                   1890:              return_value = SEG_UNKNOWN;
                   1891:            }
                   1892:        }
                   1893: --- 596,602 ----
                   1894:            }
                   1895:          else
                   1896:            {
                   1897: !            know(!S_IS_DEFINED(* symbol_1_PP));
                   1898:              return_value = SEG_UNKNOWN;
                   1899:            }
                   1900:        }
                   1901: ***************
                   1902: *** 590,596 ****
                   1903:        {
                   1904:          if (symbol_2_P)
                   1905:            {
                   1906: !            if ((symbol_2_P -> sy_type & N_TYPE) == N_UNDF)
                   1907:                {
                   1908:                  * symbol_1_PP = NULL;
                   1909:                  return_value = SEG_PASS1;
                   1910: --- 604,610 ----
                   1911:        {
                   1912:          if (symbol_2_P)
                   1913:            {
                   1914: !            if (!S_IS_DEFINED(symbol_2_P))
                   1915:                {
                   1916:                  * symbol_1_PP = NULL;
                   1917:                  return_value = SEG_PASS1;
                   1918: ***************
                   1919: *** 599,605 ****
                   1920:                {
                   1921:                  /* {seg1} - {seg2} */
                   1922:                  as_warn( "Expression too complex, 2 symbols forgotten: \"%s\" \"%s\"",
                   1923: !                        (* symbol_1_PP) -> sy_name, symbol_2_P -> sy_name );
                   1924:                  * symbol_1_PP = NULL;
                   1925:                  return_value = SEG_ABSOLUTE;
                   1926:                }
                   1927: --- 613,619 ----
                   1928:                {
                   1929:                  /* {seg1} - {seg2} */
                   1930:                  as_warn( "Expression too complex, 2 symbols forgotten: \"%s\" \"%s\"",
                   1931: !                        S_GET_NAME(* symbol_1_PP), S_GET_NAME(symbol_2_P));
                   1932:                  * symbol_1_PP = NULL;
                   1933:                  return_value = SEG_ABSOLUTE;
                   1934:                }
                   1935: ***************
                   1936: *** 606,612 ****
                   1937:            }
                   1938:          else
                   1939:            {
                   1940: !            return_value = N_TYPE_seg [(* symbol_1_PP) -> sy_type & N_TYPE];
                   1941:            }
                   1942:        }
                   1943:       }
                   1944: --- 620,626 ----
                   1945:            }
                   1946:          else
                   1947:            {
                   1948: !            return_value = SEG_seg(S_GET_SEGMENT(* symbol_1_PP));
                   1949:            }
                   1950:        }
                   1951:       }
                   1952: ***************
                   1953: *** 615,621 ****
                   1954:         if (symbol_2_P)
                   1955:        {
                   1956:          * symbol_1_PP = symbol_2_P;
                   1957: !        return_value = N_TYPE_seg [(symbol_2_P) -> sy_type & N_TYPE];
                   1958:        }
                   1959:         else
                   1960:        {
                   1961: --- 629,635 ----
                   1962:         if (symbol_2_P)
                   1963:        {
                   1964:          * symbol_1_PP = symbol_2_P;
                   1965: !        return_value = SEG_seg(S_GET_SEGMENT(symbol_2_P));
                   1966:        }
                   1967:         else
                   1968:        {
                   1969: ***************
                   1970: *** 631,637 ****
                   1971:          || return_value == SEG_PASS1                  
                   1972:          );
                   1973:     know(   (* symbol_1_PP) == NULL                            
                   1974: !        || ((* symbol_1_PP) -> sy_type & N_TYPE) == seg_N_TYPE [(int) return_value] );
                   1975:     return (return_value);
                   1976:   }                            /* expr_part() */
                   1977:   
                   1978: --- 645,651 ----
                   1979:          || return_value == SEG_PASS1                  
                   1980:          );
                   1981:     know(   (* symbol_1_PP) == NULL                            
                   1982: !        || (S_GET_SEGMENT(* symbol_1_PP) == seg_SEG((int) return_value) ));
                   1983:     return (return_value);
                   1984:   }                            /* expr_part() */
                   1985:   
                   1986: ***************
                   1987: *** 793,799 ****
                   1988:               * does not cause any further inaccuracy.
                   1989:               */
                   1990:   
                   1991: !            register struct symbol *  symbolP;
                   1992:   
                   1993:              right . X_add_number      = - right . X_add_number;
                   1994:              symbolP                   = right . X_add_symbol;
                   1995: --- 807,813 ----
                   1996:               * does not cause any further inaccuracy.
                   1997:               */
                   1998:   
                   1999: !            register symbolS *        symbolP;
                   2000:   
                   2001:              right . X_add_number      = - right . X_add_number;
                   2002:              symbolP                   = right . X_add_symbol;
                   2003: ***************
                   2004: *** 859,866 ****
                   2005:                          know( resultP -> X_add_symbol      );
                   2006:                          know( resultP -> X_subtract_symbol );
                   2007:                          as_warn("Expression too complex: forgetting %s - %s",
                   2008: !                                resultP -> X_add_symbol      -> sy_name,
                   2009: !                                resultP -> X_subtract_symbol -> sy_name);
                   2010:                          resultP -> X_seg = SEG_ABSOLUTE;
                   2011:                          /* Clean_up_expression() will do the rest. */
                   2012:                        }
                   2013: --- 873,880 ----
                   2014:                          know( resultP -> X_add_symbol      );
                   2015:                          know( resultP -> X_subtract_symbol );
                   2016:                          as_warn("Expression too complex: forgetting %s - %s",
                   2017: !                                S_GET_NAME(resultP -> X_add_symbol),
                   2018: !                                S_GET_NAME(resultP -> X_subtract_symbol));
                   2019:                          resultP -> X_seg = SEG_ABSOLUTE;
                   2020:                          /* Clean_up_expression() will do the rest. */
                   2021:                        }
                   2022: *** /lasvegas/spare/usenet/work/gas-1.37.genuine/./flonum-const.c      Thu Oct 11 18:26:21 1990
                   2023: --- ./flonum-const.c   Wed Nov  7 07:33:37 1990
                   2024: ***************
                   2025: *** 134,140 ****
                   2026:     {X minus_11,       X minus_11+29,  X minus_11 + 29,-242, '+'},
                   2027:   };
                   2028:   
                   2029: ! FLONUM_TYPE flonum_positive_powers_of_ten [] = {
                   2030:     {X zero,   X zero,         X zero,           0, '+'},
                   2031:     {X plus_1, X plus_1  +  0, X plus_1  +  0,   0, '+'},
                   2032:     {X plus_2, X plus_2  +  0, X plus_2  +  0,   0, '+'},
                   2033: --- 134,140 ----
                   2034:     {X minus_11,       X minus_11+29,  X minus_11 + 29,-242, '+'},
                   2035:   };
                   2036:   
                   2037: ! const FLONUM_TYPE flonum_positive_powers_of_ten [] = {
                   2038:     {X zero,   X zero,         X zero,           0, '+'},
                   2039:     {X plus_1, X plus_1  +  0, X plus_1  +  0,   0, '+'},
                   2040:     {X plus_2, X plus_2  +  0, X plus_2  +  0,   0, '+'},
                   2041: *** /lasvegas/spare/usenet/work/gas-1.37.genuine/./frags.c     Thu Aug 17 21:53:21 1989
                   2042: --- ./frags.c  Wed Nov  7 07:33:37 1990
                   2043: ***************
                   2044: *** 17,22 ****
                   2045: --- 17,23 ----
                   2046:   along with GAS; see the file COPYING.  If not, write to
                   2047:   the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
                   2048:   
                   2049: + #include "oformat.h"
                   2050:   #include "as.h"
                   2051:   #include "subsegs.h"
                   2052:   #include "obstack.h"
                   2053: *** /lasvegas/spare/usenet/work/gas-1.37.genuine/./hash.c      Thu Oct 18 18:43:36 1990
                   2054: --- ./hash.c   Wed Nov  7 07:33:39 1990
                   2055: ***************
                   2056: *** 129,134 ****
                   2057: --- 129,137 ----
                   2058:   #define min(a, b)    ((a) < (b) ? (a) : (b))
                   2059:   
                   2060:   #include "hash.h"
                   2061: + 
                   2062: + #define error        as_fatal
                   2063: + 
                   2064:   char *xmalloc();
                   2065:   
                   2066:   #define DELETED     ((char *)1)      /* guarenteed invalid address */
                   2067: *** /lasvegas/spare/usenet/work/gas-1.37.genuine/./i386.c      Mon Jul  9 20:49:54 1990
                   2068: --- ./i386.c   Wed Nov  7 07:33:42 1990
                   2069: ***************
                   2070: *** 37,42 ****
                   2071: --- 37,43 ----
                   2072:   #define index strchr
                   2073:   #endif
                   2074:   
                   2075: + #include "oformat.h"
                   2076:   #include "as.h"
                   2077:   #include "read.h"
                   2078:   #include "flonum.h"
                   2079: ***************
                   2080: *** 117,123 ****
                   2081:   #define SIZE_FROM_RELAX_STATE(s) \
                   2082:     ( (((s) & 0x3) == BYTE ? 1 : (((s) & 0x3) == WORD ? 2 : 4)) )
                   2083:   
                   2084: ! relax_typeS md_relax_table[] = {
                   2085:   /*
                   2086:     The fields are:
                   2087:      1) most positive reach of this state,
                   2088: --- 118,124 ----
                   2089:   #define SIZE_FROM_RELAX_STATE(s) \
                   2090:     ( (((s) & 0x3) == BYTE ? 1 : (((s) & 0x3) == WORD ? 2 : 4)) )
                   2091:   
                   2092: ! const relax_typeS md_relax_table[] = {
                   2093:   /*
                   2094:     The fields are:
                   2095:      1) most positive reach of this state,
                   2096: ***************
                   2097: *** 162,177 ****
                   2098:       input_line_pointer++;
                   2099:   }
                   2100:   
                   2101: ! pseudo_typeS md_pseudo_table[] = {
                   2102:        { "ffloat",     float_cons,     'f' },
                   2103:        { "dfloat",     float_cons,     'd' },
                   2104:        { "tfloat",     float_cons,     'x' },
                   2105:        { "value",      cons,           2 },
                   2106:        { "ident",      dummy,          0   }, /* ignore these directives */
                   2107:        { "def",        dummy,          0   },
                   2108:        { "optim",      dummy,          0   }, /* For sun386i cc */
                   2109:        { "version",    dummy,          0   },
                   2110:        { "ln",    dummy,          0   },
                   2111:        { 0, 0, 0 }
                   2112:   };
                   2113:   
                   2114: --- 163,182 ----
                   2115:       input_line_pointer++;
                   2116:   }
                   2117:   
                   2118: ! const pseudo_typeS md_pseudo_table[] = {
                   2119:        { "ffloat",     float_cons,     'f' },
                   2120:        { "dfloat",     float_cons,     'd' },
                   2121:        { "tfloat",     float_cons,     'x' },
                   2122:        { "value",      cons,           2 },
                   2123:        { "ident",      dummy,          0   }, /* ignore these directives */
                   2124: + #ifdef aout
                   2125:        { "def",        dummy,          0   },
                   2126: + #endif /* aout */
                   2127:        { "optim",      dummy,          0   }, /* For sun386i cc */
                   2128:        { "version",    dummy,          0   },
                   2129: + #ifdef aout
                   2130:        { "ln",    dummy,          0   },
                   2131: + #endif /* aout */
                   2132:        { 0, 0, 0 }
                   2133:   };
                   2134:   
                   2135: ***************
                   2136: *** 373,392 ****
                   2137:     }
                   2138:   }
                   2139:   
                   2140: ! #define SYMBOL_TYPE(t) \
                   2141: !   (((t&N_TYPE) == N_UNDF) ? "UNDEFINED" : \
                   2142: !    (((t&N_TYPE) == N_ABS) ? "ABSOLUTE" : \
                   2143: !     (((t&N_TYPE) == N_TEXT) ? "TEXT" : \
                   2144: !      (((t&N_TYPE) == N_DATA) ? "DATA" : \
                   2145: !       (((t&N_TYPE) == N_BSS) ? "BSS" : "Bad n_type!")))))
                   2146:   
                   2147:   static void ps (s)
                   2148:        symbolS *s;
                   2149:   {
                   2150:     fprintf (stdout, "%s type %s%s",
                   2151: !         s->sy_nlist.n_un.n_name,
                   2152: !         (s->sy_nlist.n_type&N_EXT) ? "EXTERNAL " : "",
                   2153: !         SYMBOL_TYPE (s->sy_nlist.n_type));
                   2154:   }
                   2155:   
                   2156:   struct type_name {
                   2157: --- 378,392 ----
                   2158:     }
                   2159:   }
                   2160:   
                   2161: ! #define SYMBOL_TYPE(t) segment_name(SEG_seg(t))
                   2162:   
                   2163:   static void ps (s)
                   2164:        symbolS *s;
                   2165:   {
                   2166:     fprintf (stdout, "%s type %s%s",
                   2167: !         S_GET_NAME(s),
                   2168: !         S_IS_EXTERNAL(s) ? "EXTERNAL " : "",
                   2169: !         SYMBOL_TYPE(S_GET_SEGMENT(s))
                   2170:   }
                   2171:   
                   2172:   struct type_name {
                   2173: ***************
                   2174: *** 1546,1552 ****
                   2175:   int
                   2176:   md_estimate_size_before_relax (fragP, segment_type)
                   2177:        register fragS *        fragP;
                   2178: !      register int    segment_type; /* N_DATA or N_TEXT. */
                   2179:   {
                   2180:     register uchar *   opcode;
                   2181:     register int               old_fr_fix;
                   2182: --- 1546,1552 ----
                   2183:   int
                   2184:   md_estimate_size_before_relax (fragP, segment_type)
                   2185:        register fragS *        fragP;
                   2186: !      register int    segment_type; /* DATA or TEXT. */
                   2187:   {
                   2188:     register uchar *   opcode;
                   2189:     register int               old_fr_fix;
                   2190: ***************
                   2191: *** 1555,1561 ****
                   2192:     opcode = (uchar *) fragP -> fr_opcode;
                   2193:     /* We've already got fragP->fr_subtype right;  all we have to do is check
                   2194:        for un-relaxable symbols. */
                   2195: !   if ((fragP -> fr_symbol -> sy_type & N_TYPE) != segment_type) {
                   2196:       /* symbol is undefined in this segment */
                   2197:       switch (opcode[0]) {
                   2198:       case JUMP_PC_RELATIVE:   /* make jmp (0xeb) a dword displacement jump */
                   2199: --- 1555,1561 ----
                   2200:     opcode = (uchar *) fragP -> fr_opcode;
                   2201:     /* We've already got fragP->fr_subtype right;  all we have to do is check
                   2202:        for un-relaxable symbols. */
                   2203: !   if (S_GET_SEGMENT(fragP->fr_symbol) != segment_type) {
                   2204:       /* symbol is undefined in this segment */
                   2205:       switch (opcode[0]) {
                   2206:       case JUMP_PC_RELATIVE:   /* make jmp (0xeb) a dword displacement jump */
                   2207: ***************
                   2208: *** 1608,1614 ****
                   2209:     opcode = (uchar *) fragP -> fr_opcode;
                   2210:   
                   2211:     /* Address we want to reach in file space. */
                   2212: !   target_address = fragP->fr_symbol->sy_value + fragP->fr_offset;
                   2213:   
                   2214:     /* Address opcode resides at in file space. */
                   2215:     opcode_address = fragP->fr_address + fragP->fr_fix;
                   2216: --- 1608,1614 ----
                   2217:     opcode = (uchar *) fragP -> fr_opcode;
                   2218:   
                   2219:     /* Address we want to reach in file space. */
                   2220: !   target_address = S_GET_VALUE(fragP->fr_symbol) + fragP->fr_offset;
                   2221:   
                   2222:     /* Address opcode resides at in file space. */
                   2223:     opcode_address = fragP->fr_address + fragP->fr_fix;
                   2224: ***************
                   2225: *** 1687,1693 ****
                   2226:     long offset;
                   2227:   
                   2228:     if (flagseen['m']) {
                   2229: !     offset = to_addr - to_symbol->sy_value;
                   2230:       md_number_to_chars (ptr, 0xe9, 1); /* opcode for long jmp */
                   2231:       md_number_to_chars (ptr + 1, offset, 4);
                   2232:       fix_new (frag, (ptr+1) - frag->fr_literal, 4,
                   2233: --- 1687,1693 ----
                   2234:     long offset;
                   2235:   
                   2236:     if (flagseen['m']) {
                   2237: !     offset = to_addr - S_GET_VALUE(to_symbol);
                   2238:       md_number_to_chars (ptr, 0xe9, 1); /* opcode for long jmp */
                   2239:       md_number_to_chars (ptr + 1, offset, 4);
                   2240:       fix_new (frag, (ptr+1) - frag->fr_literal, 4,
                   2241: ***************
                   2242: *** 1836,1841 ****
                   2243: --- 1836,1844 ----
                   2244:     return retval;
                   2245:   }
                   2246:   
                   2247: + /* Not needed for coff since relocation structure does not 
                   2248: +    contain bitfields. */
                   2249: + #ifdef aout
                   2250:   void md_ri_to_chars(ri_p, ri)
                   2251:        struct relocation_info *ri_p, ri;
                   2252:   {
                   2253: ***************
                   2254: *** 1852,1857 ****
                   2255: --- 1855,1861 ----
                   2256:     /* now put it back where you found it */
                   2257:     bcopy (the_bytes, (char *)ri_p, sizeof(struct relocation_info));
                   2258:   }
                   2259: + #endif /* aout */
                   2260:   
                   2261:   
                   2262:   #define MAX_LITTLENUMS 6
                   2263: *** /lasvegas/spare/usenet/work/gas-1.37.genuine/./m-sun3.h    Wed Mar  1 23:49:04 1989
                   2264: --- ./m-sun3.h Wed Nov  7 07:33:43 1990
                   2265: ***************
                   2266: *** 29,31 ****
                   2267: --- 29,41 ----
                   2268:   
                   2269:   #define M_SUN        1
                   2270:   #define SUN_ASM_SYNTAX
                   2271: + 
                   2272: + /* Return true if s (a non null string pointer), points to a local variable
                   2273: +    name. */
                   2274: + #define S_LOCAL_NAME(s)  (S_GET_NAME(s)[0] == 'L')
                   2275: + 
                   2276: + /* Could also be :
                   2277: + #define S_LOCAL_NAME(s)      (S_GET_NAME(s)[0] == '.' &&
                   2278: +                               S_GET_NAME(s)[1] == 'L' || 
                   2279: +                               S_GET_NAME(s)[1] == '.')
                   2280: + */
                   2281: *** /lasvegas/spare/usenet/work/gas-1.37.genuine/./m68k.c      Tue Oct 16 16:38:51 1990
                   2282: --- ./m68k.c   Wed Nov  7 07:33:46 1990
                   2283: ***************
                   2284: *** 21,26 ****
                   2285: --- 21,27 ----
                   2286:   #include <ctype.h>
                   2287:   
                   2288:   #include "m68k-opcode.h"
                   2289: + #include "oformat.h"
                   2290:   #include "as.h"
                   2291:   #include "obstack.h"
                   2292:   #include "frags.h"
                   2293: ***************
                   2294: *** 2738,2744 ****
                   2295:     know(fragP->fr_symbol);
                   2296:   
                   2297:     /* The displacement of the address, from current location.  */
                   2298: !   disp = (fragP->fr_symbol->sy_value + fragP->fr_offset) - object_address;
                   2299:   
                   2300:     switch(fragP->fr_subtype) {
                   2301:     case TAB(BCC68000,BYTE):
                   2302: --- 2739,2745 ----
                   2303:     know(fragP->fr_symbol);
                   2304:   
                   2305:     /* The displacement of the address, from current location.  */
                   2306: !   disp = (S_GET_VALUE(fragP->fr_symbol) + fragP->fr_offset) - object_address;
                   2307:   
                   2308:     switch(fragP->fr_subtype) {
                   2309:     case TAB(BCC68000,BYTE):
                   2310: ***************
                   2311: *** 2887,2893 ****
                   2312:        /* handle SZ_UNDEF first, it can be changed to BYTE or SHORT */
                   2313:        switch(fragP->fr_subtype) {
                   2314:        case TAB(BRANCH,SZ_UNDEF):
                   2315: !              if((fragP->fr_symbol->sy_type&N_TYPE)==segtype) {
                   2316:                        fragP->fr_subtype=TAB(TABTYPE(fragP->fr_subtype),BYTE);
                   2317:                        break;
                   2318:                } else if(flagseen['m']) {
                   2319: --- 2888,2894 ----
                   2320:        /* handle SZ_UNDEF first, it can be changed to BYTE or SHORT */
                   2321:        switch(fragP->fr_subtype) {
                   2322:        case TAB(BRANCH,SZ_UNDEF):
                   2323: !              if(S_GET_SEGMENT(fragP->fr_symbol)==segtype) {
                   2324:                        fragP->fr_subtype=TAB(TABTYPE(fragP->fr_subtype),BYTE);
                   2325:                        break;
                   2326:                } else if(flagseen['m']) {
                   2327: ***************
                   2328: *** 2945,2951 ****
                   2329:                break;
                   2330:   
                   2331:        case TAB(FBRANCH,SZ_UNDEF):
                   2332: !              if((fragP->fr_symbol->sy_type&N_TYPE)==segtype || flagseen['l']) {
                   2333:                        fragP->fr_subtype=TAB(FBRANCH,SHORT);
                   2334:                        fragP->fr_var+=2;
                   2335:                } else {
                   2336: --- 2946,2952 ----
                   2337:                break;
                   2338:   
                   2339:        case TAB(FBRANCH,SZ_UNDEF):
                   2340: !              if(S_GET_SEGMENT(fragP->fr_symbol)==segtype || flagseen['l']) {
                   2341:                        fragP->fr_subtype=TAB(FBRANCH,SHORT);
                   2342:                        fragP->fr_var+=2;
                   2343:                } else {
                   2344: ***************
                   2345: *** 2955,2961 ****
                   2346:                break;
                   2347:   
                   2348:        case TAB(PCREL,SZ_UNDEF):
                   2349: !              if((fragP->fr_symbol->sy_type&N_TYPE)==segtype || flagseen['l']) {
                   2350:                        fragP->fr_subtype=TAB(PCREL,SHORT);
                   2351:                        fragP->fr_var+=2;
                   2352:                } else {
                   2353: --- 2956,2962 ----
                   2354:                break;
                   2355:   
                   2356:        case TAB(PCREL,SZ_UNDEF):
                   2357: !              if(S_GET_SEGMENT(fragP->fr_symbol)==segtype || flagseen['l']) {
                   2358:                        fragP->fr_subtype=TAB(PCREL,SHORT);
                   2359:                        fragP->fr_var+=2;
                   2360:                } else {
                   2361: ***************
                   2362: *** 2965,2971 ****
                   2363:                break;
                   2364:   
                   2365:        case TAB(BCC68000,SZ_UNDEF):
                   2366: !              if((fragP->fr_symbol->sy_type&N_TYPE)==segtype) {
                   2367:                        fragP->fr_subtype=TAB(BCC68000,BYTE);
                   2368:                        break;
                   2369:                }
                   2370: --- 2966,2972 ----
                   2371:                break;
                   2372:   
                   2373:        case TAB(BCC68000,SZ_UNDEF):
                   2374: !              if(S_GET_SEGMENT(fragP->fr_symbol)==segtype) {
                   2375:                        fragP->fr_subtype=TAB(BCC68000,BYTE);
                   2376:                        break;
                   2377:                }
                   2378: ***************
                   2379: *** 2997,3003 ****
                   2380:                break;
                   2381:   
                   2382:        case TAB(DBCC,SZ_UNDEF):
                   2383: !              if((fragP->fr_symbol->sy_type&N_TYPE)==segtype) {
                   2384:                        fragP->fr_subtype=TAB(DBCC,SHORT);
                   2385:                        fragP->fr_var+=2;
                   2386:                        break;
                   2387: --- 2998,3004 ----
                   2388:                break;
                   2389:   
                   2390:        case TAB(DBCC,SZ_UNDEF):
                   2391: !                 if(S_GET_SEGMENT(fragP->fr_symbol)==segtype) {
                   2392:                        fragP->fr_subtype=TAB(DBCC,SHORT);
                   2393:                        fragP->fr_var+=2;
                   2394:                        break;
                   2395: ***************
                   2396: *** 3033,3039 ****
                   2397:                break;
                   2398:   
                   2399:        case TAB(PCLEA,SZ_UNDEF):
                   2400: !              if((fragP->fr_symbol->sy_type&N_TYPE)==segtype || flagseen['l']) {
                   2401:                        fragP->fr_subtype=TAB(PCLEA,SHORT);
                   2402:                        fragP->fr_var+=2;
                   2403:                } else {
                   2404: --- 3034,3040 ----
                   2405:                break;
                   2406:   
                   2407:        case TAB(PCLEA,SZ_UNDEF):
                   2408: !              if(S_GET_SEGMENT(fragP->fr_symbol)==segtype || flagseen['l']) {
                   2409:                        fragP->fr_subtype=TAB(PCLEA,SHORT);
                   2410:                        fragP->fr_var+=2;
                   2411:                } else {
                   2412: ***************
                   2413: *** 3052,3058 ****
                   2414:        case TAB(BRANCH,BYTE):
                   2415:                        /* We can't do a short jump to the next instruction,
                   2416:                           so we force word mode.  */
                   2417: !              if(fragP->fr_symbol && fragP->fr_symbol->sy_value==0 &&
                   2418:    fragP->fr_symbol->sy_frag==fragP->fr_next) {
                   2419:                        fragP->fr_subtype=TAB(TABTYPE(fragP->fr_subtype),SHORT);
                   2420:                        fragP->fr_var+=2;
                   2421: --- 3053,3059 ----
                   2422:        case TAB(BRANCH,BYTE):
                   2423:                        /* We can't do a short jump to the next instruction,
                   2424:                           so we force word mode.  */
                   2425: !              if(fragP->fr_symbol && S_GET_VALUE(fragP->fr_symbol)==0 &&
                   2426:    fragP->fr_symbol->sy_frag==fragP->fr_next) {
                   2427:                        fragP->fr_subtype=TAB(TABTYPE(fragP->fr_subtype),SHORT);
                   2428:                        fragP->fr_var+=2;
                   2429: ***************
                   2430: *** 3064,3069 ****
                   2431: --- 3065,3071 ----
                   2432:        return fragP->fr_var + fragP->fr_fix - old_fix;
                   2433:   }
                   2434:   
                   2435: + #ifdef aout
                   2436:   /* the bit-field entries in the relocation_info struct plays hell 
                   2437:      with the byte-order problems of cross-assembly.  So as a hack,
                   2438:      I added this mach. dependent ri twiddler.  Ugly, but it gets
                   2439: ***************
                   2440: *** 3089,3094 ****
                   2441: --- 3091,3097 ----
                   2442:     /* now put it back where you found it */
                   2443:     bcopy (the_bytes, (char *)ri_p, sizeof(struct relocation_info));
                   2444:   }
                   2445: + #endif /* aout */
                   2446:   
                   2447:   #ifndef WORKING_DOT_WORD
                   2448:   const int md_short_jump_size = 4;
                   2449: ***************
                   2450: *** 3121,3127 ****
                   2451:        long offset;
                   2452:   
                   2453:        if(flagseen['m']) {
                   2454: !              offset=to_addr-to_symbol->sy_value;
                   2455:                md_number_to_chars(ptr  ,(long)0x4EF9,2);
                   2456:                md_number_to_chars(ptr+2,(long)offset,4);
                   2457:                fix_new(frag,(ptr+2)-frag->fr_literal,4,to_symbol,(symbolS *)0,(long int)0,0);
                   2458: --- 3124,3130 ----
                   2459:        long offset;
                   2460:   
                   2461:        if(flagseen['m']) {
                   2462: !              offset=to_addr-S_GET_VALUE(to_symbol);
                   2463:                md_number_to_chars(ptr  ,(long)0x4EF9,2);
                   2464:                md_number_to_chars(ptr+2,(long)offset,4);
                   2465:                fix_new(frag,(ptr+2)-frag->fr_literal,4,to_symbol,(symbolS *)0,(long int)0,0);
                   2466: *** /lasvegas/spare/usenet/work/gas-1.37.genuine/./read.c      Thu Oct 18 22:01:12 1990
                   2467: --- ./read.c   Wed Nov  7 07:33:51 1990
                   2468: ***************
                   2469: *** 35,40 ****
                   2470: --- 35,41 ----
                   2471:   #include <ctype.h>
                   2472:   #include <sys/types.h>
                   2473:   #include <sys/stat.h>
                   2474: + #include "oformat.h"
                   2475:   #include "as.h"
                   2476:   #include "read.h"
                   2477:   #include "md.h"
                   2478: ***************
                   2479: *** 119,125 ****
                   2480: --- 120,131 ----
                   2481:   static int           is_it_end_of_statement();
                   2482:   static void          pobegin();
                   2483:   static void          pseudo_set();
                   2484: + #ifdef coff
                   2485: + static void          def();
                   2486: + static void          line();
                   2487: + #else /* coff */
                   2488:   static void          stab();
                   2489: + #endif /* coff */
                   2490:   static void          stringer();
                   2491:   
                   2492:   extern char line_comment_chars[];
                   2493: ***************
                   2494: *** 135,140 ****
                   2495: --- 141,153 ----
                   2496:   static char *old_input;
                   2497:   static char *old_limit;
                   2498:   
                   2499: + #ifdef coff
                   2500: + static struct hash_control* tag_hash;
                   2501: + static void              tag_init();
                   2502: + static void              tag_insert();
                   2503: + static symbolS*                  tag_find();
                   2504: + #endif /* coff */
                   2505: + 
                   2506:   #ifndef WORKING_DOT_WORD
                   2507:   struct broken_word *broken_words;
                   2508:   int new_broken_words = 0;
                   2509: ***************
                   2510: *** 147,152 ****
                   2511: --- 160,168 ----
                   2512:   read_begin()
                   2513:   {
                   2514:     pobegin();
                   2515: + #ifdef coff
                   2516: +   tag_init();
                   2517: + #endif /* coff */
                   2518:     obstack_begin( &notes, 5000 );
                   2519:   #define BIGNUM_BEGIN_SIZE (16)
                   2520:     bignum_low = xmalloc((long)BIGNUM_BEGIN_SIZE);
                   2521: ***************
                   2522: *** 159,166 ****
                   2523:   po_hash = NULL;                      /* use before set up: NULL-> address error */
                   2524:   
                   2525:   
                   2526:   void s_abort(),      s_align(),      s_comm(),       s_data();
                   2527: ! void s_desc(),       s_even(),       s_file(),       s_fill();
                   2528:   void s_globl(),      s_lcomm(),      s_line(),       s_lsym();
                   2529:   void s_org(),        s_set(),        s_space(),      s_text();
                   2530:   #ifdef VMS
                   2531: --- 175,185 ----
                   2532:   po_hash = NULL;                      /* use before set up: NULL-> address error */
                   2533:   
                   2534:   
                   2535: + #ifdef aout
                   2536: + void s_desc();
                   2537: + #endif /* aout */
                   2538:   void s_abort(),      s_align(),      s_comm(),       s_data();
                   2539: ! void s_even(),       s_file(),       s_fill();
                   2540:   void s_globl(),      s_lcomm(),      s_line(),       s_lsym();
                   2541:   void s_org(),        s_set(),        s_space(),      s_text();
                   2542:   #ifdef VMS
                   2543: ***************
                   2544: *** 192,198 ****
                   2545: --- 211,219 ----
                   2546:     { "const", s_const,        0       },
                   2547:   #endif
                   2548:     { "data",  s_data,         0       },
                   2549: + #ifdef aout
                   2550:     { "desc",  s_desc,         0       },
                   2551: + #endif /* aout */
                   2552:     { "double",        float_cons,     'd'     },
                   2553:     { "file",  s_file,         0       },
                   2554:     { "fill",  s_fill,         0       },
                   2555: ***************
                   2556: *** 218,226 ****
                   2557: --- 239,252 ----
                   2558:     { "short", cons,           2       },
                   2559:     { "single",        float_cons,     'f'     },
                   2560:     { "space", s_space,        0       },
                   2561: + #ifdef coff
                   2562: +   { "def",   def,            0       },
                   2563: +   { "ln",    line,           0       },
                   2564: + #else /* coff */
                   2565:     { "stabd", stab,           'd'     },
                   2566:     { "stabn", stab,           'n'     },
                   2567:     { "stabs", stab,           's'     },
                   2568: + #endif /* coff */
                   2569:     { "text",  s_text,         0       },
                   2570:   #ifndef SPARC
                   2571:     { "word",  cons,           2       },
                   2572: ***************
                   2573: *** 622,640 ****
                   2574:        *p = 0;
                   2575:        symbolP = symbol_find_or_make (name);
                   2576:        *p = c;
                   2577: !      if (   (symbolP -> sy_type & N_TYPE) != N_UNDF ||
                   2578: !  symbolP -> sy_other != 0 || symbolP -> sy_desc != 0) {
                   2579:                as_warn( "Ignoring attempt to re-define symbol");
                   2580:                ignore_rest_of_line();
                   2581:                return;
                   2582:        }
                   2583: !      if (symbolP -> sy_value) {
                   2584: !              if (symbolP -> sy_value != temp)
                   2585:                        as_warn( "Length of .comm \"%s\" is already %d. Not changed to %d.",
                   2586: !  symbolP -> sy_name, symbolP -> sy_value, temp);
                   2587:        } else {
                   2588: !              symbolP -> sy_value = temp;
                   2589: !              symbolP -> sy_type |= N_EXT;
                   2590:        }
                   2591:   #ifdef VMS
                   2592:        if(!temp)
                   2593: --- 648,671 ----
                   2594:        *p = 0;
                   2595:        symbolP = symbol_find_or_make (name);
                   2596:        *p = c;
                   2597: !      if (S_IS_DEFINED(symbolP) 
                   2598: ! #ifdef aout
                   2599: !          || S_GET_OTHER(symbolP) != 0 || S_GET_DESC(symbolP) != 0
                   2600: ! #endif /* aout */
                   2601: !          ) {
                   2602:                as_warn( "Ignoring attempt to re-define symbol");
                   2603:                ignore_rest_of_line();
                   2604:                return;
                   2605:        }
                   2606: !      if (S_GET_VALUE(symbolP)) {
                   2607: !              if (S_GET_VALUE(symbolP) != temp)
                   2608:                        as_warn( "Length of .comm \"%s\" is already %d. Not changed to %d.",
                   2609: !                              S_GET_NAME(symbolP),
                   2610: !                              S_GET_VALUE(symbolP),
                   2611: !                              temp);
                   2612:        } else {
                   2613: !              S_SET_VALUE(symbolP, temp);
                   2614: !              S_SET_EXTERNAL(symbolP);
                   2615:        }
                   2616:   #ifdef VMS
                   2617:        if(!temp)
                   2618: ***************
                   2619: *** 670,675 ****
                   2620: --- 701,707 ----
                   2621:        demand_empty_rest_of_line();
                   2622:   }
                   2623:   
                   2624: + #ifdef aout
                   2625:   void
                   2626:   s_desc()
                   2627:   {
                   2628: ***************
                   2629: *** 699,720 ****
                   2630:                *p = 0;
                   2631:                symbolP = symbol_find_or_make (name);
                   2632:                *p = c;
                   2633: !              symbolP -> sy_desc = temp;
                   2634:        }
                   2635:        demand_empty_rest_of_line();
                   2636:   }
                   2637:   
                   2638:   void
                   2639:   s_file()
                   2640:   {
                   2641: !      register char *s;
                   2642: !      int     length;
                   2643: ! 
                   2644: !      /* Some assemblers tolerate immediately following '"' */
                   2645: !      if ( s = demand_copy_string( & length ) ) {
                   2646: !              new_logical_line (s, -1);
                   2647: !              demand_empty_rest_of_line();
                   2648: !      }
                   2649:   }
                   2650:   
                   2651:   void
                   2652: --- 731,756 ----
                   2653:                *p = 0;
                   2654:                symbolP = symbol_find_or_make (name);
                   2655:                *p = c;
                   2656: !              S_SET_DESC(symbolP,temp);
                   2657:        }
                   2658:        demand_empty_rest_of_line();
                   2659:   }
                   2660: + #endif /* aout */
                   2661:   
                   2662:   void
                   2663:   s_file()
                   2664:   {
                   2665: !     register char *s;
                   2666: !     int      length;
                   2667: !     
                   2668: !     /* Some assemblers tolerate immediately following '"' */
                   2669: !     if ( s = demand_copy_string( & length ) ) {
                   2670: !      new_logical_line (s, -1);
                   2671: !      demand_empty_rest_of_line();
                   2672: !     }
                   2673: ! #ifdef coff
                   2674: !     c_dot_file_symbol(s);
                   2675: ! #endif /* coff */
                   2676:   }
                   2677:   
                   2678:   void
                   2679: ***************
                   2680: *** 897,903 ****
                   2681:                symbolP = symbol_find_or_make (name);
                   2682:                * input_line_pointer = c;
                   2683:                SKIP_WHITESPACE();
                   2684: !              symbolP -> sy_type |= N_EXT;
                   2685:                if(c==',') {
                   2686:                        input_line_pointer++;
                   2687:                        SKIP_WHITESPACE();
                   2688: --- 933,939 ----
                   2689:                symbolP = symbol_find_or_make (name);
                   2690:                * input_line_pointer = c;
                   2691:                SKIP_WHITESPACE();
                   2692: !              S_SET_EXTERNAL(symbolP);
                   2693:                if(c==',') {
                   2694:                        input_line_pointer++;
                   2695:                        SKIP_WHITESPACE();
                   2696: ***************
                   2697: *** 936,954 ****
                   2698:        *p = 0;
                   2699:        symbolP = symbol_find_or_make (name);
                   2700:        *p = c;
                   2701: !      if (   symbolP -> sy_other == 0
                   2702: !          && symbolP -> sy_desc  == 0
                   2703: !          && (   (   symbolP -> sy_type  == N_BSS
                   2704: !          && symbolP -> sy_value == local_bss_counter)
                   2705: !          || (   (symbolP -> sy_type & N_TYPE) == N_UNDF
                   2706: !          && symbolP -> sy_value == 0))) {
                   2707: !              symbolP -> sy_value = local_bss_counter;
                   2708: !              symbolP -> sy_type  = N_BSS;
                   2709:                symbolP -> sy_frag  = & bss_address_frag;
                   2710:                local_bss_counter += temp;
                   2711:        } else
                   2712:                as_warn( "Ignoring attempt to re-define symbol from %d. to %d.",
                   2713: !  symbolP -> sy_value, local_bss_counter );
                   2714:        demand_empty_rest_of_line();
                   2715:   }
                   2716:   
                   2717: --- 972,998 ----
                   2718:        *p = 0;
                   2719:        symbolP = symbol_find_or_make (name);
                   2720:        *p = c;
                   2721: !      if (
                   2722: ! #ifdef aout
                   2723: !          S_GET_OTHER(symbolP) == 0 &&
                   2724: !          S_GET_DESC(symbolP)  == 0 &&
                   2725: ! #endif /* aout */  
                   2726: !          (S_IS_BSS(symbolP) && S_GET_VALUE(symbolP) == local_bss_counter)
                   2727: ! /* What S_GET_VALUE(symbolP) == 0 is supposed to mean (in aout case) ? 
                   2728: !    In the coff case it clearly does not mean anything (the only case
                   2729: !    where a symbol is not defined is from an external declaration (extern a)
                   2730: !    and this kind of symbol have a 0 value. */
                   2731: !          || (!S_IS_DEFINED(symbolP) && S_GET_VALUE(symbolP) == 0)) {
                   2732: !              S_SET_VALUE(symbolP,local_bss_counter);
                   2733: !              S_SET_BSS(symbolP);
                   2734: ! #ifdef coff
                   2735: !              S_SET_STORAGE_CLASS(symbolP, C_STAT);
                   2736: ! #endif /* coff */
                   2737:                symbolP -> sy_frag  = & bss_address_frag;
                   2738:                local_bss_counter += temp;
                   2739:        } else
                   2740:                as_warn( "Ignoring attempt to re-define symbol from %d. to %d.",
                   2741: !  S_GET_VALUE(symbolP), local_bss_counter );
                   2742:        demand_empty_rest_of_line();
                   2743:   }
                   2744:   
                   2745: ***************
                   2746: *** 1001,1014 ****
                   2747:        segment = expression (& exp);
                   2748:        if (   segment != SEG_ABSOLUTE && segment != SEG_DATA &&
                   2749:    segment != SEG_TEXT && segment != SEG_BSS) {
                   2750: !              as_warn("Bad expression: %s", seg_name [(int)segment]);
                   2751:                ignore_rest_of_line();
                   2752:                return;
                   2753:        }
                   2754:    know(   segment == SEG_ABSOLUTE || segment == SEG_DATA || segment == SEG_TEXT || segment == SEG_BSS );
                   2755:        *p = 0;
                   2756: !      symbolP = symbol_new (name,(unsigned char)(seg_N_TYPE [(int) segment]),
                   2757:    0, 0, (valueT)(exp . X_add_number), & zero_address_frag);
                   2758:        *p = c;
                   2759:        demand_empty_rest_of_line();
                   2760:   }
                   2761: --- 1045,1063 ----
                   2762:        segment = expression (& exp);
                   2763:        if (   segment != SEG_ABSOLUTE && segment != SEG_DATA &&
                   2764:    segment != SEG_TEXT && segment != SEG_BSS) {
                   2765: !              as_warn("Bad expression: %s", segment_name((int)segment));
                   2766:                ignore_rest_of_line();
                   2767:                return;
                   2768:        }
                   2769:    know(   segment == SEG_ABSOLUTE || segment == SEG_DATA || segment == SEG_TEXT || segment == SEG_BSS );
                   2770:        *p = 0;
                   2771: ! #ifdef coff
                   2772: !      symbolP = symbol_new(name, segment, (valueT)(exp . X_add_number),
                   2773: !                           0, &zero_address_frag);
                   2774: ! #else /* coff */
                   2775: !      symbolP = symbol_new (name,(unsigned char)(seg_SEG((int) segment)),
                   2776:    0, 0, (valueT)(exp . X_add_number), & zero_address_frag);
                   2777: + #endif /* coff */
                   2778:        *p = c;
                   2779:        demand_empty_rest_of_line();
                   2780:   }
                   2781: ***************
                   2782: *** 1044,1050 ****
                   2783:        if ( ! need_pass_2 ) {
                   2784:                if (segment != now_seg && segment != SEG_ABSOLUTE)
                   2785:                        as_warn("Illegal segment \"%s\". Segment \"%s\" assumed.",
                   2786: !  seg_name [(int) segment], seg_name [(int) now_seg]);
                   2787:                p = frag_var (rs_org, 1, 1, (relax_substateT)0, exp . X_add_symbol,
                   2788:    exp . X_add_number, (char *)0);
                   2789:                * p = temp_fill;
                   2790: --- 1093,1099 ----
                   2791:        if ( ! need_pass_2 ) {
                   2792:                if (segment != now_seg && segment != SEG_ABSOLUTE)
                   2793:                        as_warn("Illegal segment \"%s\". Segment \"%s\" assumed.",
                   2794: !  segment_name((int) segment), segment_name((int) now_seg));
                   2795:                p = frag_var (rs_org, 1, 1, (relax_substateT)0, exp . X_add_symbol,
                   2796:    exp . X_add_number, (char *)0);
                   2797:                * p = temp_fill;
                   2798: ***************
                   2799: *** 1089,1095 ****
                   2800:          if ( ! need_pass_2 ) {
                   2801:            if (segment != now_seg && segment != SEG_ABSOLUTE)
                   2802:              as_warn("Illegal segment \"%s\". Segment \"%s\" assumed.",
                   2803: !                    seg_name [(int) segment], seg_name [(int) now_seg]);
                   2804:            ptr = frag_var (rs_org, 1, 1, (relax_substateT)0, exp.X_add_symbol,
                   2805:                          exp.X_add_number, (char *)0);
                   2806:            *ptr= 0;
                   2807: --- 1138,1145 ----
                   2808:          if ( ! need_pass_2 ) {
                   2809:            if (segment != now_seg && segment != SEG_ABSOLUTE)
                   2810:              as_warn("Illegal segment \"%s\". Segment \"%s\" assumed.",
                   2811: !                    segment_name((int) segment),
                   2812: !                    segment_name((int) now_seg));
                   2813:            ptr = frag_var (rs_org, 1, 1, (relax_substateT)0, exp.X_add_symbol,
                   2814:                          exp.X_add_number, (char *)0);
                   2815:            *ptr= 0;
                   2816: ***************
                   2817: *** 1176,1181 ****
                   2818: --- 1226,1546 ----
                   2819:     know( is_end_of_line [input_line_pointer [-1]] );
                   2820:   }
                   2821:   
                   2822: + #ifdef coff
                   2823: + /*
                   2824: +  * Handle .ln directives.
                   2825: +  */
                   2826: + 
                   2827: + static void
                   2828: + line(what)
                   2829: + int what;
                   2830: + {
                   2831: +     c_line_new(obstack_next_free(&frags) - frag_now->fr_literal,
                   2832: +             get_absolute_expression(),
                   2833: +             frag_now);
                   2834: +     demand_empty_rest_of_line();
                   2835: + 
                   2836: +     return;
                   2837: + }
                   2838: + /*
                   2839: +  *                   def()
                   2840: +  *
                   2841: +  * Handle .def directives.
                   2842: +  *
                   2843: +  * One would say : why can't we symbol_new if the symbol does not
                   2844: +  * allready exists and fill it with debug information. Because of
                   2845: +  * the C_EFCN special symbol. It would clobber the value of the
                   2846: +  * function symbol before we have a chance to notice that it is
                   2847: +  * a C_EFCN. And a second reason is that the code is more clear this
                   2848: +  * way. (at least I think it is:-).
                   2849: +  * 
                   2850: +  */
                   2851: + 
                   2852: + #define SKIP_SEMI_COLON()    while(*input_line_pointer++ != ';')
                   2853: + #define SKIP_WHITESPACES()   while(*input_line_pointer == ' ' || \
                   2854: +                                    *input_line_pointer == '\t') \
                   2855: +                                          input_line_pointer++;
                   2856: + 
                   2857: + #define NEXT_DEF_DIRECTIVE()         SKIP_SEMI_COLON(); SKIP_WHITESPACES()
                   2858: + #define equal                        !strcmp
                   2859: + #define MAX_DIRECTIVE                20
                   2860: + 
                   2861: + static void
                   2862: + def(what)
                   2863: + int what;
                   2864: + {
                   2865: +     char     name_end;               /* Char after the end of name */
                   2866: +     symbolS* symbolP;                /* Debug symbol just created */
                   2867: +     symbolS  symbol;                 /* Temporary symbol to hold .def */
                   2868: +     char*    symbol_name;            /* Name of the debug symbol */
                   2869: +     char*    symbol_name_copy;       /* Temporary copy of the name */
                   2870: +     unsigned int symbol_name_length; /* */
                   2871: +     char*    directiveP;             /* Name of the pseudo opcode */
                   2872: +     char     directive[MAX_DIRECTIVE]; /* Backup of the directive */
                   2873: +     char     end = 0;                /* If 1, stop parsing */
                   2874: +     
                   2875: +     SKIP_WHITESPACES();
                   2876: + 
                   2877: +     symbolP = &symbol;
                   2878: +     memset((char*)symbolP, '\0', sizeof(symbolS));
                   2879: + 
                   2880: +     symbol_name = input_line_pointer;
                   2881: +     name_end = get_symbol_end();
                   2882: +     symbol_name_length = strlen(symbol_name);
                   2883: +     symbol_name_copy = xmalloc(symbol_name_length + 1);
                   2884: +     strcpy(symbol_name_copy, symbol_name);
                   2885: +     
                   2886: +     /* Initialize the new symbol */
                   2887: + #if STRIP_UNDERSCORE
                   2888: +     S_SET_NAME(symbolP, *symbol_name_copy == '_' ? symbol_name_copy + 1 :
                   2889: +                                                 symbol_name_copy);
                   2890: + #else /* STRIP_UNDERSCORE */
                   2891: +     S_SET_NAME(symbolP, symbol_name_copy);
                   2892: + #endif /* STRIP_UNDERSCORE */
                   2893: +     symbolP->sy_name_offset = ~0;
                   2894: +     symbolP->sy_number = ~0;
                   2895: +     symbolP->sy_frag = &zero_address_frag;
                   2896: +     if(S_IS_STRING(symbolP))
                   2897: +      SF_SET_STRING(symbolP);
                   2898: + 
                   2899: +     *input_line_pointer = name_end;
                   2900: + 
                   2901: +     while(!end) {
                   2902: +      NEXT_DEF_DIRECTIVE();
                   2903: +      directiveP = input_line_pointer;
                   2904: +      name_end = get_symbol_end();
                   2905: +      strncpy(directive, directiveP, MAX_DIRECTIVE);
                   2906: +      *input_line_pointer = name_end;
                   2907: +      SKIP_WHITESPACES();
                   2908: +      switch(directive[1]) {
                   2909: +        case 'd':
                   2910: +          if(equal(directive, ".dim")) {
                   2911: +              register int dim_index;
                   2912: +              register int dimension;
                   2913: + 
                   2914: +              S_SET_NUMBER_AUXILIARY(symbolP, 1);
                   2915: +              for(dim_index = 0; dim_index < DIMNUM; dim_index++) {
                   2916: +                  SKIP_WHITESPACES();
                   2917: +                  SA_SET_SYM_DIMEN(symbolP, dim_index,
                   2918: +                                   get_absolute_expression());
                   2919: +                  switch(*input_line_pointer) {
                   2920: +                    case ',':
                   2921: +                      input_line_pointer++;
                   2922: +                      break;
                   2923: +                    default:
                   2924: +                      as_warn("badly formed .dim directive");
                   2925: +                    case ';':
                   2926: +                      dim_index = DIMNUM;
                   2927: +                      break;
                   2928: +                  }
                   2929: +              }
                   2930: +          } else
                   2931: +              as_warn("unknown debug directive : %s", directive);
                   2932: +          break;
                   2933: +        case 'e':
                   2934: +          if(equal(directive, ".endef"))
                   2935: +              end = 1;
                   2936: +          else
                   2937: +              as_warn("unknown debug directive : %s", directive);
                   2938: +          break;
                   2939: +        case 'l':
                   2940: +          if(equal(directive, ".line")) {
                   2941: +              S_SET_NUMBER_AUXILIARY(symbolP, 1);
                   2942: +              SA_SET_SYM_LNNO(symbolP, get_absolute_expression());
                   2943: +          } else
                   2944: +              as_warn("unknown debug directive : %s", directive);
                   2945: +          break;
                   2946: +        case 's':
                   2947: +          if(equal(directive, ".size")) {
                   2948: +              S_SET_NUMBER_AUXILIARY(symbolP, 1);
                   2949: +              SA_SET_SYM_SIZE(symbolP, get_absolute_expression());
                   2950: +          } else if(equal(directive, ".scl"))
                   2951: +              S_SET_STORAGE_CLASS(symbolP, get_absolute_expression());
                   2952: +          else
                   2953: +              as_warn("unknown debug directive : %s", directive);
                   2954: +          break;
                   2955: +        case 't':
                   2956: +          if(equal(directive, ".tag")) {
                   2957: +              symbolS * tag_symbolP;
                   2958: + 
                   2959: +              S_SET_NUMBER_AUXILIARY(symbolP, 1);
                   2960: +              symbol_name = input_line_pointer;
                   2961: +              name_end = get_symbol_end();
                   2962: +              /* Assume that the symbol referred to by .tag is 
                   2963: +                 always defined. */
                   2964: +              SA_SET_SYM_TAGNDX(symbolP, (long)tag_find(symbol_name));
                   2965: +              if(SA_GET_SYM_TAGNDX(symbolP) == 0L)
                   2966: +                  as_warn("tag not found for .tag %s", symbol_name);
                   2967: +              SF_SET_TAGGED(symbolP);
                   2968: +              *input_line_pointer = name_end;
                   2969: +          } else if(equal(directive, ".type")) {
                   2970: +              S_SET_DATA_TYPE(symbolP, get_absolute_expression());
                   2971: +              if(ISFCN(S_GET_DATA_TYPE(symbolP)) &&
                   2972: +                 S_GET_STORAGE_CLASS(symbolP) != C_TPDEF)
                   2973: +                  SF_SET_FUNCTION(symbolP);
                   2974: +          } else
                   2975: +              as_warn("unknown debug directive : %s", directive);
                   2976: +          break;
                   2977: +        case 'v':
                   2978: +          if(equal(directive, ".val")) {
                   2979: +              if(is_name_beginner(*input_line_pointer)) {
                   2980: +                  symbol_name = input_line_pointer;
                   2981: +                  name_end = get_symbol_end();
                   2982: +                  if(equal(symbol_name, ".")) {
                   2983: +                      symbolP->sy_frag = frag_now;
                   2984: +                      S_SET_VALUE(symbolP, obstack_next_free(&frags) -
                   2985: +                                           frag_now->fr_literal);
                   2986: +                      /* If the .val is != from the .def (i.e. statics) */
                   2987: +                  } else if(!equal(symbol_name_copy, symbol_name)) {
                   2988: +                      register symbolS* forwardP;
                   2989: +                      if(forwardP = symbol_find(symbol_name))
                   2990: +                          symbolP->sy_forward = forwardP;
                   2991: +                      else {
                   2992: +                          /* Create a new undefined symbol. */
                   2993: +                          symbolP->sy_forward =
                   2994: +                              symbol_new (symbol_name, SEG_UNKNOWN,
                   2995: +                                          0, 0, &zero_address_frag);
                   2996: +                      }
                   2997: +                      /* If the segment is undefined when the forward
                   2998: +                         reference is solved, then copy the segment id
                   2999: +                         from the forward symbol. */
                   3000: +                      SF_SET_GET_SEGMENT(symbolP);
                   3001: +                  }
                   3002: +                  /* Otherwise, it is the name of a non debug symbol and its
                   3003: +                     value will be calculated later. */
                   3004: +                  *input_line_pointer = name_end;
                   3005: +              } else
                   3006: +                  S_SET_VALUE(symbolP, get_absolute_expression());
                   3007: +          } else
                   3008: +              as_warn("unknown debug directive : %s", directive);
                   3009: +          break;
                   3010: +        default:
                   3011: +          as_warn("unknown debug directive : %s", directive);
                   3012: +          break;
                   3013: +      }
                   3014: +     }
                   3015: +     demand_empty_rest_of_line();
                   3016: + 
                   3017: +     /* Set the section number according to storage class. */
                   3018: +     switch(S_GET_STORAGE_CLASS(symbolP)) {
                   3019: +       case C_STRTAG: case C_ENTAG: case C_UNTAG:
                   3020: +      SF_SET_TAG(symbolP);
                   3021: +       case C_FILE:
                   3022: +       case C_TPDEF:
                   3023: +      SF_SET_DEBUG(symbolP);
                   3024: +      S_SET_SEGMENT(symbolP, C_DEBUG_SECTION);
                   3025: +      break;
                   3026: +       case C_EFCN:
                   3027: +      SF_SET_LOCAL(symbolP);   /* Do not emit this symbol. */
                   3028: +       case C_BLOCK:
                   3029: +      SF_SET_PROCESS(symbolP); /* Will need processing before writing */
                   3030: +       case C_FCN:
                   3031: +      S_SET_SEGMENT(symbolP, C_TEXT_SECTION);
                   3032: +      break;
                   3033: +       case C_AUTO:
                   3034: +       case C_REG:
                   3035: +       case C_MOS: case C_MOE: case C_MOU:
                   3036: +       case C_ARG:
                   3037: +       case C_REGPARM:
                   3038: +       case C_FIELD:
                   3039: +       case C_EOS:
                   3040: +      SF_SET_DEBUG(symbolP);
                   3041: +      S_SET_SEGMENT(symbolP, C_ABS_SECTION);
                   3042: +      break;
                   3043: +       case C_EXT:
                   3044: +       case C_STAT:
                   3045: +      /* Valid but set somewhere else (s_comm, s_lcomm, colon) */
                   3046: +      break;
                   3047: +       case C_USTATIC:
                   3048: +       case C_EXTDEF:
                   3049: +       case C_LABEL:
                   3050: +       case C_ULABEL:
                   3051: +      as_warn("unexpected storage class %d", S_GET_STORAGE_CLASS(symbolP));
                   3052: +      break;
                   3053: +     }
                   3054: +     /* Now that we have build up a debug symbol, try to find if we should
                   3055: +        merge with an existing symbol or not. */
                   3056: +     /* If symbol does not exist, or symbol is a end function mark,
                   3057: +        or symbol is in debug or abs section,
                   3058: +        insert it in the list of symbols. */
                   3059: +     if(S_GET_STORAGE_CLASS(symbolP) == C_EFCN ||
                   3060: +        S_GET_SEGMENT(symbolP) == C_DEBUG_SECTION ||
                   3061: +        S_GET_SEGMENT(symbolP) == C_ABS_SECTION ||
                   3062: +        (symbolP = symbol_find_base(S_GET_NAME(symbolP), DO_NOT_STRIP)) ==
                   3063: +      (symbolS*)0) {
                   3064: + 
                   3065: +      symbolP = (symbolS *)obstack_alloc(&notes, sizeof(symbolS));
                   3066: +      memcpy((char*)symbolP, &symbol, sizeof(symbolS));
                   3067: + 
                   3068: +      DL_APPEND(symbolP, symbol_lastP);
                   3069: +      symbol_lastP = symbolP;
                   3070: + 
                   3071: +     } else {
                   3072: +      /* This symbol allready exists, merge the newly created symbol into
                   3073: +         the old one. This is not mandatory. The linker can handle
                   3074: +         duplicate symbols correctly. But I guess that it save a *lot*
                   3075: +         of space if the assembly file defines a lot of symbols. */
                   3076: +      /* The debug entry (symbol) is merged into symbolP. */
                   3077: +      c_symbol_merge(&symbol, symbolP);
                   3078: +      /* For the function, the symbol *must* be were the debug symbol
                   3079: +         appear. Move the existing symbol to the current place. */
                   3080: +      if(SF_GET_FUNCTION(symbolP)) {
                   3081: +          /* If it already is at the end of the symbol list, do nothing */
                   3082: +          if(symbolP != symbol_lastP) {
                   3083: +              DL_REMOVE(symbolP);
                   3084: +              DL_APPEND(symbolP, symbol_lastP);
                   3085: +              symbol_lastP = symbolP;
                   3086: +          }
                   3087: +      } else
                   3088: +          free(symbol_name_copy);
                   3089: +     }
                   3090: +     
                   3091: +     /* If symbol is a {structure,union} tag, associate symbol to its name. */
                   3092: +     if(SF_GET_TAG(symbolP))
                   3093: +      tag_insert(S_GET_NAME(symbolP), symbolP);
                   3094: + 
                   3095: +     /* Create the line number entry pointing on the function being defined */
                   3096: +     if(SF_GET_FUNCTION(symbolP)) {
                   3097: +      c_line_new((long)S_GET_NAME(symbolP), 0, &zero_address_frag);
                   3098: +      SF_SET_PROCESS(symbolP);
                   3099: +     }
                   3100: + }
                   3101: + 
                   3102: + /* 
                   3103: +  *  Maintain a list of the tagnames of the structres.
                   3104: +  */
                   3105: + 
                   3106: + static void
                   3107: + tag_init()
                   3108: + {
                   3109: +     tag_hash = hash_new();
                   3110: +     return ;
                   3111: + }
                   3112: + 
                   3113: + static void
                   3114: + tag_insert(name, symbolP)
                   3115: + char* name;
                   3116: + symbolS* symbolP;
                   3117: + {
                   3118: +     register char *  error_string;
                   3119: + 
                   3120: +     if(*(error_string = hash_jam (tag_hash, name, (char *)symbolP))) {
                   3121: +      as_fatal("Inserting \"%s\" into structure table failed: %s",
                   3122: +               name, error_string);
                   3123: +     }
                   3124: +     return ;
                   3125: + }
                   3126: + 
                   3127: + static symbolS*
                   3128: + tag_find(name)
                   3129: + char* name;
                   3130: + {
                   3131: + #if STRIP_UNDERSCORE
                   3132: +     if(*name == '_') name++;
                   3133: + #endif /* STRIP_UNDERSCORE */
                   3134: +     return((symbolS*)hash_find(tag_hash, name));
                   3135: + }
                   3136: + #else /* coff */
                   3137:   /*
                   3138:    *                   stab()
                   3139:    *
                   3140: ***************
                   3141: *** 1230,1237 ****
                   3142:                symbolP = symbol_new (string, 0,0,0,0,(struct frag *)0);
                   3143:                switch (what) {
                   3144:                case 'd':
                   3145: !                      symbolP->sy_name = NULL; /* .stabd feature. */
                   3146: !                      symbolP->sy_value = obstack_next_free(& frags) - frag_now->fr_literal;
                   3147:                        symbolP->sy_frag = frag_now;
                   3148:                        break;
                   3149:   
                   3150: --- 1595,1603 ----
                   3151:                symbolP = symbol_new (string, 0,0,0,0,(struct frag *)0);
                   3152:                switch (what) {
                   3153:                case 'd':
                   3154: !                      S_SET_NAME(symbolP,NULL); /* .stabd feature. */
                   3155: !                      S_SET_VALUE(symbolP,obstack_next_free(&frags) - 
                   3156: !                                  frag_now->fr_literal);
                   3157:                        symbolP->sy_frag = frag_now;
                   3158:                        break;
                   3159:   
                   3160: ***************
                   3161: *** 1257,1263 ****
                   3162:        }
                   3163:        if (! goof) {
                   3164:                if (get_absolute_expression_and_terminator (& longint) == ',')
                   3165: !                      symbolP->sy_other = longint;
                   3166:                else {
                   3167:                        as_warn( "I want a comma after the n_other expression" );
                   3168:                        goof = TRUE;
                   3169: --- 1623,1629 ----
                   3170:        }
                   3171:        if (! goof) {
                   3172:                if (get_absolute_expression_and_terminator (& longint) == ',')
                   3173: !                      S_SET_OTHER(symbolP,longint);
                   3174:                else {
                   3175:                        as_warn( "I want a comma after the n_other expression" );
                   3176:                        goof = TRUE;
                   3177: ***************
                   3178: *** 1265,1271 ****
                   3179:                }
                   3180:        }
                   3181:        if (! goof) {
                   3182: !              symbolP->sy_desc = get_absolute_expression ();
                   3183:                if (what == 's' || what == 'n') {
                   3184:                        if (* input_line_pointer != ',') {
                   3185:                                as_warn( "I want a comma after the n_desc expression" );
                   3186: --- 1631,1637 ----
                   3187:                }
                   3188:        }
                   3189:        if (! goof) {
                   3190: !              S_SET_DESC(symbolP, get_absolute_expression ());
                   3191:                if (what == 's' || what == 'n') {
                   3192:                        if (* input_line_pointer != ',') {
                   3193:                                as_warn( "I want a comma after the n_desc expression" );
                   3194: ***************
                   3195: *** 1284,1289 ****
                   3196: --- 1650,1656 ----
                   3197:        else
                   3198:                demand_empty_rest_of_line ();
                   3199:   }
                   3200: + #endif /* coff */
                   3201:   
                   3202:   /*
                   3203:    *                   pseudo_set()
                   3204: ***************
                   3205: *** 1302,1311 ****
                   3206:   {
                   3207:     expressionS        exp;
                   3208:     register segT      segment;
                   3209:     int ext;
                   3210:   
                   3211:     know( symbolP );           /* NULL pointer is logic error. */
                   3212: !   ext=(symbolP->sy_type&N_EXT);
                   3213:     if ((segment = expression( & exp )) == SEG_NONE)
                   3214:       {
                   3215:         as_warn( "Missing expression: absolute 0 assumed" );
                   3216: --- 1669,1682 ----
                   3217:   {
                   3218:     expressionS        exp;
                   3219:     register segT      segment;
                   3220: + #ifdef aout
                   3221:     int ext;
                   3222: + #endif /* aout */
                   3223:   
                   3224:     know( symbolP );           /* NULL pointer is logic error. */
                   3225: ! #ifdef aout
                   3226: !   ext=S_IS_EXTERNAL(symbolP);
                   3227: ! #endif /* aout */
                   3228:     if ((segment = expression( & exp )) == SEG_NONE)
                   3229:       {
                   3230:         as_warn( "Missing expression: absolute 0 assumed" );
                   3231: ***************
                   3232: *** 1317,1348 ****
                   3233:       case SEG_BIG:
                   3234:         as_warn( "%s number illegal. Absolute 0 assumed.",
                   3235:              exp . X_add_number > 0 ? "Bignum" : "Floating-Point" );
                   3236: !       symbolP -> sy_type = N_ABS | ext;
                   3237: !       symbolP -> sy_value = 0;
                   3238:         symbolP -> sy_frag = & zero_address_frag;
                   3239:         break;
                   3240:   
                   3241:       case SEG_NONE:
                   3242:         as_warn("No expression:  Using absolute 0");
                   3243: !       symbolP -> sy_type = N_ABS | ext;
                   3244: !       symbolP -> sy_value = 0;
                   3245:         symbolP -> sy_frag = & zero_address_frag;
                   3246:         break;
                   3247:   
                   3248:       case SEG_DIFFERENCE:
                   3249:         if (exp.X_add_symbol && exp.X_subtract_symbol
                   3250: !           &&    (exp.X_add_symbol->sy_type & N_TYPE)
                   3251: !           == (exp.X_subtract_symbol->sy_type & N_TYPE)) {
                   3252:        if(exp.X_add_symbol->sy_frag != exp.X_subtract_symbol->sy_frag) {
                   3253: !        as_bad("Unknown expression: symbols %s and %s are in different frags.",exp.X_add_symbol->sy_name, exp.X_subtract_symbol->sy_name);
                   3254:          need_pass_2++;
                   3255:        }
                   3256: !      exp.X_add_number+=exp.X_add_symbol->sy_value - exp.X_subtract_symbol->sy_value;
                   3257:         } else
                   3258:        as_warn( "Complex expression. Absolute segment assumed." );
                   3259:       case SEG_ABSOLUTE:
                   3260: !       symbolP -> sy_type = N_ABS | ext;
                   3261: !       symbolP -> sy_value = exp . X_add_number;
                   3262:         symbolP -> sy_frag = & zero_address_frag;
                   3263:         break;
                   3264:    
                   3265: --- 1688,1732 ----
                   3266:       case SEG_BIG:
                   3267:         as_warn( "%s number illegal. Absolute 0 assumed.",
                   3268:              exp . X_add_number > 0 ? "Bignum" : "Floating-Point" );
                   3269: !       S_SET_ABS(symbolP);
                   3270: ! #ifdef aout
                   3271: !       ext ? S_SET_EXTERNAL(symbolP) : 
                   3272: !          S_CLEAR_EXTERNAL(symbolP);
                   3273: ! #endif /* aout */
                   3274: !       S_SET_VALUE(symbolP, 0);
                   3275:         symbolP -> sy_frag = & zero_address_frag;
                   3276:         break;
                   3277:   
                   3278:       case SEG_NONE:
                   3279:         as_warn("No expression:  Using absolute 0");
                   3280: !       S_SET_ABS(symbolP);
                   3281: ! #ifdef aout
                   3282: !       ext ? S_SET_EXTERNAL(symbolP) : 
                   3283: !          S_CLEAR_EXTERNAL(symbolP);
                   3284: ! #endif /* aout */
                   3285: !       S_SET_VALUE(symbolP, 0);
                   3286:         symbolP -> sy_frag = & zero_address_frag;
                   3287:         break;
                   3288:   
                   3289:       case SEG_DIFFERENCE:
                   3290:         if (exp.X_add_symbol && exp.X_subtract_symbol
                   3291: !           && (S_GET_SEGMENT(exp.X_add_symbol) ==
                   3292: !            S_GET_SEGMENT(exp.X_subtract_symbol))) {
                   3293:        if(exp.X_add_symbol->sy_frag != exp.X_subtract_symbol->sy_frag) {
                   3294: !        as_bad("Unknown expression: symbols %s and %s are in different frags.",S_GET_NAME(exp.X_add_symbol), S_GET_NAME(exp.X_subtract_symbol));
                   3295:          need_pass_2++;
                   3296:        }
                   3297: !      exp.X_add_number+=S_GET_VALUE(exp.X_add_symbol) - 
                   3298: !          S_GET_VALUE(exp.X_subtract_symbol);
                   3299:         } else
                   3300:        as_warn( "Complex expression. Absolute segment assumed." );
                   3301:       case SEG_ABSOLUTE:
                   3302: !       S_SET_ABS(symbolP);
                   3303: ! #ifdef aout
                   3304: !       ext ? S_SET_EXTERNAL(symbolP) : 
                   3305: !          S_CLEAR_EXTERNAL(symbolP);
                   3306: ! #endif /* aout */
                   3307: !       S_SET_VALUE(symbolP, exp.X_add_number);
                   3308:         symbolP -> sy_frag = & zero_address_frag;
                   3309:         break;
                   3310:    
                   3311: ***************
                   3312: *** 1349,1356 ****
                   3313:       case SEG_DATA:
                   3314:       case SEG_TEXT:
                   3315:       case SEG_BSS:
                   3316: !       symbolP -> sy_type = seg_N_TYPE [(int) segment] | ext;
                   3317: !       symbolP -> sy_value= exp . X_add_number + exp . X_add_symbol -> sy_value;
                   3318:         symbolP -> sy_frag = exp . X_add_symbol -> sy_frag;
                   3319:         break;
                   3320:         
                   3321: --- 1733,1748 ----
                   3322:       case SEG_DATA:
                   3323:       case SEG_TEXT:
                   3324:       case SEG_BSS:
                   3325: !       switch(segment) {
                   3326: !      case SEG_DATA:    S_SET_DATA(symbolP); break;
                   3327: !      case SEG_TEXT:    S_SET_TEXT(symbolP); break;
                   3328: !      case SEG_BSS:     S_SET_BSS(symbolP); break;
                   3329: !       }
                   3330: ! #ifdef aout
                   3331: !       ext ? S_SET_EXTERNAL(symbolP) : 
                   3332: !          S_CLEAR_EXTERNAL(symbolP);
                   3333: ! #endif /* aout */
                   3334: !       S_SET_VALUE(symbolP, exp.X_add_number + S_GET_VALUE(exp.X_add_symbol));
                   3335:         symbolP -> sy_frag = exp . X_add_symbol -> sy_frag;
                   3336:         break;
                   3337:         
                   3338: ***************
                   3339: *** 1447,1454 ****
                   3340:          if ( segment == SEG_DIFFERENCE && exp . X_add_symbol == NULL )
                   3341:            {
                   3342:              as_warn( "Subtracting symbol \"%s\"(segment\"%s\") is too hard. Absolute segment assumed.",
                   3343: !                    exp . X_subtract_symbol -> sy_name,
                   3344: !                    seg_name [(int) N_TYPE_seg [exp . X_subtract_symbol -> sy_type & N_TYPE]]);
                   3345:              segment = SEG_ABSOLUTE;
                   3346:              /* Leave exp . X_add_number alone. */
                   3347:            }
                   3348: --- 1839,1846 ----
                   3349:          if ( segment == SEG_DIFFERENCE && exp . X_add_symbol == NULL )
                   3350:            {
                   3351:              as_warn( "Subtracting symbol \"%s\"(segment\"%s\") is too hard. Absolute segment assumed.",
                   3352: !               S_GET_NAME(exp.X_subtract_symbol),
                   3353: !               segment_name((int)SEG_seg(S_GET_SEGMENT(exp.X_subtract_symbol))));
                   3354:              segment = SEG_ABSOLUTE;
                   3355:              /* Leave exp . X_add_number alone. */
                   3356:            }
                   3357: ***************
                   3358: *** 1929,1936 ****
                   3359:     if (   (retval = get_segmented_expression (expP)) == SEG_UNKNOWN
                   3360:         )
                   3361:       {
                   3362: !       name1 = expP -> X_add_symbol ? expP -> X_add_symbol -> sy_name : "";
                   3363: !       name2 = expP -> X_subtract_symbol ? expP -> X_subtract_symbol -> sy_name : "";
                   3364:         if ( name1 && name2 )
                   3365:        {
                   3366:          as_warn("Symbols \"%s\" \"%s\" are undefined: absolute 0 assumed.",
                   3367: --- 2321,2330 ----
                   3368:     if (   (retval = get_segmented_expression (expP)) == SEG_UNKNOWN
                   3369:         )
                   3370:       {
                   3371: !       name1 = expP->X_add_symbol ? S_GET_NAME(expP->X_add_symbol) : "";
                   3372: !       name2 = expP->X_subtract_symbol ?
                   3373: !            S_GET_NAME(expP->X_subtract_symbol) :
                   3374: !                "";
                   3375:         if ( name1 && name2 )
                   3376:        {
                   3377:          as_warn("Symbols \"%s\" \"%s\" are undefined: absolute 0 assumed.",
                   3378: ***************
                   3379: *** 2064,2070 ****
                   3380:   equals(sym_name)
                   3381:   char *sym_name;
                   3382:   {
                   3383: !   register struct symbol * symbolP; /* symbol we are working with */
                   3384:   
                   3385:     if(sym_name[0]=='.' && sym_name[1]=='\0') {
                   3386:       /* Turn '. = mumble' into a .org mumble */
                   3387: --- 2458,2464 ----
                   3388:   equals(sym_name)
                   3389:   char *sym_name;
                   3390:   {
                   3391: !   register symbolS * symbolP; /* symbol we are working with */
                   3392:   
                   3393:     if(sym_name[0]=='.' && sym_name[1]=='\0') {
                   3394:       /* Turn '. = mumble' into a .org mumble */
                   3395: ***************
                   3396: *** 2082,2088 ****
                   3397:       if ( ! need_pass_2 ) {
                   3398:         if (segment != now_seg && segment != SEG_ABSOLUTE)
                   3399:           as_warn("Illegal segment \"%s\". Segment \"%s\" assumed.",
                   3400: !                 seg_name [(int) segment], seg_name [(int) now_seg]);
                   3401:         p = frag_var (rs_org, 1, 1, (relax_substateT)0, exp.X_add_symbol,
                   3402:                       exp.X_add_number, (char *)0);
                   3403:         * p = 0;
                   3404: --- 2476,2483 ----
                   3405:       if ( ! need_pass_2 ) {
                   3406:         if (segment != now_seg && segment != SEG_ABSOLUTE)
                   3407:           as_warn("Illegal segment \"%s\". Segment \"%s\" assumed.",
                   3408: !                 segment_name((int) segment),
                   3409: !              segment_name((int) now_seg));
                   3410:         p = frag_var (rs_org, 1, 1, (relax_substateT)0, exp.X_add_symbol,
                   3411:                       exp.X_add_number, (char *)0);
                   3412:         * p = 0;
                   3413: *** /lasvegas/spare/usenet/work/gas-1.37.genuine/./struc-symbol.h      Fri Jul  6 20:43:12 1990
                   3414: --- ./struc-symbol.h   Wed Nov  7 07:33:52 1990
                   3415: ***************
                   3416: *** 17,31 ****
                   3417:   along with GAS; see the file COPYING.  If not, write to
                   3418:   the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
                   3419:   
                   3420: - #ifndef              VMS
                   3421: - #include "a.out.gnu.h"               /* Needed to define struct nlist. Sigh. */
                   3422: - #else
                   3423: - #include "a_out.h"
                   3424: - #endif
                   3425: - 
                   3426:   struct symbol                        /* our version of an nlist node */
                   3427:   {
                   3428: !   struct nlist       sy_nlist;       /* what we write in .o file (if permitted) */
                   3429:     long unsigned sy_name_offset;      /* 4-origin position of sy_name in symbols */
                   3430:                                /* part of object file. */
                   3431:                                /* 0 for (nameless) .stabd symbols. */
                   3432: --- 17,25 ----
                   3433:   along with GAS; see the file COPYING.  If not, write to
                   3434:   the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
                   3435:   
                   3436:   struct symbol                        /* our version of an nlist node */
                   3437:   {
                   3438: !   symbol_type        sy_symbol;      /* what we write in .o file (if permitted) */
                   3439:     long unsigned sy_name_offset;      /* 4-origin position of sy_name in symbols */
                   3440:                                /* part of object file. */
                   3441:                                /* 0 for (nameless) .stabd symbols. */
                   3442: ***************
                   3443: *** 34,54 ****
                   3444:                                /* Symbol numbers start at 0 and are */
                   3445:                                /* unsigned. */
                   3446:     struct symbol * sy_next;   /* forward chain, or NULL */
                   3447:     struct frag *      sy_frag;        /* NULL or -> frag this symbol attaches to. */
                   3448:     struct symbol *sy_forward; /* value is really that of this other symbol */
                   3449:   };
                   3450:   
                   3451:   typedef struct symbol symbolS;
                   3452:   
                   3453: ! #define sy_name              sy_nlist .n_un. n_name
                   3454:                                /* Name field always points to a string. */
                   3455:                                /* 0 means .stabd-like anonymous symbol. */
                   3456: ! #define sy_type      sy_nlist.       n_type
                   3457: ! #define sy_other     sy_nlist.       n_other
                   3458: ! #define sy_desc              sy_nlist.       n_desc
                   3459: ! #define sy_value     sy_nlist.       n_value
                   3460:                                /* Value of symbol is this value + object */
                   3461:                                /* file address of sy_frag. */
                   3462:   
                   3463:   typedef unsigned valueT;     /* The type of n_value. Helps casting. */
                   3464:   
                   3465: --- 28,71 ----
                   3466:                                /* Symbol numbers start at 0 and are */
                   3467:                                /* unsigned. */
                   3468:     struct symbol * sy_next;   /* forward chain, or NULL */
                   3469: + #ifdef coff
                   3470: +   struct symbol * sy_previous;       /* backward chain, or NULL */
                   3471: + #endif /* coff */
                   3472:     struct frag *      sy_frag;        /* NULL or -> frag this symbol attaches to. */
                   3473:     struct symbol *sy_forward; /* value is really that of this other symbol */
                   3474: + #ifdef coff
                   3475: +   unsigned int sy_flags;     /* Internal use only flags (see coff.h) */
                   3476: +   AUXENT sy_auxent;          /* Auxiliary entry. */
                   3477: + #endif /* coff */
                   3478:   };
                   3479:   
                   3480:   typedef struct symbol symbolS;
                   3481:   
                   3482: ! #ifdef coff
                   3483: ! 
                   3484: ! #define sy_name              sy_symbol.n_name        /* Symbol name */
                   3485: ! #define sy_zeroes    sy_symbol.n_zeroes      /* All 0 if pointer to str. */
                   3486: ! #define sy_offset    sy_symbol.n_offset      /* Offset in string table */
                   3487: ! #define      sy_value        sy_symbol.n_value       /* Symbol 0 or ptr in file */
                   3488: ! #define sy_scnum     sy_symbol.n_scnum       /* Section number */
                   3489: ! #define sy_type              sy_symbol.n_type        /* Type and derived type */
                   3490: ! #define sy_sclass    sy_symbol.n_sclass      /* Storage class */
                   3491: ! #define sy_numaux    sy_symbol.n_numaux      /* Number of aux. entries */
                   3492: ! 
                   3493: ! #else /* coff */
                   3494: ! 
                   3495: ! #define sy_name              sy_symbol.n_un.n_name
                   3496:                                /* Name field always points to a string. */
                   3497:                                /* 0 means .stabd-like anonymous symbol. */
                   3498: ! #define sy_strx              sy_symbol.n_un.n_strx
                   3499: ! #define sy_type      sy_symbol.n_type
                   3500: ! #define sy_other     sy_symbol.n_other
                   3501: ! #define sy_desc              sy_symbol.n_desc
                   3502: ! #define sy_value     sy_symbol.n_value
                   3503:                                /* Value of symbol is this value + object */
                   3504:                                /* file address of sy_frag. */
                   3505: + 
                   3506: + #endif /* coff */
                   3507:   
                   3508:   typedef unsigned valueT;     /* The type of n_value. Helps casting. */
                   3509:   
                   3510: *** /lasvegas/spare/usenet/work/gas-1.37.genuine/./subsegs.c   Thu Oct 11 18:26:23 1990
                   3511: --- ./subsegs.c        Wed Nov  7 07:33:53 1990
                   3512: ***************
                   3513: *** 21,26 ****
                   3514: --- 21,27 ----
                   3515:    * Segments & sub-segments.
                   3516:    */
                   3517:   
                   3518: + #include "oformat.h"
                   3519:   #include "as.h"
                   3520:   #include "subsegs.h"
                   3521:   #include "obstack.h"
                   3522: ***************
                   3523: *** 33,38 ****
                   3524: --- 34,93 ----
                   3525:        *       data0_frchainP;
                   3526:   
                   3527:   
                   3528: + #ifdef coff
                   3529: +   const int                          /* in: segT   out: N_TYPE bits */
                   3530: +   seg_N_TYPE[] = {
                   3531: +   C_ABS_SECTION,
                   3532: +   C_TEXT_SECTION,
                   3533: +   C_DATA_SECTION,
                   3534: +   C_BSS_SECTION,
                   3535: +   C_UNDEF_SECTION,           /* SEG_UNKNOWN */
                   3536: +   C_UNDEF_SECTION,           /* SEG_NONE */
                   3537: +   C_UNDEF_SECTION,           /* SEG_PASS1 */
                   3538: +   C_UNDEF_SECTION,           /* SEG_GOOF */
                   3539: +   C_UNDEF_SECTION,           /* SEG_BIG */
                   3540: +   C_UNDEF_SECTION,           /* SEG_DIFFERENCE */
                   3541: +   C_DEBUG_SECTION,           /* SEG_DEBUG */
                   3542: +   C_NTV_SECTION,             /* SEG_NTV */
                   3543: +   C_PTV_SECTION,             /* SEG_PTV */
                   3544: + };
                   3545: + 
                   3546: + 
                   3547: + char * const                         /* in: segT   out: char* */
                   3548: + seg_name[] = {
                   3549: +   "absolute",
                   3550: +   "text",
                   3551: +   "data",
                   3552: +   "bss",
                   3553: +   "unknown",
                   3554: +   "absent",
                   3555: +   "pass1",
                   3556: +   "ASSEMBLER-INTERNAL-LOGIC-ERROR!",
                   3557: +   "bignum/flonum",
                   3558: +   "difference",
                   3559: +   "debug",
                   3560: +   "transfert vector preload",
                   3561: +   "transfert vector postload",
                   3562: +   ""
                   3563: +   };                         /* Used by error reporters, dumpers etc. */
                   3564: + 
                   3565: + /* Add 4 to the real value to get the index and compensate the negatives */
                   3566: + 
                   3567: + const segT N_TYPE_seg [32] =
                   3568: + {
                   3569: +   SEG_PTV,                   /* C_PTV_SECTION        == -4   */
                   3570: +   SEG_NTV,                   /* C_NTV_SECTION        == -3   */
                   3571: +   SEG_DEBUG,                 /* C_DEBUG_SECTION      == -2   */
                   3572: +   SEG_ABSOLUTE,                      /* C_ABS_SECTION        == -1   */
                   3573: +   SEG_UNKNOWN,                       /* C_UNDEF_SECTION      == 0    */
                   3574: +   SEG_TEXT,                  /* C_TEXT_SECTION       == 1    */
                   3575: +   SEG_DATA,                  /* C_DATA_SECTION       == 2    */
                   3576: +   SEG_BSS,                   /* C_BSS_SECTION        == 3    */
                   3577: +   SEG_GOOF,SEG_GOOF,SEG_GOOF,SEG_GOOF,SEG_GOOF,SEG_GOOF,SEG_GOOF,SEG_GOOF,
                   3578: +   SEG_GOOF,SEG_GOOF,SEG_GOOF,SEG_GOOF,SEG_GOOF,SEG_GOOF,SEG_GOOF,SEG_GOOF,
                   3579: +   SEG_GOOF,SEG_GOOF,SEG_GOOF,SEG_GOOF,SEG_GOOF,SEG_GOOF,SEG_GOOF,SEG_GOOF
                   3580: + };
                   3581: + #else /* coff */
                   3582:   const int                            /* in: segT   out: N_TYPE bits */
                   3583:   seg_N_TYPE[] = {
                   3584:     N_ABS,
                   3585: ***************
                   3586: *** 78,83 ****
                   3587: --- 133,139 ----
                   3588:     SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF,
                   3589:     SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF
                   3590:   };
                   3591: + #endif /* coff */
                   3592:   
                   3593:   void
                   3594:   subsegs_begin()
                   3595: *** /lasvegas/spare/usenet/work/gas-1.37.genuine/./symbols.c   Thu Oct 18 22:01:13 1990
                   3596: --- ./symbols.c        Wed Nov  7 07:33:55 1990
                   3597: ***************
                   3598: *** 18,23 ****
                   3599: --- 18,24 ----
                   3600:   the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
                   3601:   
                   3602:   
                   3603: + #include "oformat.h"
                   3604:   #include "as.h"
                   3605:   #include "hash.h"
                   3606:   #include "obstack.h"         /* For "symbols.h" */
                   3607: ***************
                   3608: *** 41,46 ****
                   3609: --- 42,52 ----
                   3610:   symbolS * symbol_rootP;
                   3611:   symbolS * symbol_lastP;
                   3612:   symbolS      abs_symbol;
                   3613: + 
                   3614: + symbolS*             dot_text_symbol;
                   3615: + symbolS*             dot_data_symbol;
                   3616: + symbolS*             dot_bss_symbol;
                   3617: + 
                   3618:   struct obstack       notes;
                   3619:   
                   3620:   
                   3621: ***************
                   3622: *** 87,93 ****
                   3623:     symbol_rootP = NULL;               /* In case we have 0 symbols (!!) */
                   3624:     sy_hash = hash_new();
                   3625:     bzero ((char *)(& abs_symbol), sizeof(abs_symbol));
                   3626: !   abs_symbol . sy_type = N_ABS;      /* Can't initialise a union. Sigh. */
                   3627:     bzero ((char *)(local_label_counter), sizeof(local_label_counter) );
                   3628:     local_bss_counter = 0;
                   3629:   }
                   3630: --- 93,99 ----
                   3631:     symbol_rootP = NULL;               /* In case we have 0 symbols (!!) */
                   3632:     sy_hash = hash_new();
                   3633:     bzero ((char *)(& abs_symbol), sizeof(abs_symbol));
                   3634: !   S_SET_ABS(&abs_symbol);    /* Can't initialise a union. Sigh. */
                   3635:     bzero ((char *)(local_label_counter), sizeof(local_label_counter) );
                   3636:     local_bss_counter = 0;
                   3637:   }
                   3638: ***************
                   3639: *** 160,165 ****
                   3640: --- 166,239 ----
                   3641:    * Changes since 1985: Symbol names may not contain '\0'. Sigh.
                   3642:    */
                   3643:   
                   3644: + #ifdef coff
                   3645: + 
                   3646: + symbolS *
                   3647: + symbol_new (name, segment, value, sclass, frag)
                   3648: + char*                name;   /* It is copied, the caller can destroy/modify */
                   3649: + segT         segment;/* Segment identifier (SEG_<something>) */
                   3650: + long         value;  /* Symbol value */
                   3651: + short                sclass; /* Symbol storage class */
                   3652: + fragS*               frag;   /* Associated fragment */
                   3653: + {
                   3654: +     register unsigned int    name_length;
                   3655: +     register char*           name_copy;
                   3656: +     register symbolS*                symbolP;
                   3657: +     register char            underscore = 0;      /* Symbol has leading _ */
                   3658: + 
                   3659: + #if STRIP_UNDERSCORE
                   3660: +     /* Remove leading underscore at the beginning of the symbol.
                   3661: +      * This is to be compatible with the standard librairies.
                   3662: +      */
                   3663: +     if(*name == '_') {
                   3664: +      underscore = 1;
                   3665: +      name++;
                   3666: +     } else
                   3667: +      underscore = 0;
                   3668: + #endif /* STRIP_UNDERSCORE */
                   3669: +     name_length = strlen(name) + 1; /* +1 for \0 */
                   3670: +     obstack_grow(&notes, name, name_length);
                   3671: +     name_copy = obstack_finish(&notes);
                   3672: +     symbolP = (symbolS *)obstack_alloc(&notes, sizeof(symbolS));
                   3673: +     
                   3674: +     /* Effective symbol */
                   3675: +     /* Store the pointer in the offset. */
                   3676: +     symbolP->sy_offset               = (long unsigned)name_copy;
                   3677: +     symbolP->sy_zeroes               = 0L;
                   3678: +     symbolP->sy_value                = value;
                   3679: +     symbolP->sy_scnum                = seg_SEG(segment);
                   3680: +     symbolP->sy_type         = T_NULL;
                   3681: +     symbolP->sy_sclass               = sclass;
                   3682: +     symbolP->sy_numaux               = 0;
                   3683: +     /* Additional information */
                   3684: +     symbolP->sy_next         = NULL;
                   3685: +     symbolP->sy_frag         = frag;
                   3686: +     symbolP->sy_forward              = NULL;
                   3687: +     symbolP->sy_name_offset  = ~0;
                   3688: +     symbolP->sy_number               = ~0;
                   3689: +     symbolP->sy_flags                = 0;
                   3690: +     /* Auxiliary entries */
                   3691: +     memset((char*)&symbolP->sy_auxent, '\0', AUXESZ);
                   3692: + 
                   3693: +     if(S_IS_STRING(symbolP))
                   3694: +      SF_SET_STRING(symbolP);
                   3695: +     if(!underscore && S_IS_LOCAL(symbolP))
                   3696: +      SF_SET_LOCAL(symbolP);
                   3697: +     /*
                   3698: +      * Link to end of symbol chain .
                   3699: +      */
                   3700: +     if (symbol_lastP) {
                   3701: +      DL_APPEND(symbolP, symbol_lastP);
                   3702: +     } else {
                   3703: +      symbol_rootP = symbolP;
                   3704: +     }
                   3705: +     symbol_lastP = symbolP;
                   3706: +     
                   3707: +     return (symbolP);
                   3708: + }
                   3709: + 
                   3710: + #else /* coff */
                   3711: + 
                   3712:   symbolS *
                   3713:   symbol_new (name, type, other, desc, value, frag)
                   3714:        char *          name;   /* We copy this: OK to alter your copy. */
                   3715: ***************
                   3716: *** 168,174 ****
                   3717:        short int               desc;   /* As in <a.out.h>. */
                   3718:        valueT          value;  /* As in <a.out.h>, often an address. */
                   3719:                                /* Often used as offset from frag address. */
                   3720: !      struct frag *   frag;   /* For sy_frag. */
                   3721:   {
                   3722:     register symbolS *         symbolP;
                   3723:     register char *            preserved_copy_of_name;
                   3724: --- 242,248 ----
                   3725:        short int               desc;   /* As in <a.out.h>. */
                   3726:        valueT          value;  /* As in <a.out.h>, often an address. */
                   3727:                                /* Often used as offset from frag address. */
                   3728: !      fragS*          frag;   /* For sy_frag. */
                   3729:   {
                   3730:     register symbolS *         symbolP;
                   3731:     register char *            preserved_copy_of_name;
                   3732: ***************
                   3733: *** 180,187 ****
                   3734:     p=obstack_finish(&notes);
                   3735:     /* obstack_1done( &notes, name, name_length, &p ); */
                   3736:     preserved_copy_of_name = p;
                   3737: !   p=obstack_alloc(&notes,sizeof(struct symbol));
                   3738: !   /* obstack_1blank( &notes, sizeof(struct symbol), &p ); */
                   3739:     symbolP                    = (symbolS *) p;
                   3740:     symbolP -> sy_name         = preserved_copy_of_name;
                   3741:     symbolP -> sy_type         = type;
                   3742: --- 254,261 ----
                   3743:     p=obstack_finish(&notes);
                   3744:     /* obstack_1done( &notes, name, name_length, &p ); */
                   3745:     preserved_copy_of_name = p;
                   3746: !   p=obstack_alloc(&notes,sizeof(symbolS));
                   3747: !   /* obstack_1blank( &notes, sizeof(symbolS), &p ); */
                   3748:     symbolP                    = (symbolS *) p;
                   3749:     symbolP -> sy_name         = preserved_copy_of_name;
                   3750:     symbolP -> sy_type         = type;
                   3751: ***************
                   3752: *** 210,215 ****
                   3753: --- 284,291 ----
                   3754:   
                   3755:     return (symbolP);
                   3756:   }
                   3757: + 
                   3758: + #endif /* coff */
                   3759:   
                   3760:   /*
                   3761:    *                   colon()
                   3762: ***************
                   3763: *** 225,231 ****
                   3764:        register char *  sym_name; /* symbol name, as a cannonical string */
                   3765:                                /* We copy this string: OK to alter later. */
                   3766:   {
                   3767: !   register struct symbol * symbolP; /* symbol we are working with */
                   3768:   
                   3769:   #ifdef SUN_ASM_SYNTAX
                   3770:     /* Sun local labes go out of scope whenever a non-local symbol is
                   3771: --- 301,307 ----
                   3772:        register char *  sym_name; /* symbol name, as a cannonical string */
                   3773:                                /* We copy this string: OK to alter later. */
                   3774:   {
                   3775: !   register symbolS * symbolP; /* symbol we are working with */
                   3776:   
                   3777:   #ifdef SUN_ASM_SYNTAX
                   3778:     /* Sun local labes go out of scope whenever a non-local symbol is
                   3779: ***************
                   3780: *** 267,273 ****
                   3781:          *     If the new symbol is .comm AND it has a size of zero,
                   3782:          *     we ignore it (i.e. the old symbol overrides it)
                   3783:          */
                   3784: !       if ((seg_N_TYPE [(int) now_seg] == (N_UNDF | N_EXT)) &&
                   3785:          ((obstack_next_free(& frags) - frag_now -> fr_literal) == 0))
                   3786:                return;
                   3787:         /*
                   3788: --- 343,349 ----
                   3789:          *     If the new symbol is .comm AND it has a size of zero,
                   3790:          *     we ignore it (i.e. the old symbol overrides it)
                   3791:          */
                   3792: !       if ((seg_SEG((int) now_seg) == (N_UNDF | N_EXT)) &&
                   3793:          ((obstack_next_free(& frags) - frag_now -> fr_literal) == 0))
                   3794:                return;
                   3795:         /*
                   3796: ***************
                   3797: *** 279,285 ****
                   3798:              symbolP -> sy_frag  = frag_now;
                   3799:              symbolP -> sy_other = const_flag;
                   3800:              symbolP -> sy_value = obstack_next_free(& frags) - frag_now -> fr_literal;
                   3801: !            symbolP -> sy_type |= seg_N_TYPE [(int) now_seg]; /* keep N_EXT bit */
                   3802:              return;
                   3803:         }
                   3804:   #endif       /* VMS */
                   3805: --- 355,361 ----
                   3806:              symbolP -> sy_frag  = frag_now;
                   3807:              symbolP -> sy_other = const_flag;
                   3808:              symbolP -> sy_value = obstack_next_free(& frags) - frag_now -> fr_literal;
                   3809: !            symbolP -> sy_type |= seg_SEG((int) now_seg); /* keep N_EXT bit */
                   3810:              return;
                   3811:         }
                   3812:   #endif       /* VMS */
                   3813: ***************
                   3814: *** 286,304 ****
                   3815:         /*
                   3816:          *     Now check for undefined symbols
                   3817:          */
                   3818: !       if ((symbolP -> sy_type & N_TYPE) == N_UNDF)
                   3819:        {
                   3820: !        if(   symbolP -> sy_other == 0
                   3821: !           && symbolP -> sy_desc  == 0
                   3822: !           && symbolP -> sy_value == 0)
                   3823:            {
                   3824:              symbolP -> sy_frag  = frag_now;
                   3825:   #ifdef VMS
                   3826:                symbolP -> sy_other = const_flag;
                   3827:   #endif
                   3828: !            symbolP -> sy_value = obstack_next_free(& frags) - frag_now -> fr_literal;
                   3829: !            know( N_UNDF == 0 );
                   3830: !            symbolP -> sy_type |= seg_N_TYPE [(int) now_seg]; /* keep N_EXT bit */
                   3831:            }
                   3832:          else
                   3833:            {
                   3834: --- 362,388 ----
                   3835:         /*
                   3836:          *     Now check for undefined symbols
                   3837:          */
                   3838: !       if (!S_IS_DEFINED(symbolP))
                   3839:        {
                   3840: !        if(
                   3841: ! #ifdef aout
                   3842: !           S_GET_OTHER(symbolP) == 0 &&
                   3843: !           S_GET_DESC(symbolP)  == 0 &&
                   3844: ! #endif /* aout */
                   3845: !           S_GET_VALUE(symbolP) == 0)
                   3846:            {
                   3847:              symbolP -> sy_frag  = frag_now;
                   3848:   #ifdef VMS
                   3849:                symbolP -> sy_other = const_flag;
                   3850:   #endif
                   3851: !            S_SET_VALUE(symbolP, obstack_next_free(& frags) - 
                   3852: !                                 frag_now -> fr_literal);
                   3853: !            switch(now_seg) {
                   3854: !              case SEG_TEXT: S_SET_TEXT(symbolP); break;
                   3855: !              case SEG_DATA: S_SET_DATA(symbolP); break;
                   3856: !              case SEG_BSS: S_SET_BSS(symbolP); break;
                   3857: !              case SEG_ABSOLUTE: S_SET_ABS(symbolP); break;
                   3858: !            }
                   3859:            }
                   3860:          else
                   3861:            {
                   3862: ***************
                   3863: *** 310,316 ****
                   3864:               *                A .comm/.lcomm symbol being redefined with
                   3865:               *                        a larger size is also OK
                   3866:               */
                   3867: !            char New_Type = seg_N_TYPE [(int) now_seg];
                   3868:              if (((symbolP->sy_type == (N_UNDF | N_EXT)) ||
                   3869:                   (symbolP->sy_type == N_BSS)) &&
                   3870:                  (((New_Type & ~N_EXT) == N_DATA) ||
                   3871: --- 394,400 ----
                   3872:               *                A .comm/.lcomm symbol being redefined with
                   3873:               *                        a larger size is also OK
                   3874:               */
                   3875: !            char New_Type = seg_SEG((int) now_seg);
                   3876:              if (((symbolP->sy_type == (N_UNDF | N_EXT)) ||
                   3877:                   (symbolP->sy_type == N_BSS)) &&
                   3878:                  (((New_Type & ~N_EXT) == N_DATA) ||
                   3879: ***************
                   3880: *** 339,353 ****
                   3881:                                symbolP -> sy_frag  = frag_now;
                   3882:                                symbolP -> sy_other = const_flag;
                   3883:                                symbolP -> sy_value = obstack_next_free(& frags) - frag_now -> fr_literal;
                   3884: !                              symbolP -> sy_type |= seg_N_TYPE [(int) now_seg]; /* keep N_EXT bit */
                   3885:                        }
                   3886:              } else {
                   3887:   #endif       /* VMS */
                   3888:              as_fatal( "Symbol \"%s\" is already defined as \"%s\"/%d.%d.%d.",
                   3889:                      sym_name,
                   3890: !                    seg_name [(int) N_TYPE_seg [symbolP -> sy_type & N_TYPE]],
                   3891: !                    symbolP -> sy_other, symbolP -> sy_desc,
                   3892: !                    symbolP -> sy_value);
                   3893:   #ifdef       VMS
                   3894:                }
                   3895:   #endif       /* VMS */
                   3896: --- 423,444 ----
                   3897:                                symbolP -> sy_frag  = frag_now;
                   3898:                                symbolP -> sy_other = const_flag;
                   3899:                                symbolP -> sy_value = obstack_next_free(& frags) - frag_now -> fr_literal;
                   3900: !                              symbolP -> sy_type |= seg_SEG((int) now_seg); /* keep N_EXT bit */
                   3901:                        }
                   3902:              } else {
                   3903:   #endif       /* VMS */
                   3904: + #ifdef coff
                   3905: +            as_fatal( "Symbol \"%s\" is already defined as \"%s\"/%d.",
                   3906: +                    sym_name,
                   3907: +                    segment_name((int)SEG_seg(S_GET_SEGMENT(symbolP))),
                   3908: +                    S_GET_VALUE(symbolP));
                   3909: + #else /* coff */
                   3910:              as_fatal( "Symbol \"%s\" is already defined as \"%s\"/%d.%d.%d.",
                   3911:                      sym_name,
                   3912: !                    segment_name((int)SEG_seg(S_GET_SEGMENT(symbolP))),
                   3913: !                    S_GET_OTHER(symbolP), S_GET_DESC(symbolP),
                   3914: !                    S_GET_VALUE(symbolP));
                   3915: ! #endif /* coff */
                   3916:   #ifdef       VMS
                   3917:                }
                   3918:   #endif       /* VMS */
                   3919: ***************
                   3920: *** 360,367 ****
                   3921:       }
                   3922:     else
                   3923:       {
                   3924:         symbolP = symbol_new (sym_name,
                   3925: !                          (unsigned char)(seg_N_TYPE [(int) now_seg]),
                   3926:   #ifdef VMS
                   3927:                            const_flag,
                   3928:   #else
                   3929: --- 451,463 ----
                   3930:       }
                   3931:     else
                   3932:       {
                   3933: + #ifdef coff
                   3934: +       symbolP = symbol_new (sym_name, now_seg, 
                   3935: +                          (valueT)(obstack_next_free(&frags)-frag_now->fr_literal),
                   3936: +                          0, frag_now);
                   3937: + #else /* coff */
                   3938:         symbolP = symbol_new (sym_name,
                   3939: !                          (unsigned char)(seg_SEG((int) now_seg)),
                   3940:   #ifdef VMS
                   3941:                            const_flag,
                   3942:   #else
                   3943: ***************
                   3944: *** 370,375 ****
                   3945: --- 466,472 ----
                   3946:                            0,
                   3947:                            (valueT)(obstack_next_free(&frags)-frag_now->fr_literal),
                   3948:                            frag_now);
                   3949: + #endif /* coff */
                   3950:         symbol_table_insert (symbolP);
                   3951:       }
                   3952:   }
                   3953: ***************
                   3954: *** 384,399 ****
                   3955:   
                   3956:   void
                   3957:   symbol_table_insert (symbolP)
                   3958: !      struct symbol * symbolP;
                   3959:   {
                   3960:     register char *    error_string;
                   3961:   
                   3962: !   know( symbolP );
                   3963: !   know( symbolP -> sy_name );
                   3964: !   if ( * (error_string = hash_jam (sy_hash, symbolP -> sy_name, (char *)symbolP)))
                   3965:       {
                   3966:         as_fatal( "Inserting \"%s\" into symbol table failed: %s",
                   3967: !            symbolP -> sy_name, error_string);
                   3968:       }
                   3969:   }
                   3970:   
                   3971: --- 481,498 ----
                   3972:   
                   3973:   void
                   3974:   symbol_table_insert (symbolP)
                   3975: !      symbolS *       symbolP;
                   3976:   {
                   3977:     register char *    error_string;
                   3978:   
                   3979: !   know(symbolP);
                   3980: !   know(S_GET_NAME(symbolP));
                   3981: ! 
                   3982: !   if ( * (error_string = hash_jam (sy_hash, S_GET_NAME(symbolP),
                   3983: !                                 (char *)symbolP)))
                   3984:       {
                   3985:         as_fatal( "Inserting \"%s\" into symbol table failed: %s",
                   3986: !            S_GET_NAME(symbolP), error_string);
                   3987:       }
                   3988:   }
                   3989:   
                   3990: ***************
                   3991: *** 404,421 ****
                   3992:    * it into the symbol table. Return a pointer to it.
                   3993:    */
                   3994:   symbolS *
                   3995: ! symbol_find_or_make (name)
                   3996: !      char *  name;
                   3997:   {
                   3998: !   register symbolS * symbolP;
                   3999:   
                   4000: !   symbolP = symbol_table_lookup (name);
                   4001: !   if (symbolP == NULL)
                   4002: !     {
                   4003: !       symbolP = symbol_new (name, N_UNDF, 0, 0, 0, & zero_address_frag);
                   4004: !       symbol_table_insert (symbolP);
                   4005: !     }
                   4006: !   return (symbolP);
                   4007:   }
                   4008:   
                   4009:   /*
                   4010: --- 503,525 ----
                   4011:    * it into the symbol table. Return a pointer to it.
                   4012:    */
                   4013:   symbolS *
                   4014: !     symbol_find_or_make (name)
                   4015: ! char *       name;
                   4016:   {
                   4017: !     register symbolS *       symbolP;
                   4018:   
                   4019: !     symbolP = symbol_table_lookup (name);
                   4020: ! 
                   4021: !     if (symbolP == NULL)
                   4022: !      {
                   4023: ! #ifdef coff 
                   4024: !          symbolP = symbol_new (name, SEG_UNKNOWN, 0, 0, &zero_address_frag);
                   4025: ! #else /* coff */
                   4026: !          symbolP = symbol_new (name, N_UNDF, 0, 0, 0, & zero_address_frag);
                   4027: ! #endif /* coff */
                   4028: !          symbol_table_insert (symbolP);
                   4029: !      }
                   4030: !     return (symbolP);
                   4031:   }
                   4032:   
                   4033:   /*
                   4034: ***************
                   4035: *** 429,438 ****
                   4036:   
                   4037:   symbolS *
                   4038:   symbol_find (name)
                   4039: !      char *  name;
                   4040:   {
                   4041: !   return ( (symbolS *) hash_find( sy_hash, name ));
                   4042:   }
                   4043:   
                   4044:   
                   4045:   /* end: symbols.c */
                   4046: --- 533,550 ----
                   4047:   
                   4048:   symbolS *
                   4049:   symbol_find (name)
                   4050: ! char* name;
                   4051:   {
                   4052: !     return symbol_find_base(name, STRIP_UNDERSCORE);
                   4053:   }
                   4054:   
                   4055: + symbolS *
                   4056: + symbol_find_base (name, strip_underscore)
                   4057: +      char *  name;
                   4058: + int strip_underscore;
                   4059: + {
                   4060: +     if(strip_underscore && *name == '_') name++;
                   4061: +     return ( (symbolS *) hash_find( sy_hash, name ));
                   4062: + }
                   4063:   
                   4064:   /* end: symbols.c */
                   4065: *** /lasvegas/spare/usenet/work/gas-1.37.genuine/./symbols.h   Wed Mar  1 23:48:43 1989
                   4066: --- ./symbols.h        Wed Nov  7 07:33:56 1990
                   4067: ***************
                   4068: *** 30,36 ****
                   4069: --- 30,41 ----
                   4070:   
                   4071:   extern symbolS       abs_symbol;
                   4072:   
                   4073: + extern symbolS*              dot_text_symbol;
                   4074: + extern symbolS*              dot_data_symbol;
                   4075: + extern symbolS*              dot_bss_symbol;
                   4076: + 
                   4077:   symbolS *    symbol_find();
                   4078: + symbolS *    symbol_find_base();
                   4079:   void         symbol_begin();
                   4080:   char *               local_label_name();
                   4081:   void         local_colon();
                   4082: *** /lasvegas/spare/usenet/work/gas-1.37.genuine/./write.c     Thu Oct 11 18:26:15 1990
                   4083: --- ./write.c  Wed Nov  7 07:41:02 1990
                   4084: ***************
                   4085: *** 30,35 ****
                   4086: --- 30,36 ----
                   4087:      trouble.
                   4088:    */
                   4089:   
                   4090: + #include "oformat.h"
                   4091:   #include "as.h"
                   4092:   #include "md.h"
                   4093:   #include "subsegs.h"
                   4094: ***************
                   4095: *** 37,42 ****
                   4096: --- 38,47 ----
                   4097:   #include "struc-symbol.h"
                   4098:   #include "write.h"
                   4099:   #include "symbols.h"
                   4100: + #include "append.h"
                   4101: + #ifdef coff
                   4102: + #include <sys/types.h>
                   4103: + #endif /* coff */
                   4104:   
                   4105:   #ifdef SPARC
                   4106:   #include "sparc.h"
                   4107: ***************
                   4108: *** 45,74 ****
                   4109:   #include "i860.h"
                   4110:   #endif
                   4111:   
                   4112: - void append();
                   4113: - 
                   4114:   #ifdef hpux
                   4115:   #define EXEC_MACHINE_TYPE HP9000S200_ID
                   4116:   #endif
                   4117:   
                   4118: ! #ifdef DOT_LABEL_PREFIX
                   4119: ! #define LOCAL_LABEL(name) (name[0] =='.' \
                   4120: !                          && ( name [1] == 'L' || name [1] == '.' ))
                   4121: ! #else  /* not defined DOT_LABEL_PREFIX */
                   4122: ! #define LOCAL_LABEL(name) (name [0] == 'L' )
                   4123: ! #endif /* not defined DOT_LABEL_PREFIX */
                   4124: ! 
                   4125: ! /*
                   4126: !  * In: length of relocation (or of address) in chars: 1, 2 or 4.
                   4127: !  * Out: GNU LD relocation length code: 0, 1, or 2.
                   4128: !  */
                   4129: ! 
                   4130: ! static unsigned char
                   4131: ! 
                   4132: ! nbytes_r_length [] = {
                   4133: !   42, 0, 1, 42, 2
                   4134: !   };
                   4135: ! 
                   4136:   
                   4137:   static struct frag * text_frag_root;
                   4138:   static struct frag * data_frag_root;
                   4139: --- 50,62 ----
                   4140:   #include "i860.h"
                   4141:   #endif
                   4142:   
                   4143:   #ifdef hpux
                   4144:   #define EXEC_MACHINE_TYPE HP9000S200_ID
                   4145:   #endif
                   4146:   
                   4147: ! #ifdef coff
                   4148: ! extern time_t                time();
                   4149: ! #endif /* coff */
                   4150:   
                   4151:   static struct frag * text_frag_root;
                   4152:   static struct frag * data_frag_root;
                   4153: ***************
                   4154: *** 76,94 ****
                   4155:   static struct frag * text_last_frag; /* Last frag in segment. */
                   4156:   static struct frag * data_last_frag; /* Last frag in segment. */
                   4157:   
                   4158: ! static struct exec   the_exec;
                   4159:   
                   4160:   static long int string_byte_count;
                   4161:   
                   4162:   static char *                the_object_file;
                   4163:   
                   4164: - #if !defined(SPARC) && !defined(I860)
                   4165: - static
                   4166: - #endif
                   4167:   char *               next_object_file_charP; /* Tracks object file bytes. */
                   4168:   
                   4169: - static long int              size_of_the_object_file; /* # bytes in object file. */
                   4170: - 
                   4171:   /* static long int           length; JF unused */    /* String length, including trailing '\0'. */
                   4172:   
                   4173:   static void  relax_segment();
                   4174: --- 64,77 ----
                   4175:   static struct frag * text_last_frag; /* Last frag in segment. */
                   4176:   static struct frag * data_last_frag; /* Last frag in segment. */
                   4177:   
                   4178: ! static object_headers        headers;
                   4179:   
                   4180:   static long int string_byte_count;
                   4181:   
                   4182:   static char *                the_object_file;
                   4183:   
                   4184:   char *               next_object_file_charP; /* Tracks object file bytes. */
                   4185:   
                   4186:   /* static long int           length; JF unused */    /* String length, including trailing '\0'. */
                   4187:   
                   4188:   static void  relax_segment();
                   4189: ***************
                   4190: *** 95,103 ****
                   4191:   void         emit_segment();
                   4192:   static relax_addressT        relax_align();
                   4193:   static long int      fixup_segment();
                   4194: - #if !defined(SPARC) && !defined(I860)
                   4195: - static void          emit_relocations();
                   4196: - #endif
                   4197:   /*
                   4198:    *                   fix_new()
                   4199:    *
                   4200: --- 78,83 ----
                   4201: ***************
                   4202: *** 154,160 ****
                   4203:     register struct frchain *  next_frchainP;
                   4204:     register fragS * *         prev_fragPP;
                   4205:     register char *            name;
                   4206: !   register symbolS *         symbolP;
                   4207:     register symbolS **                symbolPP;
                   4208:     /* register fixS *         fixP; JF unused */
                   4209:     unsigned
                   4210: --- 134,140 ----
                   4211:     register struct frchain *  next_frchainP;
                   4212:     register fragS * *         prev_fragPP;
                   4213:     register char *            name;
                   4214: !   symbolS *                  symbolP;
                   4215:     register symbolS **                symbolPP;
                   4216:     /* register fixS *         fixP; JF unused */
                   4217:     unsigned
                   4218: ***************
                   4219: *** 163,168 ****
                   4220: --- 143,155 ----
                   4221:        syms_siz,
                   4222:        tr_siz,
                   4223:        dr_siz;
                   4224: + #ifdef coff
                   4225: +   SCNHDR                     text_section_header;
                   4226: +   SCNHDR                     data_section_header;
                   4227: +   SCNHDR                     bss_section_header;
                   4228: +   symbolS*                   last_functionP = (symbolS*)0;
                   4229: +   symbolS*                   last_tagP;
                   4230: + #endif /* coff */
                   4231:     void output_file_create();
                   4232:     void output_file_append();
                   4233:     void output_file_close();
                   4234: ***************
                   4235: *** 170,178 ****
                   4236: --- 157,171 ----
                   4237:     void gdb_emit();
                   4238:     void gdb_end();
                   4239:   #endif
                   4240: +   long int object_file_size;
                   4241:     extern long omagic;                /* JF magic # to write out.  Is different for
                   4242:                                   Suns and Vaxen and other boxes */
                   4243:   
                   4244: + #ifdef coff
                   4245: +   /* Initialize the stack used to keep track of the matching .bb .be */
                   4246: +   stack* block_stack = stack_init(512, sizeof(symbolS*));
                   4247: + #endif /* coff */
                   4248: + 
                   4249:   #ifdef       VMS
                   4250:     /*
                   4251:      * Under VMS we try to be compatible with VAX-11 "C".  Thus, we
                   4252: ***************
                   4253: *** 271,283 ****
                   4254:      */
                   4255:   
                   4256:     know(   text_last_frag -> fr_type   == rs_fill && text_last_frag -> fr_offset == 0 );
                   4257: !   text_siz=text_last_frag->fr_address;
                   4258:   #ifdef SPARC
                   4259: !   text_siz= (text_siz+7)&(~7);
                   4260: !   text_last_frag->fr_address=text_siz;
                   4261:   #endif
                   4262: -   md_number_to_chars((char *)&the_exec.a_text,text_siz, sizeof(the_exec.a_text));
                   4263: -   /* the_exec . a_text = text_last_frag -> fr_address; */
                   4264:   
                   4265:     /*
                   4266:      * Join the 2 segments into 1 huge segment.
                   4267: --- 264,275 ----
                   4268:      */
                   4269:   
                   4270:     know(   text_last_frag -> fr_type   == rs_fill && text_last_frag -> fr_offset == 0 );
                   4271: !   H_SET_TEXT_SIZE(&headers,text_last_frag->fr_address);
                   4272:   #ifdef SPARC
                   4273: !   H_SET_TEXT_SIZE(&headers,H_GET_TEXT_SIZE(&headers) + 
                   4274: !                         (H_GET_TEXT_SIZE(&headers)+7)&(~7));
                   4275: !   text_last_frag->fr_address=H_GET_TEXT_SIZE(&headers);
                   4276:   #endif
                   4277:   
                   4278:     /*
                   4279:      * Join the 2 segments into 1 huge segment.
                   4280: ***************
                   4281: *** 291,304 ****
                   4282:         register relax_addressT        slide;
                   4283:   
                   4284:         know(   text_last_frag -> fr_type   == rs_fill && text_last_frag -> fr_offset == 0 );
                   4285: !       data_siz=data_last_frag->fr_address;
                   4286:   #ifdef SPARC
                   4287: !       data_siz += (8 - (data_siz % 8)) % 8;
                   4288: !       data_last_frag->fr_address = data_siz;
                   4289:   #endif
                   4290: !       md_number_to_chars((char *)&the_exec.a_data,data_siz,sizeof(the_exec.a_data));
                   4291: !       /* the_exec . a_data = data_last_frag -> fr_address; */
                   4292: !       slide = text_siz; /* Address in file of the data segment. */
                   4293:         for (fragP = data_frag_root;
                   4294:           fragP;
                   4295:           fragP = fragP -> fr_next)
                   4296: --- 283,295 ----
                   4297:         register relax_addressT        slide;
                   4298:   
                   4299:         know(   text_last_frag -> fr_type   == rs_fill && text_last_frag -> fr_offset == 0 );
                   4300: !       H_SET_DATA_SIZE(&headers,data_last_frag->fr_address);
                   4301:   #ifdef SPARC
                   4302: !       H_SET_DATA_SIZE(&headers,(H_GET_DATA_SIZE(&headers) + 
                   4303: !                              (8 - (H_GET_DATA_SIZE(&headers) % 8)) % 8));
                   4304: !       data_last_frag->fr_address = H_GET_DATA_SIZE(&headers);
                   4305:   #endif
                   4306: !       slide = H_GET_TEXT_SIZE(&headers); /* & in file of the data segment. */
                   4307:         for (fragP = data_frag_root;
                   4308:           fragP;
                   4309:           fragP = fragP -> fr_next)
                   4310: ***************
                   4311: *** 308,324 ****
                   4312:         know( text_last_frag );
                   4313:         text_last_frag -> fr_next = data_frag_root;
                   4314:       }
                   4315: !   else {
                   4316: !       md_number_to_chars((char *)&the_exec.a_data,0,sizeof(the_exec.a_data));
                   4317: !       data_siz = 0;
                   4318: !   }
                   4319:   
                   4320: !   bss_address_frag . fr_address = text_siz + data_siz;
                   4321:   #ifdef SPARC
                   4322:     local_bss_counter=(local_bss_counter+7)&(~7);
                   4323:   #endif
                   4324: !   md_number_to_chars((char *)&the_exec.a_bss,local_bss_counter,sizeof(the_exec.a_bss));
                   4325: ! 
                   4326:              
                   4327:     /*
                   4328:      *
                   4329: --- 299,313 ----
                   4330:         know( text_last_frag );
                   4331:         text_last_frag -> fr_next = data_frag_root;
                   4332:       }
                   4333: !   else
                   4334: !       H_SET_DATA_SIZE(&headers,0);
                   4335:   
                   4336: !   bss_address_frag . fr_address = H_GET_TEXT_SIZE(&headers) + 
                   4337: !                                   H_GET_DATA_SIZE(&headers);
                   4338:   #ifdef SPARC
                   4339:     local_bss_counter=(local_bss_counter+7)&(~7);
                   4340:   #endif
                   4341: !   H_SET_BSS_SIZE(&headers,local_bss_counter);
                   4342:              
                   4343:     /*
                   4344:      *
                   4345: ***************
                   4346: *** 347,390 ****
                   4347:     for(symbolP=symbol_rootP;symbolP;symbolP=symbolP->sy_next) {
                   4348:        if(symbolP->sy_forward) {
                   4349:                symbolP->sy_value+=symbolP->sy_forward->sy_value+symbolP->sy_forward->sy_frag->fr_address;
                   4350:                symbolP->sy_forward=0;
                   4351:        }
                   4352:     }
                   4353: !   symbolPP = & symbol_rootP; /* -> last symbol chain link. */
                   4354:     {
                   4355: !     register long int                symbol_number;
                   4356:   
                   4357: !     symbol_number = 0;
                   4358:       while (symbolP  = * symbolPP)
                   4359:         {
                   4360: !      name = symbolP -> sy_name;
                   4361: !      if(flagseen['R'] && (symbolP->sy_nlist.n_type&N_DATA)) {
                   4362: !        symbolP->sy_nlist.n_type&= ~N_DATA;
                   4363: !        symbolP->sy_nlist.n_type|= N_TEXT;
                   4364: !      }
                   4365: !      /* if(symbolP->sy_forward) {
                   4366: !        symbolP->sy_value += symbolP->sy_forward->sy_value + symbolP->sy_forward->sy_frag->fr_address;
                   4367: !      } */
                   4368:        
                   4369:        symbolP -> sy_value += symbolP -> sy_frag -> fr_address;
                   4370: -              /* JF the 128 bit is a hack so stabs like
                   4371: -                 "LET_STMT:23. . ."  don't go away */
                   4372: -      /* CPH: 128 bit hack is moby loser.  N_SO for file "Lower.c"
                   4373: -         fell through the cracks.  I think that N_STAB should be
                   4374: -         used instead of 128. */
                   4375:                /* JF the \001 bit is to make sure that local labels
                   4376:                   ( 1: - 9: don't make it into the symtable either */
                   4377:   #ifndef      VMS     /* Under VMS we need to keep local symbols */
                   4378: !      if ( !name || (symbolP->sy_nlist.n_type&N_STAB)
                   4379: !          || (name[2]!='\001' && (flagseen ['L'] || ! LOCAL_LABEL(name) )))
                   4380:   #endif       /* not VMS */
                   4381:          {
                   4382: -          symbolP -> sy_number = symbol_number ++;
                   4383:   #ifndef      VMS
                   4384: !          if (name)
                   4385:              {                 /* Ordinary case. */
                   4386:                symbolP -> sy_name_offset = string_byte_count;
                   4387: !              string_byte_count += strlen (symbolP  -> sy_name) + 1;
                   4388:              }
                   4389:            else                        /* .Stabd case. */
                   4390:   #endif       /* not VMS */
                   4391: --- 336,582 ----
                   4392:     for(symbolP=symbol_rootP;symbolP;symbolP=symbolP->sy_next) {
                   4393:        if(symbolP->sy_forward) {
                   4394:                symbolP->sy_value+=symbolP->sy_forward->sy_value+symbolP->sy_forward->sy_frag->fr_address;
                   4395: + #ifdef coff
                   4396: +              if(SF_GET_GET_SEGMENT(symbolP) &&
                   4397: +                 S_GET_SEGMENT(symbolP) == seg_SEG(SEG_UNKNOWN))
                   4398: +                  S_SET_SEGMENT(symbolP, S_GET_SEGMENT(symbolP->sy_forward));
                   4399: + #endif /* coff */
                   4400:                symbolP->sy_forward=0;
                   4401:        }
                   4402:     }
                   4403: ! 
                   4404:     {
                   4405: !       register int   symbol_number = 0;
                   4406: ! #if defined(coff)
                   4407: !       symbolS*               symbol_externP = (symbolS*)0;
                   4408: !       symbolS*               symbol_extern_lastP = (symbolS*)0;
                   4409: !       
                   4410: !   /* The symbol list should be ordered according to the following sequence
                   4411: !    * order :
                   4412: !    * . .file symbol
                   4413: !    * . debug entries for functions
                   4414: !    * . fake symbols for .text .data and .bss
                   4415: !    * . defined symbols
                   4416: !    * . undefined symbols
                   4417: !    * But this is not mandatory. The only important point is to put the
                   4418: !    * undefined symbols at the end of the list.
                   4419: !    */
                   4420: ! 
                   4421: !       {
                   4422: !        /* Is there a .file symbol ? If not insert one at the beginning. */
                   4423: !        if(symbol_rootP == NULL ||
                   4424: !           S_GET_STORAGE_CLASS(symbol_rootP) != C_FILE)
                   4425: !            c_dot_file_symbol("fake");
                   4426: !        
                   4427: !        /*
                   4428: !         * Build up static symbols for .text, .data and .bss
                   4429: !         */
                   4430: !        dot_text_symbol = (symbolS*)
                   4431: !            c_section_symbol(".text", 0, H_GET_TEXT_SIZE(&headers),
                   4432: !                       0/*text_relocation_number*/, 0/*text_lineno_number*/);
                   4433: !        dot_data_symbol = (symbolS*)
                   4434: !            c_section_symbol(".data", H_GET_TEXT_SIZE(&headers),
                   4435: !                      H_GET_DATA_SIZE(&headers),
                   4436: !                      0/*data_relocation_number*/,
                   4437: !                      0); /* There is no data lineno entries */
                   4438: !        dot_bss_symbol = (symbolS*)
                   4439: !            c_section_symbol(".bss", H_GET_TEXT_SIZE(&headers) +
                   4440: !                      H_GET_DATA_SIZE(&headers),
                   4441: !                      H_GET_BSS_SIZE(&headers),
                   4442: !                      0, /* No relocation for a bss section. */
                   4443: !                      0); /* There is no bss lineno entries */
                   4444: !       }
                   4445: !            
                   4446: !       symbolP = symbol_rootP;
                   4447: !       if(symbolP) {
                   4448: !         while(symbolP) {
                   4449: !            /* If the symbol has a tagndx entry, resolve it */
                   4450: !            if(SF_GET_TAGGED(symbolP)) {
                   4451: !                SA_SET_SYM_TAGNDX(symbolP,
                   4452: !                                  ((symbolS*)SA_GET_SYM_TAGNDX(symbolP))->sy_number);
                   4453: !            }
                   4454: !            /* Debug symbol do not need all this rubbish */
                   4455: !            if(!SF_GET_DEBUG(symbolP)) {
                   4456: !                symbolS* real_symbolP;
                   4457: !                /* L* and C_EFCN symbols never merge. */
                   4458: !                if(!SF_GET_LOCAL(symbolP) &&
                   4459: !                   (real_symbolP =
                   4460: !                    symbol_find_base(S_GET_NAME(symbolP), DO_NOT_STRIP)) &&
                   4461: !                   real_symbolP != symbolP) {
                   4462: !                    /* Move the debug data from the debug symbol to the
                   4463: !                       real symbol. Do NOT do the oposite (i.e. move from
                   4464: !                       real symbol to symbol and remove real symbol from the
                   4465: !                       list.) Because some pointers refer to the real symbol
                   4466: !                       whereas no pointers refer to the symbol. */
                   4467: !                    c_symbol_merge(symbolP, real_symbolP);
                   4468: !                    /* Replace the current symbol by the real one */
                   4469: !                    /* The symbols will never be the last or the first
                   4470: !                       because : 1st symbol is .file and 3 last symbols are
                   4471: !                       .text, .data, .bss */
                   4472: !                    DL_REMOVE(real_symbolP);
                   4473: !                    DL_INSERT(real_symbolP, symbolP);
                   4474: !                    DL_REMOVE(symbolP);
                   4475: !                    symbolP = real_symbolP;
                   4476: !                }
                   4477: !                if(flagseen['R'] && S_IS_DATA(symbolP))
                   4478: !                    S_SET_TEXT(symbolP);
                   4479: !                
                   4480: !                symbolP->sy_value += symbolP->sy_frag->fr_address;
                   4481: !                
                   4482: !                if(!S_IS_DEFINED(symbolP))
                   4483: !                    S_SET_EXTERNAL(symbolP);
                   4484: !                else if(S_GET_STORAGE_CLASS(symbolP) == C_NULL)
                   4485: !                    S_SET_STORAGE_CLASS(symbolP, C_STAT);
                   4486: !                
                   4487: !                /* Mainly to speed up if not -g */
                   4488: !                if(SF_GET_PROCESS(symbolP)) {
                   4489: !                    /* Handle the nested blocks auxiliary info. */
                   4490: !                    if(S_GET_STORAGE_CLASS(symbolP) == C_BLOCK) {
                   4491: !                        if(!strcmp(S_GET_NAME(symbolP), ".bb"))
                   4492: !                            stack_push(block_stack, &symbolP);
                   4493: !                        else { /* .eb */
                   4494: !                            register symbolS* begin_symbolP;
                   4495: !                            begin_symbolP = *(symbolS**)stack_pop(block_stack);
                   4496: !                            if(begin_symbolP == (symbolS*)0)
                   4497: !                                as_warn("mismatched .eb");
                   4498: !                            else
                   4499: !                                SA_SET_SYM_ENDNDX(begin_symbolP, symbol_number);
                   4500: !                        }
                   4501: !                    }
                   4502: !                    /* If we are able to identify the type of a function, and we
                   4503: !                       are out of a function (last_functionP == 0) then, the
                   4504: !                       function symbol will be associated with an auxiliary
                   4505: !                       entry. */
                   4506: !                    if(last_functionP == (symbolS*)0 &&
                   4507: !                       SF_GET_FUNCTION(symbolP)) {
                   4508: !                        last_functionP = symbolP;
                   4509: !                        S_SET_NUMBER_AUXILIARY(symbolP, 1);
                   4510: !                        /* Clobber possible stale .dim information. */
                   4511: !                        memset(&symbolP->sy_auxent, '\0', sizeof(union auxent));
                   4512: !                    }
                   4513: !                    /* The C_FCN do not need any additional information.
                   4514: !                       I don't even know if this is needed for sdb. But the
                   4515: !                       standard assembler generate it, so...
                   4516: !                       */
                   4517: !                    if(S_GET_STORAGE_CLASS(symbolP) == C_EFCN) {
                   4518: !                        if(last_functionP == (symbolS*)0)
                   4519: !                            as_fatal("C_EFCN symbol out of scope");
                   4520: !                        SA_SET_SYM_FSIZE(last_functionP,
                   4521: !                                         (long)(symbolP->sy_value -
                   4522: !                                                last_functionP->sy_value));
                   4523: !                        SA_SET_SYM_ENDNDX(last_functionP, symbol_number);
                   4524: !                        last_functionP = (symbolS*)0;
                   4525: !                    }
                   4526: !                }
                   4527: !            } else {
                   4528: !                /* First descriptor of a structure must point to the next
                   4529: !                   slot outside the structure description. */
                   4530: !                if(SF_GET_TAG(symbolP))
                   4531: !                    last_tagP = symbolP;
                   4532: !                else if(S_GET_STORAGE_CLASS(symbolP) == C_EOS)
                   4533: !                    /* +2 take in account the current symbol */
                   4534: !                    SA_SET_SYM_ENDNDX(last_tagP, symbol_number+2);
                   4535: !            }
                   4536: ! 
                   4537: !            /* We must put the external symbols appart. The loader
                   4538: !               does not bomb if we do not. But the references in
                   4539: !               the endndx field for a .bb symbol are not corrected
                   4540: !               if an external symbol is removed between .bb and .be.
                   4541: !               I.e int the following case :
                   4542: !               [20] .bb endndx = 22
                   4543: !               [21] foo external
                   4544: !               [22] .be
                   4545: !               ld will move the symbol 21 to the end of the list but
                   4546: !               endndx will still be 22 instead of 21. */
                   4547: !            {
                   4548: !                register symbolS* thisP = symbolP;
                   4549:   
                   4550: !                symbolP = thisP->sy_next;
                   4551: !                /* remove C_EFCN and LOCAL (L...) symbols */
                   4552: !                if(SF_GET_LOCAL(thisP))
                   4553: !                    DL_REMOVE(thisP);
                   4554: !                else {
                   4555: !                    if(S_GET_STORAGE_CLASS(thisP) == C_EXT &&
                   4556: !                       !SF_GET_FUNCTION(thisP)) {
                   4557: !                        /* Remove from the list */
                   4558: !                        DL_REMOVE(thisP);
                   4559: !                        DL_CLEAR(thisP);
                   4560: !                        /* Move at the end of the list */
                   4561: !                        if (symbol_extern_lastP == (symbolS*)0)
                   4562: !                            symbol_externP = thisP;
                   4563: !                        else
                   4564: !                            DL_APPEND(thisP, symbol_extern_lastP);
                   4565: !                        symbol_extern_lastP = thisP;
                   4566: !                    } else {
                   4567: !                        if(SF_GET_STRING(thisP)) {
                   4568: !                            thisP->sy_name_offset = string_byte_count;
                   4569: !                            string_byte_count += strlen(S_GET_NAME(thisP)) + 1;
                   4570: !                        } else
                   4571: !                            thisP->sy_name_offset = 0;
                   4572: !                        thisP->sy_number = symbol_number;
                   4573: !                        symbol_number += 1 + S_GET_NUMBER_AUXILIARY(thisP);
                   4574: !                    }
                   4575: !                }
                   4576: !            }
                   4577: !        }
                   4578: ! 
                   4579: !        symbol_lastP->sy_next = symbol_externP;
                   4580: !        symbolP = symbol_externP;
                   4581: !        while(symbolP) {
                   4582: !            if(SF_GET_STRING(symbolP)) {
                   4583: !                symbolP->sy_name_offset = string_byte_count;
                   4584: !                string_byte_count += strlen(S_GET_NAME(symbolP)) + 1;
                   4585: !            } else
                   4586: !                symbolP->sy_name_offset = 0;
                   4587: !            symbolP->sy_number = symbol_number;
                   4588: !            symbol_number += 1 + S_GET_NUMBER_AUXILIARY(symbolP);
                   4589: !            symbolP = symbolP->sy_next;
                   4590: !        }
                   4591: !       }
                   4592: !       {
                   4593: !        lineno* lineP;
                   4594: !        for(lineP = lineno_rootP; lineP; lineP = lineP->next) {
                   4595: !            if(lineP->line.l_lnno)
                   4596: !                lineP->line.l_addr.l_paddr +=
                   4597: !                    ((fragS*)lineP->frag)->fr_address;
                   4598: !            else {
                   4599: !                /* There is a good chance that the symbol pointed to
                   4600: !                   is not the one that will be emitted and that the 
                   4601: !                   sy_number is not accurate. */
                   4602: !                char* name;
                   4603: !                name = (char*)lineP->line.l_addr.l_symndx;
                   4604: !                if((symbolP = symbol_find_base(name, DO_NOT_STRIP)) ==
                   4605: !                   (symbolS*)0)
                   4606: !                    as_warn("line number lost symbol %s", name);
                   4607: !                else
                   4608: !                    lineP->line.l_addr.l_symndx = symbolP->sy_number;
                   4609: !            }
                   4610: !            text_lineno_number++;
                   4611: !        }
                   4612: !       }
                   4613: ! #elif defined(aout)
                   4614: !     symbolPP = & symbol_rootP;       /* -> last symbol chain link. */
                   4615:       while (symbolP  = * symbolPP)
                   4616:         {
                   4617: !      name = S_GET_NAME(symbolP);
                   4618: !      if(flagseen['R'] && S_IS_DATA(symbolP))
                   4619: !        S_SET_TEXT(symbolP);
                   4620:        
                   4621:        symbolP -> sy_value += symbolP -> sy_frag -> fr_address;
                   4622:                /* JF the \001 bit is to make sure that local labels
                   4623:                   ( 1: - 9: don't make it into the symtable either */
                   4624:   #ifndef      VMS     /* Under VMS we need to keep local symbols */
                   4625: !      if (!S_IS_LOCAL(symbolP))
                   4626:   #endif       /* not VMS */
                   4627:          {
                   4628:   #ifndef      VMS
                   4629: ! /* The + 1 after strlen account for the \0 at the end of each string */
                   4630: !          symbolP -> sy_number = symbol_number ++;
                   4631: !          if(!S_IS_STABD(symbolP))
                   4632:              {                 /* Ordinary case. */
                   4633:                symbolP -> sy_name_offset = string_byte_count;
                   4634: !              string_byte_count += 
                   4635: !                  strlen (S_GET_NAME(symbolP)) + 1;
                   4636:              }
                   4637:            else                        /* .Stabd case. */
                   4638:   #endif       /* not VMS */
                   4639: ***************
                   4640: *** 392,407 ****
                   4641:            symbolPP = & (symbolP -> sy_next);
                   4642:          }
                   4643:   #ifndef      VMS
                   4644: !      else
                   4645:            * symbolPP = symbolP -> sy_next;
                   4646:   #endif       /* not VMS */
                   4647:         }                              /* for each symbol */
                   4648:   
                   4649: !     syms_siz = sizeof( struct nlist) * symbol_number;
                   4650: !     md_number_to_chars((char *)&the_exec.a_syms,syms_siz,sizeof(the_exec.a_syms));
                   4651: !     /* the_exec . a_syms = sizeof( struct nlist) * symbol_number; */
                   4652:     }
                   4653: - 
                   4654:     /*
                   4655:      * Addresses of frags now reflect addresses we use in the object file.
                   4656:      * Symbol values are correct.
                   4657: --- 584,602 ----
                   4658:            symbolPP = & (symbolP -> sy_next);
                   4659:          }
                   4660:   #ifndef      VMS
                   4661: !      else /* skip the symbol */
                   4662:            * symbolPP = symbolP -> sy_next;
                   4663:   #endif       /* not VMS */
                   4664:         }                              /* for each symbol */
                   4665:   
                   4666: ! #elif defined(elf)
                   4667: !       do it yourself !
                   4668: ! #else
                   4669: !       you lose
                   4670: ! #endif
                   4671: !     H_SET_STRING_SIZE(&headers,string_byte_count);
                   4672: !     H_SET_SYMBOL_TABLE_SIZE(&headers, symbol_number);
                   4673:     }
                   4674:     /*
                   4675:      * Addresses of frags now reflect addresses we use in the object file.
                   4676:      * Symbol values are correct.
                   4677: ***************
                   4678: *** 563,605 ****
                   4679:      * Scan every FixS performing fixups. We had to wait until now to do
                   4680:      * this because md_convert_frag() may have made some fixSs.
                   4681:      */
                   4682: !   /* the_exec . a_trsize
                   4683: !     = sizeof(struct relocation_info) * fixup_segment (text_fix_root, N_TEXT);
                   4684: !   the_exec . a_drsize
                   4685: !     = sizeof(struct relocation_info) * fixup_segment (data_fix_root, N_DATA); */
                   4686: ! 
                   4687: !   tr_siz=sizeof(struct relocation_info) * fixup_segment (text_fix_root, N_TEXT);
                   4688: !   md_number_to_chars((char *)&the_exec.a_trsize, tr_siz ,sizeof(the_exec.a_trsize));
                   4689: !   dr_siz=sizeof(struct relocation_info) * fixup_segment (data_fix_root, N_DATA);
                   4690: !   md_number_to_chars((char *)&the_exec.a_drsize, dr_siz, sizeof(the_exec.a_drsize));
                   4691: !   md_number_to_chars((char *)&the_exec.a_info,omagic,sizeof(the_exec.a_info));
                   4692: !   md_number_to_chars((char *)&the_exec.a_entry,0,sizeof(the_exec.a_entry));
                   4693:   
                   4694:   #ifdef EXEC_MACHINE_TYPE
                   4695: !   md_number_to_chars((char *)&the_exec.a_machtype, EXEC_MACHINE_TYPE, sizeof(the_exec.a_machtype));
                   4696:   #endif
                   4697:   #ifdef EXEC_VERSION
                   4698: !   md_number_to_chars((char *)&the_exec.a_version,EXEC_VERSION,sizeof(the_exec.a_version));
                   4699:   #endif
                   4700: -   
                   4701: -   /* the_exec . a_entry = 0; */
                   4702:   
                   4703: !   size_of_the_object_file =
                   4704: !     sizeof( the_exec ) +
                   4705: !       text_siz +
                   4706: !         data_siz +
                   4707: !        syms_siz +
                   4708: !          tr_siz +
                   4709: !            dr_siz +
                   4710: !              string_byte_count;
                   4711: !      
                   4712: !   next_object_file_charP
                   4713: !     = the_object_file
                   4714: !       = xmalloc ( size_of_the_object_file );
                   4715:   
                   4716:     output_file_create (out_file_name);
                   4717:   
                   4718: !   append (& next_object_file_charP, (char *)(&the_exec), (unsigned long)sizeof(the_exec));
                   4719:   
                   4720:     /*
                   4721:      * Emit code.
                   4722: --- 758,877 ----
                   4723:      * Scan every FixS performing fixups. We had to wait until now to do
                   4724:      * this because md_convert_frag() may have made some fixSs.
                   4725:      */
                   4726: !   
                   4727: !   H_SET_RELOCATION_SIZE(&headers,
                   4728: !        RELSZ*fixup_segment (text_fix_root, SEG_TEXT),
                   4729: !        RELSZ*fixup_segment (data_fix_root, SEG_DATA));
                   4730: !   H_SET_MAGIC_NUMBER(&headers,omagic);
                   4731: !   H_SET_ENTRY_POINT(&headers,0);
                   4732:   
                   4733:   #ifdef EXEC_MACHINE_TYPE
                   4734: !   H_SET_MACHINE_TYPE(&headers,EXEC_MACHINE_TYPE);
                   4735:   #endif
                   4736:   #ifdef EXEC_VERSION
                   4737: !   H_SET_VERSION(&headers,EXEC_VERSION);
                   4738:   #endif
                   4739:   
                   4740: ! #ifdef coff
                   4741: !   {
                   4742: !       register int           text_relocation_number = 0;
                   4743: !       register int           data_relocation_number = 0;
                   4744: !       register fixS* fixP;
                   4745: !        
                   4746: !       /* Count the number of relocation entries for text and data */
                   4747: !       for(fixP = text_fix_root; fixP; fixP = fixP->fx_next)
                   4748: !        if(fixP->fx_addsy)
                   4749: !            text_relocation_number++;
                   4750: !       SA_SET_SCN_NRELOC(dot_text_symbol, text_relocation_number);
                   4751: !       /* Assign the number of line number entries for the text section */
                   4752: !       SA_SET_SCN_NLINNO(dot_text_symbol, text_lineno_number);
                   4753: !       /* Assign the size of the section */
                   4754: !       SA_SET_SCN_SCNLEN(dot_text_symbol, H_GET_TEXT_SIZE(&headers));
                   4755: !       
                   4756: !       for(fixP = data_fix_root; fixP; fixP = fixP->fx_next)
                   4757: !        if(fixP->fx_addsy)
                   4758: !            data_relocation_number++;
                   4759: !       SA_SET_SCN_NRELOC(dot_data_symbol, data_relocation_number);
                   4760: !       /* Assign the size of the section */
                   4761: !       SA_SET_SCN_SCNLEN(dot_data_symbol, H_GET_DATA_SIZE(&headers));
                   4762: ! 
                   4763: !       /* Assign the size of the section */
                   4764: !       SA_SET_SCN_SCNLEN(dot_bss_symbol, H_GET_BSS_SIZE(&headers));
                   4765: !   }
                   4766: ! 
                   4767: !   /* Fill in extra coff fields */
                   4768: ! 
                   4769: !   /* Initialize general line number information. */
                   4770: !   H_SET_LINENO_SIZE(&headers, text_lineno_number * LINESZ);
                   4771: ! 
                   4772: !   /* filehdr */
                   4773: !   H_SET_FILE_MAGIC_NUMBER(&headers, FILE_HEADER_MAGIC);
                   4774: !   H_SET_NUMBER_OF_SECTIONS(&headers, 3); /* text+data+bss */
                   4775: !   H_SET_TIME_STAMP(&headers, (long)time((long*)0));
                   4776: !   H_SET_SYMBOL_TABLE_POINTER(&headers,
                   4777: !                           H_GET_SYMBOL_TABLE_FILE_OFFSET(&headers));
                   4778: !   /* symbol table size allready set */
                   4779: !   H_SET_SIZEOF_OPTIONAL_HEADER(&headers, AOUTHDRSZ);
                   4780: !   H_SET_FLAGS(&headers, (text_lineno_number == 0 ? F_LNNO : 0 ) | 
                   4781: !            BYTE_ORDERING);
                   4782: ! 
                   4783: !   /* aouthdr */
                   4784: !   /* magic number allready set */
                   4785: !   H_SET_VERSION_STAMP(&headers, 0);
                   4786: !   /* Text, data, bss size; entry point; text_start and data_start
                   4787: !      are already set */
                   4788: ! 
                   4789: !   /* Build section headers */
                   4790: !   
                   4791: !   c_section_header(&text_section_header,
                   4792: !                 ".text",
                   4793: !                 0,
                   4794: !                 H_GET_TEXT_SIZE(&headers),
                   4795: !                 H_GET_TEXT_FILE_OFFSET(&headers),
                   4796: !                 SA_GET_SCN_NRELOC(dot_text_symbol) ?
                   4797: !                   H_GET_RELOCATION_FILE_OFFSET(&headers) : 0,
                   4798: !                 text_lineno_number ? H_GET_LINENO_FILE_OFFSET(&headers) : 0,
                   4799: !                 SA_GET_SCN_NRELOC(dot_text_symbol),
                   4800: !                 text_lineno_number);
                   4801: !   c_section_header(&data_section_header,
                   4802: !                 ".data",
                   4803: !                 H_GET_TEXT_SIZE(&headers),
                   4804: !                 H_GET_DATA_SIZE(&headers),
                   4805: !                 H_GET_DATA_SIZE(&headers) ?
                   4806: !                   H_GET_DATA_FILE_OFFSET(&headers) : 0,
                   4807: !                 SA_GET_SCN_NRELOC(dot_data_symbol) ?
                   4808: !                   H_GET_RELOCATION_FILE_OFFSET(&headers) +
                   4809: !                   text_section_header.s_nreloc * RELSZ : 0,
                   4810: !                 0, /* No line number information */
                   4811: !                 SA_GET_SCN_NRELOC(dot_data_symbol),
                   4812: !                 0);  /* No line number information */
                   4813: !   c_section_header(&bss_section_header,
                   4814: !                 ".bss",
                   4815: !                 H_GET_TEXT_SIZE(&headers) + H_GET_DATA_SIZE(&headers),
                   4816: !                 H_GET_BSS_SIZE(&headers),
                   4817: !                 0, /* No file offset */
                   4818: !                 0, /* No relocation information */
                   4819: !                 0, /* No line number information */
                   4820: !                 0, /* No relocation information */
                   4821: !                 0); /* No line number information */
                   4822: !   
                   4823: ! #endif /* coff */
                   4824: !   
                   4825: !   object_file_size = H_GET_FILE_SIZE(&headers);
                   4826: !   next_object_file_charP = the_object_file = xmalloc ( object_file_size );
                   4827:   
                   4828:     output_file_create (out_file_name);
                   4829:   
                   4830: ! 
                   4831: !   H_OUTPUT(&headers, &next_object_file_charP);
                   4832: ! 
                   4833: ! #ifdef coff
                   4834: !   /* Output the section headers */
                   4835: !   c_section_header_append(&text_section_header, &next_object_file_charP);
                   4836: !   c_section_header_append(&data_section_header, &next_object_file_charP);
                   4837: !   c_section_header_append(&bss_section_header, &next_object_file_charP);
                   4838: ! #endif /* coff */
                   4839: ! 
                   4840:   
                   4841:     /*
                   4842:      * Emit code.
                   4843: ***************
                   4844: *** 624,652 ****
                   4845:      */
                   4846:     emit_relocations (text_fix_root, (relax_addressT)0);
                   4847:     emit_relocations (data_fix_root, text_last_frag -> fr_address);
                   4848:     /*
                   4849: !    * Emit all symbols left in the symbol chain.
                   4850: !    * Any symbol still undefined is made N_EXT.
                   4851:      */
                   4852: !   for (   symbolP = symbol_rootP;   symbolP;   symbolP = symbolP -> sy_next   )
                   4853: !     {
                   4854: !       register char *        temp;
                   4855: ! 
                   4856: !       temp = symbolP -> sy_nlist . n_un . n_name;
                   4857: !       /* JF fix the numbers up. Call by value RULES! */
                   4858: !       md_number_to_chars((char *)&(symbolP -> sy_nlist  . n_un . n_strx ),symbolP -> sy_name_offset,sizeof(symbolP -> sy_nlist  . n_un . n_strx ));
                   4859: !       md_number_to_chars((char *)&(symbolP->sy_nlist.n_desc),symbolP->sy_nlist.n_desc,sizeof(symbolP -> sy_nlist  . n_desc));
                   4860: !       md_number_to_chars((char *)&(symbolP->sy_nlist.n_value),symbolP->sy_nlist.n_value,sizeof(symbolP->sy_nlist.n_value));
                   4861: !       /* symbolP -> sy_nlist  . n_un . n_strx = symbolP -> sy_name_offset; JF replaced by md above */
                   4862: !       if (symbolP -> sy_type == N_UNDF)
                   4863: !        symbolP -> sy_type |= N_EXT; /* Any undefined symbols become N_EXT. */
                   4864: !       append (& next_object_file_charP, (char *)(& symbolP -> sy_nlist),
                   4865: !            (unsigned long)sizeof(struct nlist));
                   4866: !       symbolP -> sy_nlist . n_un . n_name = temp;
                   4867: !     }                                /* for each symbol */
                   4868:   
                   4869:     /*
                   4870: -    * next_object_file_charP -> slot for next object byte.
                   4871:      * Emit strings.
                   4872:      * Find strings by crawling along symbol table chain.
                   4873:      */
                   4874: --- 896,915 ----
                   4875:      */
                   4876:     emit_relocations (text_fix_root, (relax_addressT)0);
                   4877:     emit_relocations (data_fix_root, text_last_frag -> fr_address);
                   4878: + 
                   4879: + #ifdef coff
                   4880:     /*
                   4881: !    * Emit line number entries.
                   4882:      */
                   4883: !   emit_lineno(lineno_rootP, &next_object_file_charP);
                   4884: ! #endif /* coff */
                   4885: ! 
                   4886: !   /*
                   4887: !    * Emit symbols.
                   4888: !    */
                   4889: !   emit_symbols (symbol_rootP,&next_object_file_charP);
                   4890:   
                   4891:     /*
                   4892:      * Emit strings.
                   4893:      * Find strings by crawling along symbol table chain.
                   4894:      */
                   4895: ***************
                   4896: *** 654,671 ****
                   4897:     md_number_to_chars((char *)&string_byte_count, string_byte_count, sizeof(string_byte_count));
                   4898:   
                   4899:     append (& next_object_file_charP, (char *)&string_byte_count, (unsigned long)sizeof(string_byte_count));
                   4900: !   for (   symbolP = symbol_rootP;   symbolP;   symbolP = symbolP -> sy_next   )
                   4901: !     {
                   4902: !       if (symbolP -> sy_name)
                   4903: !      {                       /* Ordinary case: not .stabd. */
                   4904: !        append (& next_object_file_charP, symbolP -> sy_name,
                   4905: !                (unsigned long)(strlen (symbolP -> sy_name) + 1));
                   4906: !      }
                   4907: !     }                                /* for each symbol */
                   4908: ! 
                   4909: !   know( next_object_file_charP == the_object_file + size_of_the_object_file );
                   4910:   
                   4911: !   output_file_append (the_object_file, size_of_the_object_file, out_file_name);
                   4912:   
                   4913:   #ifdef DONTDEF
                   4914:     if (flagseen['G'])         /* GDB symbol file to be appended? */
                   4915: --- 917,935 ----
                   4916:     md_number_to_chars((char *)&string_byte_count, string_byte_count, sizeof(string_byte_count));
                   4917:   
                   4918:     append (& next_object_file_charP, (char *)&string_byte_count, (unsigned long)sizeof(string_byte_count));
                   4919: !   for(symbolP = symbol_rootP; symbolP; symbolP = symbolP->sy_next) {
                   4920: ! #ifdef coff
                   4921: !       if(SF_GET_STRING(symbolP))
                   4922: ! #else /* coff */
                   4923: !       if(S_GET_NAME(symbolP))
                   4924: ! #endif /* coff */
                   4925: !        append(&next_object_file_charP, S_GET_NAME(symbolP),
                   4926: !               (unsigned long)(strlen (S_GET_NAME(symbolP)) + 1));
                   4927: !   }
                   4928:   
                   4929: !   know( next_object_file_charP == the_object_file + object_file_size);
                   4930: !   /* Write the data to the file */
                   4931: !   output_file_append (the_object_file,object_file_size,out_file_name);
                   4932:   
                   4933:   #ifdef DONTDEF
                   4934:     if (flagseen['G'])         /* GDB symbol file to be appended? */
                   4935: ***************
                   4936: *** 702,708 ****
                   4937:   void
                   4938:   relax_segment (segment_frag_root, segment_type)
                   4939:        struct frag *   segment_frag_root;
                   4940: !      segT            segment_type; /* N_DATA or N_TEXT */
                   4941:   {
                   4942:     register struct frag *     fragP;
                   4943:     register relax_addressT    address;
                   4944: --- 966,972 ----
                   4945:   void
                   4946:   relax_segment (segment_frag_root, segment_type)
                   4947:        struct frag *   segment_frag_root;
                   4948: !      segT            segment_type; /* SEG_DATA or SEG_TEXT */
                   4949:   {
                   4950:     register struct frag *     fragP;
                   4951:     register relax_addressT    address;
                   4952: ***************
                   4953: *** 740,746 ****
                   4954:   
                   4955:        case rs_machine_dependent:
                   4956:          address += md_estimate_size_before_relax
                   4957: !          (fragP, seg_N_TYPE [(int) segment_type]);
                   4958:          break;
                   4959:   
                   4960:   #ifndef WORKING_DOT_WORD
                   4961: --- 1004,1010 ----
                   4962:   
                   4963:        case rs_machine_dependent:
                   4964:          address += md_estimate_size_before_relax
                   4965: !          (fragP, seg_SEG((int) segment_type));
                   4966:          break;
                   4967:   
                   4968:   #ifndef WORKING_DOT_WORD
                   4969: ***************
                   4970: *** 847,855 ****
                   4971:                target = offset;
                   4972:                if (symbolP)
                   4973:                  {
                   4974: !                  know(   ((symbolP -> sy_type & N_TYPE) == N_ABS) || ((symbolP -> sy_type & N_TYPE) == N_DATA) || ((symbolP -> sy_type & N_TYPE) == N_TEXT));
                   4975: !                  know( symbolP -> sy_frag );
                   4976: !                  know( (symbolP->sy_type&N_TYPE)!=N_ABS || symbolP->sy_frag==&zero_address_frag );
                   4977:                    target +=
                   4978:                      symbolP -> sy_value
                   4979:                        + symbolP -> sy_frag -> fr_address;
                   4980: --- 1111,1122 ----
                   4981:                target = offset;
                   4982:                if (symbolP)
                   4983:                  {
                   4984: !                  know(S_IS_ABS(symbolP) ||
                   4985: !                       S_IS_DATA(symbolP) ||
                   4986: !                       S_IS_TEXT(symbolP))
                   4987: !                  know(symbolP -> sy_frag);
                   4988: !                  know(!S_IS_ABS(symbolP) || 
                   4989: !                       symbolP->sy_frag==&zero_address_frag );
                   4990:                    target +=
                   4991:                      symbolP -> sy_value
                   4992:                        + symbolP -> sy_frag -> fr_address;
                   4993: ***************
                   4994: *** 876,885 ****
                   4995:                target = offset;
                   4996:                if (symbolP)
                   4997:                  {
                   4998: !  know(   ((symbolP -> sy_type & N_TYPE) == N_ABS) || ((symbolP -> sy_type &
                   4999: !  N_TYPE) == N_DATA) || ((symbolP -> sy_type & N_TYPE) == N_TEXT));
                   5000: !                  know( symbolP -> sy_frag );
                   5001: !                  know( (symbolP->sy_type&N_TYPE)!=N_ABS || symbolP->sy_frag==&zero_address_frag );
                   5002:                    target +=
                   5003:                      symbolP -> sy_value
                   5004:                        + symbolP -> sy_frag -> fr_address;
                   5005: --- 1143,1154 ----
                   5006:                target = offset;
                   5007:                if (symbolP)
                   5008:                  {
                   5009: !                  know(S_IS_ABS(symbolP) ||
                   5010: !                       S_IS_DATA(symbolP) ||
                   5011: !                       S_IS_TEXT(symbolP))
                   5012: !                  know(symbolP -> sy_frag);
                   5013: !                  know(!S_IS_ABS(symbolP) || 
                   5014: !                       symbolP->sy_frag==&zero_address_frag );
                   5015:                    target +=
                   5016:                      symbolP -> sy_value
                   5017:                        + symbolP -> sy_frag -> fr_address;
                   5018: ***************
                   5019: *** 1041,1065 ****
                   5020:         add_number  = fixP  -> fx_offset;
                   5021:         pcrel    = fixP  -> fx_pcrel;
                   5022:         if(add_symbolP)
                   5023: !      add_symbol_N_TYPE = add_symbolP -> sy_type & N_TYPE;
                   5024:         if (sub_symbolP)
                   5025:        {
                   5026:          if(!add_symbolP)      /* Its just -sym */
                   5027:            {
                   5028: !            if(sub_symbolP->sy_type!=N_ABS)
                   5029: !              as_warn("Negative of non-absolute symbol %s", sub_symbolP->sy_name);
                   5030: !            add_number-=sub_symbolP->sy_value;
                   5031:            }
                   5032: !        else if (   ((sub_symbolP -> sy_type ^ add_symbol_N_TYPE) & N_TYPE) == 0
                   5033: !            && (   add_symbol_N_TYPE == N_DATA
                   5034: !                || add_symbol_N_TYPE == N_TEXT
                   5035: !                || add_symbol_N_TYPE == N_BSS
                   5036: !                || add_symbol_N_TYPE == N_ABS))
                   5037:            {
                   5038:              /* Difference of 2 symbols from same segment. */
                   5039:              /* Can't make difference of 2 undefineds: 'value' means */
                   5040:              /* something different for N_UNDF. */
                   5041: !            add_number += add_symbolP -> sy_value - sub_symbolP -> sy_value;
                   5042:              add_symbolP = NULL;
                   5043:              fixP -> fx_addsy = NULL;
                   5044:            }
                   5045: --- 1310,1339 ----
                   5046:         add_number  = fixP  -> fx_offset;
                   5047:         pcrel    = fixP  -> fx_pcrel;
                   5048:         if(add_symbolP)
                   5049: !      add_symbol_N_TYPE = SEG_seg(S_GET_SEGMENT(add_symbolP));
                   5050:         if (sub_symbolP)
                   5051:        {
                   5052:          if(!add_symbolP)      /* Its just -sym */
                   5053:            {
                   5054: !            if(SEG_seg(sub_symbolP->sy_type)!=SEG_ABSOLUTE)
                   5055: !              as_warn("Negative of non-absolute symbol %s", 
                   5056: !                      S_GET_NAME(sub_symbolP));
                   5057: !            add_number-=S_GET_VALUE(sub_symbolP);
                   5058:            }
                   5059: !        /* if sub_symbol is in the same segment that add_symbol
                   5060: !           and add_symbol is either in DATA, TEXT, BSS or ABSOLUTE */
                   5061: !        else if((SEG_seg(S_GET_SEGMENT(sub_symbolP)) == 
                   5062: !                 add_symbol_N_TYPE) &&
                   5063: !                ((add_symbol_N_TYPE == SEG_DATA) ||
                   5064: !                 (add_symbol_N_TYPE == SEG_TEXT) ||
                   5065: !                 (add_symbol_N_TYPE == SEG_BSS)  ||
                   5066: !                 (add_symbol_N_TYPE == SEG_ABSOLUTE)))
                   5067:            {
                   5068:              /* Difference of 2 symbols from same segment. */
                   5069:              /* Can't make difference of 2 undefineds: 'value' means */
                   5070:              /* something different for N_UNDF. */
                   5071: !            add_number += S_GET_VALUE(add_symbolP) - 
                   5072: !                          S_GET_VALUE(sub_symbolP);
                   5073:              add_symbolP = NULL;
                   5074:              fixP -> fx_addsy = NULL;
                   5075:            }
                   5076: ***************
                   5077: *** 1066,1079 ****
                   5078:          else
                   5079:            {
                   5080:              /* Different segments in subtraction. */
                   5081: !            know( sub_symbolP -> sy_type != (N_ABS | N_EXT))
                   5082: !              if (sub_symbolP -> sy_type == N_ABS)
                   5083: !                  add_number -= sub_symbolP -> sy_value;
                   5084:                else
                   5085:                  {
                   5086: !                         as_warn("Can't emit reloc {- %s-seg symbol \"%s\"} @ file address %d.",
                   5087: !                                  seg_name[(int)N_TYPE_seg[sub_symbolP->sy_type&N_TYPE]],
                   5088: !                                  sub_symbolP -> sy_name, fragP -> fr_address + where);
                   5089:                  }
                   5090:            }
                   5091:        }
                   5092: --- 1340,1353 ----
                   5093:          else
                   5094:            {
                   5095:              /* Different segments in subtraction. */
                   5096: !            know(!(S_IS_EXTERNAL(sub_symbolP) && S_IS_ABS(sub_symbolP)));
                   5097: !              if (S_IS_ABS(sub_symbolP))
                   5098: !                  add_number -= S_GET_VALUE(sub_symbolP);
                   5099:                else
                   5100:                  {
                   5101: !                  as_warn("Can't emit reloc {- %s-seg symbol \"%s\"} @ file address %d.",
                   5102: !                    segment_name((int)SEG_seg(S_GET_SEGMENT(sub_symbolP))),
                   5103: !                    S_GET_NAME(sub_symbolP), fragP -> fr_address + where);
                   5104:                  }
                   5105:            }
                   5106:        }
                   5107: ***************
                   5108: *** 1086,1092 ****
                   5109:               * SEG_UNKNOWN, but it is now in the local segment.
                   5110:               * So we know how to do the address without relocation.
                   5111:               */
                   5112: !            add_number += add_symbolP -> sy_value;
                   5113:              add_number -=
                   5114:   #ifndef NS32K
                   5115:                      size +
                   5116: --- 1360,1366 ----
                   5117:               * SEG_UNKNOWN, but it is now in the local segment.
                   5118:               * So we know how to do the address without relocation.
                   5119:               */
                   5120: !            add_number += S_GET_VALUE(add_symbolP);
                   5121:              add_number -=
                   5122:   #ifndef NS32K
                   5123:                      size +
                   5124: ***************
                   5125: *** 1112,1131 ****
                   5126:            {
                   5127:              switch (add_symbol_N_TYPE)
                   5128:                {
                   5129: !              case N_ABS:
                   5130: !                add_number += add_symbolP -> sy_value;
                   5131:                  fixP -> fx_addsy = NULL;
                   5132:                  add_symbolP = NULL;
                   5133:                  break;
                   5134:                  
                   5135: !              case N_BSS:
                   5136: !              case N_DATA:
                   5137: !              case N_TEXT:
                   5138:                  seg_reloc_count ++;
                   5139: !                add_number += add_symbolP -> sy_value;
                   5140:                  break;
                   5141:                  
                   5142: !              case N_UNDF:
                   5143:                  seg_reloc_count ++;
                   5144:                  break;
                   5145:                  
                   5146: --- 1386,1409 ----
                   5147:            {
                   5148:              switch (add_symbol_N_TYPE)
                   5149:                {
                   5150: !              case SEG_ABSOLUTE:
                   5151: !                add_number += S_GET_VALUE(add_symbolP);
                   5152:                  fixP -> fx_addsy = NULL;
                   5153:                  add_symbolP = NULL;
                   5154:                  break;
                   5155:                  
                   5156: !              case SEG_BSS:
                   5157: !              case SEG_DATA:
                   5158: !              case SEG_TEXT:
                   5159:                  seg_reloc_count ++;
                   5160: !                add_number += S_GET_VALUE(add_symbolP);
                   5161:                  break;
                   5162:                  
                   5163: !              case SEG_UNKNOWN:
                   5164: ! #ifdef coff
                   5165: !                if(S_IS_COMMON(add_symbolP))
                   5166: !                    add_number += S_GET_VALUE(add_symbolP);
                   5167: ! #endif /* coff */
                   5168:                  seg_reloc_count ++;
                   5169:                  break;
                   5170:                  
                   5171: ***************
                   5172: *** 1159,1165 ****
                   5173:        case 0:
                   5174:   #if defined(SPARC) || defined(I860)
                   5175:          fixP->fx_addnumber = add_number;
                   5176: !        md_number_to_imm(place, add_number, size, fixP, this_segment_type);
                   5177:   #else
                   5178:          md_number_to_imm (place, add_number, size);
                   5179:          /* OVE: the immediates, like disps, have lsb at lowest address */
                   5180: --- 1437,1444 ----
                   5181:        case 0:
                   5182:   #if defined(SPARC) || defined(I860)
                   5183:          fixP->fx_addnumber = add_number;
                   5184: !        md_number_to_imm(place, add_number, size, fixP, 
                   5185: !                         seg_SEG(this_segment_type));
                   5186:   #else
                   5187:          md_number_to_imm (place, add_number, size);
                   5188:          /* OVE: the immediates, like disps, have lsb at lowest address */
                   5189: ***************
                   5190: *** 1183,1249 ****
                   5191:     return (seg_reloc_count);
                   5192:   }                            /* fixup_segment() */
                   5193:   
                   5194: - 
                   5195: - /* The sparc needs its own emit_relocations() */
                   5196: - #if !defined(SPARC) && !defined(I860)
                   5197: - /*
                   5198: -  *           emit_relocations()
                   5199: -  *
                   5200: -  * Crawl along a fixS chain. Emit the segment's relocations.
                   5201: -  */
                   5202: - static void
                   5203: - emit_relocations (fixP, segment_address_in_file)
                   5204: -      register fixS * fixP;   /* Fixup chain for this segment. */
                   5205: -      relax_addressT  segment_address_in_file;
                   5206: - {
                   5207: -   struct relocation_info     ri;
                   5208: -   register symbolS *         symbolP;
                   5209: - 
                   5210: -      /* JF this is for paranoia */
                   5211: -   bzero((char *)&ri,sizeof(ri));
                   5212: -   for ( ;  fixP;  fixP = fixP -> fx_next)
                   5213: -     {
                   5214: -       if (symbolP = fixP -> fx_addsy)
                   5215: -      {
                   5216: - 
                   5217: - #ifdef NS32K
                   5218: -              /* These two 'cuz of NS32K */
                   5219: -        ri . r_bsr            = fixP -> fx_bsr;
                   5220: -        ri . r_disp           = fixP -> fx_im_disp;
                   5221: - #endif
                   5222: - 
                   5223: -        ri . r_length         = nbytes_r_length [fixP -> fx_size];
                   5224: -        ri . r_pcrel          = fixP -> fx_pcrel;
                   5225: -        ri . r_address        = fixP -> fx_frag -> fr_address
                   5226: -          +   fixP -> fx_where
                   5227: -            - segment_address_in_file;
                   5228: -        if ((symbolP -> sy_type & N_TYPE) == N_UNDF)
                   5229: -          {
                   5230: -            ri . r_extern     = 1;
                   5231: -            ri . r_symbolnum  = symbolP -> sy_number;
                   5232: -          }
                   5233: -        else
                   5234: -          {
                   5235: -            ri . r_extern     = 0;
                   5236: -            ri . r_symbolnum  = symbolP -> sy_type & N_TYPE;
                   5237: -          }
                   5238: - 
                   5239: -        /* 
                   5240: -          The 68k machines assign bit-fields from higher bits to 
                   5241: -          lower bits ("left-to-right") within the int.  VAXen assign 
                   5242: -          bit-fields from lower bits to higher bits ("right-to-left").
                   5243: -          Both handle multi-byte numbers in their usual fashion
                   5244: -          (Big-endian and little-endian stuff).
                   5245: -          Thus we need a machine dependent routine to make
                   5246: -          sure the structure is written out correctly.  FUN!
                   5247: -         */
                   5248: -        md_ri_to_chars((char *) &ri, ri); 
                   5249: -        append (&next_object_file_charP, (char *)& ri, (unsigned long)sizeof(ri));
                   5250: -      }
                   5251: -     }
                   5252: - 
                   5253: - }
                   5254: - #endif
                   5255:   
                   5256:   int
                   5257:   is_dnrange(f1,f2)
                   5258: --- 1462,1467 ----
                   5259: *** /lasvegas/spare/usenet/work/gas-1.37.genuine/./write.h     Thu Oct 11 18:45:31 1990
                   5260: --- ./write.h  Wed Nov  7 07:34:00 1990
                   5261: ***************
                   5262: *** 72,77 ****
                   5263: --- 72,79 ----
                   5264:   COMMON fixS *        data_fix_root;  /* Chains fixSs. */
                   5265:   COMMON fixS **       seg_fix_rootP;  /* -> one of above. */
                   5266:   
                   5267: + COMMON char *        next_object_file_charP;
                   5268: + 
                   5269:   bit_fixS *bit_fix_new();
                   5270:   /* end: write.h */
                   5271:   
                   5272: *** /lasvegas/spare/usenet/work/gas-1.37.genuine/./xmalloc.c   Wed Mar  1 23:48:34 1989
                   5273: --- ./xmalloc.c        Wed Nov  7 07:34:01 1990
                   5274: ***************
                   5275: *** 43,48 ****
                   5276: --- 43,50 ----
                   5277:   #include <malloc.h>
                   5278:   #endif
                   5279:   
                   5280: + #define error as_fatal
                   5281: + 
                   5282:   char * xmalloc(n)
                   5283:        long n;
                   5284:   {
                   5285: *** /lasvegas/spare/usenet/work/gas-1.37.genuine/./xrealloc.c  Wed Mar  1 23:48:33 1989
                   5286: --- ./xrealloc.c       Wed Nov  7 07:34:02 1990
                   5287: ***************
                   5288: *** 45,50 ****
                   5289: --- 45,52 ----
                   5290:   #include <malloc.h>
                   5291:   #endif
                   5292:   
                   5293: + #define error as_fatal
                   5294: + 
                   5295:   char   *
                   5296:   xrealloc (ptr, n)
                   5297:   register char  *ptr;

unix.superglobalmegacorp.com

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