Annotation of researchv10no/cmd/f77/alt/README, revision 1.1.1.1

1.1       root        1: this is a bit of a horror.
                      2: 
                      3: the stab interface (to sdb and pi) has been hacked mercilessly until it works.
                      4: it's all pretty fragile, and probably somewhat buggy.  things to beware
                      5: especially:
                      6: 
                      7: f77 is a pcc1 compiler.  c is a pcc2 compiler these days.  over the years,
                      8: c has gained types, sort of; the pcc internal representation of types (which
                      9: is put out in the type field of the stab) has changed too.  (and the printed
                     10: V8 manuals get it wrong, by the way; the online manual is correct.)  f77,
                     11: being an old compiler, uses the old representation; it has to convert it
                     12: to the new one when it prints stabs.
                     13: 
                     14: pcc1 used to put out symbols at the top of each block, followed by the
                     15: line number markers (N_SLINEs).  f77 used some horrible hackery to make
                     16: that happen, as it didn't know enough about symbols until the end (think
                     17: about implicit declarations).  pcc2 puts symbols after N_SLINEs.  sdb now
                     18: wants things that way too.  f77 has followed along.
                     19: 
                     20: common and equivalence are nightmares.  one would like to simply spit out
                     21: a stab for each piece of the common, pointing at the address of that piece;
                     22: unfortunately, offsets to commons don't work in the symbol table (it
                     23: requires the relocation info to make it work, and there's no relocation
                     24: data for symbols, logically enough).  hence these monsters are put out as
                     25: crypto-structures, in the following format:
                     26:        .stabs  "cname",N_BCOMM,0,0,0
                     27:        .stabs  "element",N_SSYM,0,type,offset
                     28:        ...
                     29:        .stabs  "cname",N_ECOMM,0,0,0
                     30: when a debugger wants the address of `element', having noted that it is
                     31: a N_SSYM within the BCOMM/ECOMM (or BCOMM/ECOML, see below) brackets, it
                     32: should pick up `cname' from the ECOMM, prepend an `_' to make an external
                     33: name of it, look that name up in the symbol table to find the address of
                     34: the common region, and add the offset.
                     35: 
                     36: sometimes the endmarker isn't an ECOML, but is
                     37:        .stabs  "",N_ECOML,0,0,addr
                     38: e.g. when you've equivalenced two non-common variables together.  this
                     39: means `element's address is addr+offset.
                     40: 
                     41: enough.  sdb works, sort of.  pi works, but not on commons nor equivalences.
                     42: (tough.)
                     43: 
                     44: it is probably impossible to make a pdp11 compiler without lots of work.

unix.superglobalmegacorp.com

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