Annotation of coherent/b/bin/as/def.doc, revision 1.1.1.1

1.1       root        1: Some Unix languages such as gcc and g++ produce assembler rather than object
                      2: code. This approach radically slows down the compiler and produces amazing
                      3: unneeded complexity, especially if debug information is to be placed on
                      4: object files.
                      5: 
                      6: The compiler starts with type and line information in a format much like that
                      7: of the desired COFF output files. It must break this down into lines to ship
                      8: through the assembler, the assembler then must rebuild the information into
                      9: COFF format for output.
                     10: 
                     11: In line with its function the Mark Williams assembler not only supports this
                     12: sillyness it documents it. (Not a Unix assembler notion). However error
                     13: checking of these is minamum and bad debug information can corrupt the
                     14: generated COFF output.
                     15: 
                     16: This section must be read with a listing of coff.h for reference.
                     17: 
                     18:        .file "filename"
                     19: If used this should be the first statement in the file. It produces a
                     20: SYMENT of n_sclass = C_FILE and an AUXENT with ae_fname = filename. This
                     21: connects the object file to the original source file.
                     22: 
                     23:        .def symbolName
                     24: This initializes this SYMENT with n_name = symbolName. If there is a symbol
                     25: by that name on the assemblers internal symbol table it is marked to
                     26: prevent output to the symbol table, any RELOC references will point to
                     27: this table entry so its n_value had better end up correct. Because this
                     28: kind of code is assumed to be the result of a compiler we assume it is
                     29: right. The following commands upto and including .endef refer to this
                     30: SYMENT.
                     31: 
                     32:        .type number
                     33: This sets this SYMENT's n_type with number. If number indicates a function,
                     34: DT_FCN, An LINENO record is built pointing at this SYMENT.
                     35: 
                     36:        .val symbol or number
                     37: This sets this SYMENT's n_value and if it is a symbol it sets n_scnum
                     38: to the symbols section number.
                     39: 
                     40:        .scl number
                     41: This sets this SYMENT's n_sclass to number.
                     42: 
                     43:        .dim number [, number [, number [, number]]]
                     44: This sets up to 4 entries in an AUXENT's ae_dimen. It is used to describe
                     45: multi dimensioned arrays to COFF. Past 4 dimensional arrays the COFF specs
                     46: are admittedly buggy. One of the reasons that people are playing with other
                     47: output formats.
                     48: 
                     49:        .size n
                     50: This sets this AUXENT ae_size to n.
                     51: 
                     52:        .tag name
                     53: This scans backwards on the SYMENTs for a matching n_name. It points this
                     54: ae_tagndx to that names symbol number and that ae_endndx to the next symbol
                     55: number. A good example is a struct, It would start with a SYMENT of type
                     56: T_STRUCT, then there would be SYMENTs for its members. At the end there would
                     57: be a C_EOS (end of structure) with a tag that gets us back to the
                     58: symbol's name. .tag connects the forward and backward pointers.
                     59: 
                     60:        .line n
                     61: This sets the AUXENT's ae_lnno to n.
                     62: 
                     63:        .endef
                     64: This marks the end of a SYMENT started by .def. If the n_sclass == C_EFCN
                     65: (end of function) it builds the functions ae_fsize and ae_endndx and does
                     66: not output this syment. If any AUXENT fields were set an AUXENT record will
                     67: follow this SYMENT.
                     68: 
                     69:        .ln number
                     70: This builds a LINENO record with l_lnno = n and l_addr.l_paddr = the current
                     71: location.

unix.superglobalmegacorp.com

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