Date: Fri, 15 Nov 2002 02:42:20 -0800 (PST) From: Matthew Dillon <dillon@apollo.backplane.com> To: Alfred Perlstein <bright@mu.org> Cc: Nate Lawson <nate@root.org>, hackers@FreeBSD.ORG Subject: Success! (Re: cvs commit: src/bin/sleep sleep.c) Message-ID: <200211151042.gAFAgKjP008277@apollo.backplane.com> References: <200211142257.gAEMvdxX071776@apollo.backplane.com> <Pine.BSF.4.21.0211141538440.44091-100000@root.org> <20021115004017.GE50692@elvis.mu.org>
next in thread | previous in thread | raw e-mail | index | archive | help
I have sucessfully created a mini-C-like library and compiled /bin/sleep against it. (This is in stable, by the way, so its still a bit bigger then it needs to be). My minic library is: apollo:/usr/src/lib/libminic# ls -la total 30 drwxr-xr-x 2 root wheel 512 Nov 15 02:17 . drwxr-xr-x 59 root wheel 1536 Nov 15 00:17 .. -rw-r--r-- 1 root wheel 3410 Nov 15 02:16 Makefile -rw-r--r-- 1 root wheel 2076 Nov 15 02:02 __error.c -rw-r--r-- 1 root wheel 1812 Nov 15 00:19 __main.c -rw-r--r-- 1 root wheel 1701 Nov 15 02:26 ctype.c -rw-r--r-- 1 root wheel 940 Nov 15 01:58 exit.c -rw-r--r-- 1 root wheel 192 Nov 15 01:43 minic.h -rw-r--r-- 1 root wheel 827 Nov 15 02:01 panic.c -rw-r--r-- 1 root wheel 7471 Nov 15 01:43 pfmt.c -rw-r--r-- 1 root wheel 736 Nov 15 01:52 printf.c -rw-r--r-- 1 root wheel 1336 Nov 15 01:51 sprintf.c -rw-r--r-- 1 root wheel 1089 Nov 15 01:41 stdio.c Not quite complete, so I haven't posted a patch set yet. I still need to implement more dummy stdio, maybe add some really simple buffering, and add a few more size prefixes to pfmt, but basically that's all that I have left to do. The Makefile does all the magic to pull in parts of libc and libstand. The static binary for sleep is: apollo:/usr/src/bin/sleep# ls -la obj/sleep -rwxr-xr-x 1 root wheel 12085 Nov 15 02:26 sleep apollo:/usr/src/bin/sleep# size obj/sleep text data bss dec hex filename 6699 604 76 7379 1cd3 obj/sleep The libminic shared library is also tiny, only 47K. I expect when all is said and done it will wind up being around 70K. apollo:/usr/src/bin/sleep# ls -la /usr/lib/*minic* -r--r--r-- 1 root wheel 226976 Nov 15 02:26 /usr/lib/libminic.a lrwxr-xr-x 1 root wheel 13 Nov 15 02:26 /usr/lib/libminic.so -> libminic.so.2 -r--r--r-- 1 root wheel 47120 Nov 15 02:26 /usr/lib/libminic.so.2 The only thing I need to deal with is how to construct the link line without libc and with all the proper crt's. I could use some help there. Here is the nm output for the sleep binary. -Matt w _DYNAMIC w __deregister_frame_info w __register_frame_info 080480ac ? _init 080480b8 T _start 0804813c t __do_global_dtors_aux 0804813c t gcc2_compiled. 08048190 t fini_dummy 08048198 t frame_dummy 080481bc t init_dummy 080481c4 T main 080481c4 t gcc2_compiled. 08048314 T usage 08048338 T strtol 080484d8 T getopt 08048654 T __maskrune 080486c4 T __isctype 080486e0 T atexit 08048710 T exit 08048734 T __exit 08048734 W _exit 08048748 T _nanosleep 08048748 W nanosleep 08048754 T strchr 08048770 T malloc 08048804 T free 08048864 T calloc 080488a8 T realloc 0804890c T reallocf 08048938 T mallocstats 08048960 T znalloc 080489d0 T zfree 08048ac4 T zextendPool 08048b10 T zallocstats 08048b84 T panic 08048bbc T printf 08048bd0 T vprintf 08048bec T __srget 08048c30 T __swbuf 08048c60 T putchar 08048c68 T fwrite 08048c9c T fprintf 08048cb8 T bzero 08048d18 T bcopy 08048df0 T sbrk 08048e1c T .cerror 08048e30 T __pfmt 08049454 T strcpy 08049478 T memset 080494f8 T __error_unthreaded 080494f8 W __error 0804950c T _write 0804950c W write 08049520 T _read 08049520 W read 0804952c t __do_global_ctors_aux 0804952c t gcc2_compiled. 08049554 t init_dummy 0804955c ? _fini 080495a0 r copyright 08049620 r rcsid 0804aae0 D __progname 0804aae4 d p.3 0804aae8 d completed.4 0804aaec D opterr 0804aaec d force_to_data 0804aaf0 D optind 0804ab00 D QCharAry 0804ac00 D __sF 0804ad08 D __stdinp 0804ad0c D __stdoutp 0804ad10 D __stderrp 0804ad20 D .minbrk 0804ad24 D .curbrk 0804ad28 ? __EH_FRAME_BEGIN__ 0804ad28 ? __FRAME_END__ 0804ad28 d force_to_data 0804ad2c ? __CTOR_LIST__ 0804ad30 ? __CTOR_END__ 0804ad34 ? __DTOR_LIST__ 0804ad38 ? __DTOR_END__ 0804ad3c A __bss_start 0804ad3c A _edata 0804ad3c b object.11 0804ad74 B environ 0804ad78 B optarg 0804ad7c B optreset 0804ad80 B optopt 0804ad84 B errno 0804ad88 A _end 0804ad88 A end To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200211151042.gAFAgKjP008277>