keith@csli.Stanford.EDU (Keith Nishihara) (01/04/90)
System: DecStation 3100 running Ultrix:
Ultrix Worksystem V2.0 (Rev. 7) System #1: Mon Jul 31 15:49:08 PDT 1989
/bin/ld: version 1.31. (strings shows dates from early 87 to 11/88).
With certain sizes of executable objects, the final linking phase introduces
illegal instructions, where the library or object module from which
those intructions were obtained is fine. Symptom: core dump -- illegal
instruction. Fix: alter the alignment of instructions on the pages,
by introducing some additional code early in the program: e.g.
#ifdef SPACING
printf("This is a spacer to move the following instructions forward");
printf("This is a spacer to move the following instructions forward");
printf("This is a spacer to move the following instructions forward");
[perhaps 20 or 30 lines total]
printf("This is a spacer to move the following instructions forward");
#endif
Note that if illegal instructions are observed in the code for a function,
they can be seen before _any_ instructions
have been executed (it is not a random pointer problem), and the relink with
altered alignment generates _different_ instructions for the same function
from the same identical library (the library file is _unchanged_.)
Does anyone have a definitive explanation, or better yet, a new /bin/ld
for 1.31 which works.
Neil/. Neil%teleos.com@ai.sri.com
P.S. Many programs, including several X clients, and g++ 1.36.2, for example,
have illegal instructions which go away if you add a few printf statements
somewhere before the illegal instructions. I cannot believe that no one
at DEC has seen this problem. Nor can I believe a fixed version does not
exist.