Annotation of researchv10no/cmd/PDP11/11as/henrybug, revision 1.1

1.1     ! root        1: From zoo.toronto.edu!henry Thu Aug 16 13:39:15 EDT 1990
        !             2: Received: by dutoit; Thu Aug 16 13:39:39 EDT 1990
        !             3: Received: by inet.att.com; Thu Aug 16 13:39 EDT 1990
        !             4: From: [email protected]
        !             5: Date: Thu, 16 Aug 90 13:39:15 EDT
        !             6: To: [email protected]
        !             7: Subject: bug fix to 11as
        !             8: 
        !             9: Looks like I found a bug in the pdp11 cross-assembler.  When the second
        !            10: pass sees a change of segment, it forces dot to be even.  Unfortunately,
        !            11: the first pass is completely ignorant of this, and confusion and madness
        !            12: result.  For example, this program:
        !            13: 
        !            14:        .data
        !            15:        <a>
        !            16:        .data
        !            17: b:     <c>
        !            18: 
        !            19: puts the "c" at address 1, but makes "b" equal 2.  I ran into this with
        !            20: a test program that flipped back and forth between data and text while
        !            21: allocating strings.
        !            22: 
        !            23: I conjecture that the old native version of the assembler may have
        !            24: done the forcing in both passes.  When I moved our major pdp11 stuff to
        !            25: the cross-compiler, one of the things I had to do to get identical bytes
        !            26: out the end was to add a ".even" in one place (after putting an odd-
        !            27: length string into the text segment).  Evidently there was a difference
        !            28: in behavior between native and cross versions, but I didn't investigate
        !            29: it closely at the time.  I assumed that the native version had forced
        !            30: alignment and the (newer) cross version had stopped doing so for some
        !            31: reason, but it may well have been this bug manifesting itself.
        !            32: 
        !            33: Simply taking out the force-even code in the second pass appears to be
        !            34: a workable fix (see enclosed patch).  It cures the problem in my test
        !            35: program, and running all our major cross-compiled code through the new
        !            36: version produces byte-for-byte-identical output, so it appears not to
        !            37: be fouling up anything else.
        !            38: 
        !            39:                                          Henry Spencer at U of Toronto Zoology
        !            40:                                           [email protected]   utzoo!henry
        !            41: 
        !            42: *** as26.c.old Thu Aug 16 13:27:38 1990
        !            43: --- as26.c     Thu Aug 16 13:27:18 1990
        !            44: ***************
        !            45: *** 124,130 ****
        !            46:        case T__TEXT:
        !            47:        case T__DATA:
        !            48:        case T__BSS:
        !            49: !              *dot=(*dot+1)&~1;
        !            50:                savdot[*dotrel-T_TEXT] = *dot;
        !            51:                if (passno!=0 && t!=T__BSS) {
        !            52:                        fseek(txtf,tseek[t-T__TEXT],0);
        !            53: --- 124,130 ----
        !            54:        case T__TEXT:
        !            55:        case T__DATA:
        !            56:        case T__BSS:
        !            57: ! /*           *dot=(*dot+1)&~1;               */
        !            58:                savdot[*dotrel-T_TEXT] = *dot;
        !            59:                if (passno!=0 && t!=T__BSS) {
        !            60:                        fseek(txtf,tseek[t-T__TEXT],0);
        !            61: 

unix.superglobalmegacorp.com

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