gcc-rt/README 644 473 0 4541 4700163144 6125 Here is the basic run-time support for people who want to run Xenix GCC without the Microsoft Library. If you don't know what all this means, you probably don't want this file right now, but please save it anyway for further use if you use Xenix GCC :-) makesseg.c / Program to generate minimal segment ordering object file. Sseg.uu / UUencoded output from makesseg Scrt0.s / C runtime start-off. start.c / Continued from Scrt0.s exit.c / Dummy for use when no stdio library is in sight. echo.c / Demonstration program. Doesn't implement -n or \ escapes. hack.S / Needed to complete the link of the above. Mainly syscalls. These were mostly written by Steve B. except for the system calls which were abstracted from an earlier comp.unix.xenix posting. I wrote this bit of prose and threw the kit together. To run demonstration module: 1) EITHER $ HERE=`pwd` $ cp makesseg.c $ cd $ gcc makesseg.c xenixomf.o $ ./a.out $ mv Sseg.o $HERE $ cd $HERE OR $ uudecode < Sseg.uu 2) $ gcc -nostdlib Sseg.o Scrt0.s start.c echo.c hack.S exit.c ./a.out should now be an executable image which contains no Microsoft library cruft at all. A couple of extra files: ftol.s / called by CC compiled gnulib, hopefully Microsoft compatible / but should be faster. altlib.sh / How to generate gnulib without CC at all, just using GCC You know how anything that's free comes with no warranty? Well, these come with even less. This distribution is intended for Dedicated Hackers Only. Sseg.o Scrt0.o could be moved to /usr/local/lib/gcc-{Sseg.o,Scrt0.o} for permanent use (Then DO NOT metion -nostdlib on the gcc control card) and start.o should be in your /usr/local/lib/gcc-Slibc.a along with the rest of your libc. Various bits of libc can be found in the comp.sources.unix archive and the BSD 4.3-tahoe free'd software tape. I have also successfully run the xercise test of Earl Chew 's stdio library which was posted to comp.os.minix (though I think I had to reverse the definitions of __STDIO_VA_LIST__ and __STDIO_VA__ and #undef _SIZE_T to make it work). Another possible stdio candidate is the one posted recently to alt.sources by Steve Summit . I've also thrown together a ctype package, If anyone wants it, mail me and I'll post it if I get fed up of mailing it out. free'd software tape. I have also successfully run the xercise test of Earl Chew 's stdio library which was posted to comp.os.minix (thoughgcc-rt/Sseg.uu 644 473 0 1123 4700163143 6511 $Header: /pdsrc/Local/RCS/Sseg.uu,v 1.1 90/05/01 18:53:24 root Exp $ Microsoft compatible(ish) Sseg.o created by makesseg.c begin 640 Sseg.o M@ H "%-S96'0 ,^1#0 " 1?96YD # D0\ 8&7V5D871A ( #VBP( ', end atible(ish) Sseg.o created by makesseg.c begin 640 Sseg.o M@ H "%-S96 #include #define I386 1 #define L_DGROUP 2 #define L_IGROUP 3 #define L_BEGDATA 4 #define L_ENDDATA 5 #define L_ENDCODE 6 #define L_C_ETEXT 7 #define L_BSS 8 #define L_DATA 9 #define L_CODE 10 #define L_EEND 11 #define L_NULL 12 #define L_UBSS 13 #define L_EDATA 14 #define L_STACK 15 #define L_UDATA 16 #define L_CONST 17 #define L_UTEXT 18 #define L_ENDBSS 19 extern int outfile; char *lnames[] = { "", "", "DGROUP", "IGROUP", "BEGDATA", "ENDDATA", "ENDCODE", "C_ETEXT", "BSS", "DATA", "CODE", "EEND", "NULL", "_BSS", "EDATA", "STACK", "_DATA", "CONST", "_TEXT", "ENDBSS" }; #define NLNAMES ((sizeof(lnames) / sizeof(char *)) - 1) struct segtable { unsigned char attrib; long length; unsigned nameindex; unsigned classindex; }; /* SEGDEF's */ static struct segtable segt[] = { {0, 0, 0, 0}, {SD_DWORD|SD_PUBLIC|SD_PGRES, 0, L_UTEXT, L_CODE}, {SD_DWORD|SD_PUBLIC|SD_PGRES, 0, L_C_ETEXT, L_ENDCODE}, {SD_PARA|SD_PUBLIC|SD_PGRES, 0, L_NULL, L_BEGDATA}, {SD_DWORD|SD_PUBLIC|SD_PGRES, 0, L_UDATA, L_DATA}, {SD_DWORD|SD_PUBLIC|SD_PGRES, 0, L_CONST, L_CONST}, {SD_DWORD|SD_PUBLIC|SD_PGRES, 0, L_EDATA, L_ENDDATA}, {SD_DWORD|SD_PUBLIC|SD_PGRES, 0, L_UBSS, L_BSS}, {SD_DWORD|SD_PUBLIC|SD_PGRES, 0, L_EEND, L_ENDBSS}, {SD_PARA|SD_STACK|SD_PGRES, 0, L_STACK, L_STACK}, }; #define SDEF_SIZE ((sizeof(segt) / sizeof(struct segtable)) - 1) unsigned int dgroup_tab[] = {3, 4, 5, 6, 7, 8, 9}; #define DGRPTABSIZ (sizeof(dgroup_tab) / sizeof(int)) unsigned int igroup_tab[] = {1, 2}; #define IGRPTABSIZ (sizeof(igroup_tab) / sizeof(int)) main() { int i; if ((outfile = creat("Sseg.o", 0644)) < 0) { fprintf(stderr, "cannot open Sseg.o\n"); exit(-1); } omf_theadr("Sseg.asm"); /* Lies, Lies */ omf_start_lnames(); for (i = 1; i <= NLNAMES; i++) omf_lnames(lnames[i]); omf_end_lnames(); for (i = 1; i <= SDEF_SIZE; i++) omf_segdef(I386, segt[i].attrib, 0, 0L, segt[i].length, segt[i].nameindex, segt[i].classindex); omf_start_grpdef(L_DGROUP); for (i = 0; i < DGRPTABSIZ; i++) omf_grpdef(dgroup_tab[i]); omf_end_grpdef(); omf_start_grpdef(L_IGROUP); for (i = 0; i < IGRPTABSIZ; i++) omf_grpdef(igroup_tab[i]); omf_end_grpdef(); omf_start_pubdef(I386, 0, 2, 0); omf_pubdef(I386, "_etext", 0, 0); omf_end_pubdef(); omf_start_pubdef(I386, 0, 8, 0); omf_pubdef(I386, "_end", 0, 0); omf_end_pubdef(); omf_start_pubdef(I386, 0, 6, 0); omf_pubdef(I386, "_edata", 0, 0); omf_end_pubdef(); omf_modend(I386); } ); omf_startgcc-rt/exit.c 644 473 0 211 4700163144 6330 /* $Header: /pdsrc/Local/RCS/exit.c,v 1.1 90/05/01 18:51:46 root Exp $ */ /* dummy(ish) exit */ exit(code) int code; { _exit(code); } i = 0; i < IGRPTABSIZ; i++) omf_grpdef(igroup_tab[i]); omf_end_grpdef(); omf_start_pubdef(I386, 0, 2, 0); omf_pubdef(I386, "_etext", 0, 0); omf_end_pubdef(); omf_start_pubdef(I386, 0, 8, 0); omf_pubdef(I386, "_end", 0, 0); omf_end_pubdef(); omf_start_pubdef(I386, 0, 6, 0); omf_pubdef(I386, "_edata", 0, 0); omf_end_pubdef(); omf_modend(I386); } ); omf_startgcc-rt/echo.c 644 473 0 555 4700163144 6310 /* * Minimal echo program that is VERY inefficient but doesn't use stdio */ strlen(register char *s) { register rval = 0; while (s && *s++) rval++; return rval; } main(int argc, char **argv) { int gotarg = argc > 1; while (--argc) { char *arg = *++argv; int l = strlen(arg); write(1, arg, l); write(1, " ", 1); } if (gotarg) write(1, "\n", 1); } 0); omf_end_pubdef(); omf_start_pubdef(I386, 0, 6, 0); omf_pubdef(I386, "_edata", 0, 0); omf_end_pubdef(); omf_modend(I386); } ); omf_startgcc-rt/hack.S 644 473 0 1664 4700163144 6302 / minimal 2 syscalls for demonstration echo program / Just write and _exit defined here. / Abstracted from syscall library by: / From: pgd@compuram.bbt.se / Message-Id: <9004162210.AA14300@compuram.bbt.se> / which was reposted to comp.unix.xenix by: / From: dws@uafsun4.uark.edu (David W. Summers) / Message-ID: <4088@uafhp.uark.edu> .set exit,1 .set write,4 #define sys(fun) movl $fun,%eax;.byte 0x9a,0,0,0,0,7,0 #define DEFSYS(fun,lbl) \ .globl lbl ; \ lbl: sys(fun) ; \ jb 1f ; \ ret ; \ 1: movl %eax,_errno ; \ movl $-1,%eax ; \ ret \ .text DEFSYS(write,_write) .globl __exit __exit: sys(exit) movl %eax,_errno movl $-1,%eax ret / Gross hack. This program _doesn't_ use flotaing point printf, but there's / no easy way we can tell when its needed, so the __fltused EXTDEF is / generated in the normal case for safety. SO we define it here to keep the / linker happy. .data .globl __fltused __fltused: .byte 0 n,lbl) \ .globl lbl ; \ lbl: sys(fun) ; \ jb 1f ; \ ret ; \ 1: movgcc-rt/Sseg.o 640 473 0 503 4700163310 6267 € Sseg.asmm–rDGROUPIGROUPBEGDATAENDDATAENDCODEC_ETEXTBSSDATACODEEENDNULL_BSSEDATASTACK_DATACONST_TEXTENDBSS ™ © ™™ ©¨™ i å™ © œ™ ©“™ ©¢™ ©  ™ © —™ uËšÿÿÿÿÿÿÿ 1šÿÿ\‘_etextÏ‘ _endÀ‘_edataö‹s case for safety. SO we define it here to keep the / linker happy. .data .globl __fltused __fltused: .byte 0 n,lbl) \ .globl lbl ; \ lbl: sys(fun) ; \ jb 1f ; \ ret ; \ 1: movgcc-rt/LETTER 644 473 0 1353 4700163144 6165 In article <1990May1.225803.17093@metro.ucc.su.OZ.AU> glenn@extro.ucc.su.oz.au (Glenn Geers) writes: > I'm trying to port gcc to a 386 box with no DS and I'd like to have a look > at dissasembled versions of crt[1n].o so I can figure out the order of things > on the runtime stack at startup. So if anyone has disassembled the starup files Steve's been on at me to wrap and post this for a while, (yes, I do the Christmas wrapping around here) so here it is. [ abstracted from README ] Here is the basic run-time support for people who want to run Xenix GCC without the Microsoft Library. If you don't know what all this means, you probably don't want this file right now, but please save it anyway for further use if you use Xenix GCC :-) out the order of things > on the runtime stack at startup. So if anyone has disassembled the starup files Steve's been on at me to wrap and post this for a while, (yes, I do the Christmas wrapping around here) so here it is. [ abstracted from README ] Here is the basic ru