barrett%hpisldab@HPLABS.HP.COM (Dave Barrett) (08/02/89)
Step 10 of the gcc install fails. gcc cannot compile itself and link with
the HP C library; ld aborts.
There is a big problem with 6.5 and beyond revisions of the OS.
On older systems (6.2 and before), the setjmp system call saved the
following registers: A2-A5/D2-D7. These systems didn't expect the
68881 and FPA registers to be saved. Setjmp.h also uses a bigger block
to save stuff than on previous revisions for this reason.
On newer systems, (6.5 and beyond), the compiler expects the 68881
registers FP2-FP8 and an FPA register to be preserved across subroutine
calls.
The above assumptions are only true for optimized code, hence the -O1
compiler option will get around this problem.
The 6.5 versions of HP's "ld" command and assembler co-operate to try
to prevent a mismatch between 6.2 and 6.5 code, as follows:
There is a new assembler directive called "version" which must appear and
is generated by the C compiler into the ".s" files.
version 0 - indicates a pre-6.5 system
version 1 - 68010 processor (no floating point processor)
version 2 - 68020 processor and the compiled code does not assume that
the floating point registers are preserved
version 3 - 68020 processar and the compiled code assumes the floating
point registers are preserved.
The assembler places this number (from the version) into the "a_stamp" field
of the struct exec in the file "/usr/include/a.out.h".
The ld command then checks for the following when attempting to link:
1) The a_stamp's of all .o and .a files agree (warning only)
2) If setjmp's definiton a_stamp is 3, (as it it in the 6.5 libraries)
and it is being called from a routine with an a_stamp of 0, the loader
will abort and not generate an a.out file.
THIS IS WHAT HAPPENS WITH gcc1.35
Some Suggested fixs (I don't understand enough to suggest more):
1) Use gnu assembler and linker. May have problems with linking with
HP compiled stuff? Especially setjmp.
2) Add a compiler directive in the Makefile for gcc for 6.5 and beyond.
If it's defined, make the compiler emit a "version" assembler directive.