SYSVR2 ns32000 cross-tools

Author: Alexander Voropai alec@sensi.org\\ Oct 2017\\ Main page: [[ns32ksoft&#genix|NS32K Software: GENIX]] It is possible to build a sort-of "crosstools" under SYSVR2 system (i.e. [[http://gunkies.org/wiki/Unix_SYSVr2|SYSVR2 VAX]]) from the ns32000 SYSVR2 sources. **NOTE!** It will break a native build system, make a backup before installation. You can build some ns32000 utilities in the /usr/src/cmd/sgs/ : ''as'', ''ar'', ''ld'', ''size'', ''strip'', ''nm'' e.t.c. . Some sgs (SGS - Software Generation System) utilities has no ns32000 ports i.e. disassembler ''dis''. It is possible also to build a ''cc'' compiler for the ns32000. Short "crossbuild" HOWTO: * get a working SYSVR2 i.e. VAX * rename /usr/src to /usr/src.VAX * import ns32000 SYSVR2 sources into /usr/src (i.e. via tar/tape) * rename /usr/include to /usr/include.VAX * mkdir /usr/include /usr/include/sys * cd /usr/src (NEW!) and execute ":mkhead" and ":mksyshead" * modify shell script /bin/vax: it should return error, add a "exit 255" * create a shell script /bin/ns32000 and make it executable: it should return success, add a line "exit 0" * define shell variables: * $ CC="cc -Uvax -Dns32000" * $ export CC You can now build "sgs" and "cc" for ns32000 : cd /usr/src/cmd/sgs/\\ make -f sgs.mk cd /usr/src/cmd/cc\\ make -f cc.mk This will build VAX SYSVR2 execulables which accept ns32000 syntax and emit ns32000 instructions and work with 32000 COFF object files (crosstools). Full build logs: [[http://wiki.sensi.org/download/ns32k/ns32000_sgs.txt|ns32000_sgs.txt]], [[http://wiki.sensi.org/download/ns32k/ns32000_cc.txt|ns32000_cc.txt]] To make a backup, rename native utilities with .VAX extension:\\ mv /bin/cc /bin/cc.VAX\\ mv /lib/c2 /lib/c2.VAX\\ mv /lib/ccom /lib/ccom.VAX\\ mv /lib/cpp /lib/cpp.VAX mv /bin/convert /bin/convert.VAX\\ mv /bin/lorder /bin/lorder.VAX\\ mv /bin/strip /bin/strip.VAX\\ mv /bin/size /bin/size.VAX\\ mv /bin/dump /bin/dump.VAX\\ mv /bin/nm /bin/nm.VAX\\ mv /bin/as /bin/as.VAX\\ mv /bin/ld /bin/ld.VAX\\ mv /bin/ar /bin/ar.VAX Copy new compiler:\\ cp /usr/src/cmd/cc/pcc/cc /bin/cc\\ cp /usr/src/cmd/cc/pcc/ns32000/comp /lib/ccom\\ cp /usr/src/cmd/cc/pci/ns32000/c2 /lib/c2\\ cp /usr/src/cmd/cpp/cpp /lib/cpp Copy new binutils:\\ cp /usr/src/cmd/sgs/unix_conv/ns32000/convert /bin/convert\\ cp /usr/src/cmd/sgs/lorder/ns32000/lorder /bin/lorder\\ cp /usr/src/cmd/sgs/strip/ns32000/strip /bin/strip\\ cp /usr/src/cmd/sgs/size/ns32000/size /bin/size\\ cp /usr/src/cmd/sgs/dump/ns32000/dump /bin/dump\\ cp /usr/src/cmd/sgs/nm/ns32000/nm /bin/nm\\ cp /usr/src/cmd/sgs/as/ns32000/as /bin/as\\ cp /usr/src/cmd/sgs/ld/ns32000/ld /bin/ld\\ cp /usr/src/cmd/sgs/ar/ns32000/ar /bin/ar **Note!** Command options are slightly different on the VAX and on the ns320000. Use a ns32000 manpages. To create a ns32000 binaries you need /lib/crt0.o and /lib/libc.a (TODO. Compilator creates incorrect assembly floating point directives for /usr/src/lib/libc/port/gen/atof.c). As a temporary solution take it from the Opus5 SYSV system. The resulting tools will produce ns32000 binaries compatible with Opus5 SYSV COFF and GENIX 2 (based on the SYSVR2). **Note1** Seems there is more correct way to cleate a "crosstools" on the SYSVR2 with ''cc -B'' option (add a "base" prefix to ''as'', ''ld'' and other tools i.e. ''/usr/lib/n''). Not tested. **Note2** There is also a working SYSVR3 system under [[https://loomcom.com/3b2/emulator/|3B2 SIMH]] emulator. Not tested yet.