From 430e386b9e69bf3a71c0e2cc06b7094d53ab6501 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Fri, 20 Oct 2000 00:03:55 +0000 Subject: Strip all object files of all non global symbols and .note and .comment, saving a lot of space in the resultant binaries... -Erik --- Makefile | 2 +- include/fcntl.h | 2 ++ libc/inet/Makefile | 2 ++ libc/inet/rpc/Makefile | 4 ++++ libc/misc/assert/Makefile | 4 +++- libc/misc/ctype/Makefile | 1 + libc/misc/fnmatch/Makefile | 4 +++- libc/misc/glob/Makefile | 4 +++- libc/misc/internals/Makefile | 4 +++- libc/misc/lsearch/Makefile | 4 +++- libc/misc/regex/Makefile | 4 +++- libc/misc/time/Makefile | 4 +++- libc/pwd_grp/Makefile | 7 ++++++- libc/signal/Makefile | 6 ++++-- libc/stdio/Makefile | 9 ++++++++- libc/stdlib/Makefile | 6 ++++++ libc/stdlib/malloc-simple/Makefile | 5 ++++- libc/stdlib/malloc/Makefile | 5 ++++- libc/string/Makefile | 6 +++++- libc/string/strsignal.c | 36 ++++++++++++++++++++++++++++++++++-- libc/sysdeps/linux/common/Makefile | 4 +++- libc/sysdeps/linux/i386/Makefile | 17 ++++++++++++++--- libc/termios/Makefile | 5 ++++- libc/unistd/Makefile | 4 ++++ 24 files changed, 127 insertions(+), 22 deletions(-) diff --git a/Makefile b/Makefile index 0ec7c135a..6a3ad03df 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ -DIRS = misc pwd_grp stdio string termios unistd net signal stdlib sysdeps +DIRS = io misc pwd_grp stdio string termios unistd net signal stdlib sysdeps all: libc.a diff --git a/include/fcntl.h b/include/fcntl.h index deea51182..744f5ae4f 100644 --- a/include/fcntl.h +++ b/include/fcntl.h @@ -57,11 +57,13 @@ __BEGIN_DECLS /* Do the file control operation described by CMD on FD. The remaining arguments are interpreted depending on CMD. */ +extern int __fcntl __P ((int __fd, int __cmd, ...)); extern int fcntl __P ((int __fd, int __cmd, ...)); /* Open FILE and return a new file descriptor for it, or -1 on error. OFLAG determines the type of access used. If O_CREAT is on OFLAG, the third argument is taken as a `mode_t', the mode of the created file. */ +extern int __open __P ((__const char *__file, int __oflag, mode_t mode)); #ifndef __USE_FILE_OFFSET64 extern int open __P ((__const char *__file, int __oflag, ...)); #else diff --git a/libc/inet/Makefile b/libc/inet/Makefile index 8c846370f..95432060e 100644 --- a/libc/inet/Makefile +++ b/libc/inet/Makefile @@ -47,9 +47,11 @@ ar-target: $(OBJS) $(MOBJ): $(MSRC) $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o + $(STRIPTOOL) -x -R .note -R .comment $*.o $(MOBJ2): $(MSRC2) $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o + $(STRIPTOOL) -x -R .note -R .comment $*.o $(OBJS): Makefile diff --git a/libc/inet/rpc/Makefile b/libc/inet/rpc/Makefile index dfa68e055..d62851ea9 100644 --- a/libc/inet/rpc/Makefile +++ b/libc/inet/rpc/Makefile @@ -39,6 +39,10 @@ COBJS=$(patsubst %.c,%.o, $(CSRC)) all: $(COBJS) $(LIBC) +$(COBJS): + $(CC) $(CFLAGS) $< -c $*.c -o $*.o + $(STRIPTOOL) -x -R .note -R .comment $*.o + $(LIBC): $(COBJS) $(AR) $(ARFLAGS) $(LIBC) $(COBJS) diff --git a/libc/misc/assert/Makefile b/libc/misc/assert/Makefile index 68cbaec82..75f613b7e 100644 --- a/libc/misc/assert/Makefile +++ b/libc/misc/assert/Makefile @@ -35,7 +35,9 @@ $(LIBC): ar-target ar-target: $(OBJS) $(AR) $(ARFLAGS) $(LIBC) $(OBJS) -$(OBJS): Makefile +$(COBJS): + $(CC) $(CFLAGS) $< -c $*.c -o $*.o + $(STRIPTOOL) -x -R .note -R .comment $*.o clean: rm -f *.[oa] *~ core diff --git a/libc/misc/ctype/Makefile b/libc/misc/ctype/Makefile index 128881f28..c77d49f69 100644 --- a/libc/misc/ctype/Makefile +++ b/libc/misc/ctype/Makefile @@ -38,6 +38,7 @@ ar-target: $(OBJS) $(MOBJ): $(MSRC) $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o + $(STRIPTOOL) -x -R .note -R .comment $*.o $(OBJS): Makefile diff --git a/libc/misc/fnmatch/Makefile b/libc/misc/fnmatch/Makefile index 3ee0d1d02..1554d7c00 100644 --- a/libc/misc/fnmatch/Makefile +++ b/libc/misc/fnmatch/Makefile @@ -35,7 +35,9 @@ $(LIBC): ar-target ar-target: $(OBJS) $(AR) $(ARFLAGS) $(LIBC) $(OBJS) -$(OBJS): Makefile +$(COBJS): + $(CC) $(CFLAGS) $< -c $*.c -o $*.o + $(STRIPTOOL) -x -R .note -R .comment $*.o clean: rm -f *.[oa] *~ core diff --git a/libc/misc/glob/Makefile b/libc/misc/glob/Makefile index 83f9383c6..864eff110 100644 --- a/libc/misc/glob/Makefile +++ b/libc/misc/glob/Makefile @@ -35,7 +35,9 @@ $(LIBC): ar-target ar-target: $(OBJS) $(AR) $(ARFLAGS) $(LIBC) $(OBJS) -$(OBJS): Makefile +$(COBJS): + $(CC) $(CFLAGS) $< -c $*.c -o $*.o + $(STRIPTOOL) -x -R .note -R .comment $*.o clean: rm -f *.[oa] *~ core diff --git a/libc/misc/internals/Makefile b/libc/misc/internals/Makefile index 3bddcfdc1..a09395962 100644 --- a/libc/misc/internals/Makefile +++ b/libc/misc/internals/Makefile @@ -35,7 +35,9 @@ $(LIBC): ar-target ar-target: $(OBJS) $(AR) $(ARFLAGS) $(LIBC) $(OBJS) -$(OBJS): Makefile +$(COBJS): + $(CC) $(CFLAGS) $< -c $*.c -o $*.o + $(STRIPTOOL) -x -R .note -R .comment $*.o clean: rm -f *.[oa] *~ core diff --git a/libc/misc/lsearch/Makefile b/libc/misc/lsearch/Makefile index 5a0fb60a6..8e8fc690a 100644 --- a/libc/misc/lsearch/Makefile +++ b/libc/misc/lsearch/Makefile @@ -35,7 +35,9 @@ $(LIBC): ar-target ar-target: $(OBJS) $(AR) $(ARFLAGS) $(LIBC) $(OBJS) -$(OBJS): Makefile +$(COBJS): + $(CC) $(CFLAGS) $< -c $*.c -o $*.o + $(STRIPTOOL) -x -R .note -R .comment $*.o clean: rm -f *.[oa] *~ core diff --git a/libc/misc/regex/Makefile b/libc/misc/regex/Makefile index 8480c650e..c4c13f6cf 100644 --- a/libc/misc/regex/Makefile +++ b/libc/misc/regex/Makefile @@ -35,7 +35,9 @@ $(LIBC): ar-target ar-target: $(OBJS) $(AR) $(ARFLAGS) $(LIBC) $(OBJS) -$(OBJS): Makefile +$(COBJS): + $(CC) $(CFLAGS) $< -c $*.c -o $*.o + $(STRIPTOOL) -x -R .note -R .comment $*.o clean: rm -f *.[oa] *~ core diff --git a/libc/misc/time/Makefile b/libc/misc/time/Makefile index aac0d7762..ec8199c69 100644 --- a/libc/misc/time/Makefile +++ b/libc/misc/time/Makefile @@ -36,7 +36,9 @@ $(LIBC): ar-target ar-target: $(OBJS) $(AR) $(ARFLAGS) $(LIBC) $(OBJS) -$(OBJS): Makefile +$(COBJS): + $(CC) $(CFLAGS) $< -c $*.c -o $*.o + $(STRIPTOOL) -x -R .note -R .comment $*.o clean: rm -f *.[oa] *~ core diff --git a/libc/pwd_grp/Makefile b/libc/pwd_grp/Makefile index b6ee4df8a..5b5218c27 100644 --- a/libc/pwd_grp/Makefile +++ b/libc/pwd_grp/Makefile @@ -37,7 +37,12 @@ $(LIBC): ar-target ar-target: $(OBJS) $(AR) $(ARFLAGS) $(LIBC) $(OBJS) -$(OBJS): Makefile +$(COBJS): + $(CC) $(CFLAGS) $< -c $*.c -o $*.o + $(STRIPTOOL) -x -R .note -R .comment $*.o + +$(OBJ): Makefile + __getgrent.c: config.h initgroups.c: config.h diff --git a/libc/signal/Makefile b/libc/signal/Makefile index bc81d0b09..f59f2cd27 100644 --- a/libc/signal/Makefile +++ b/libc/signal/Makefile @@ -24,7 +24,7 @@ TOPDIR=../ include $(TOPDIR)Rules.mak LIBC=$(TOPDIR)libc.a -CSRC=raise.c sys_siglist.c +CSRC=raise.c COBJS=$(patsubst %.c,%.o, $(CSRC)) OBJS=$(COBJS) @@ -35,7 +35,9 @@ $(LIBC): ar-target ar-target: $(OBJS) $(AR) $(ARFLAGS) $(LIBC) $(OBJS) -$(OBJS): Makefile +$(COBJS): + $(CC) $(CFLAGS) $< -c $*.c -o $*.o + $(STRIPTOOL) -x -R .note -R .comment $*.o clean: rm -f *.[oa] *~ core diff --git a/libc/stdio/Makefile b/libc/stdio/Makefile index 6955ed87f..2061a745d 100644 --- a/libc/stdio/Makefile +++ b/libc/stdio/Makefile @@ -50,14 +50,21 @@ ar-target: $(OBJS) $(MOBJ): $(MSRC) $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o + $(STRIPTOOL) -x -R .note -R .comment $*.o $(MOBJ2): $(MSRC2) $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o + $(STRIPTOOL) -x -R .note -R .comment $*.o $(MOBJ3): $(MSRC3) $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o + $(STRIPTOOL) -x -R .note -R .comment $*.o -$(OBJS): Makefile +$(COBJS): + $(CC) $(CFLAGS) $< -c $*.c -o $*.o + $(STRIPTOOL) -x -R .note -R .comment $*.o + +$(OBJ): Makefile clean: rm -f *.[oa] *~ core diff --git a/libc/stdlib/Makefile b/libc/stdlib/Makefile index a6bd08710..285080523 100644 --- a/libc/stdlib/Makefile +++ b/libc/stdlib/Makefile @@ -46,9 +46,15 @@ ar-target: $(OBJS) $(MOBJ): $(MSRC) $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o + $(STRIPTOOL) -x -R .note -R .comment $*.o $(MOBJ2): $(MSRC2) $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o + $(STRIPTOOL) -x -R .note -R .comment $*.o + +$(COBJS): + $(CC) $(CFLAGS) $< -c $*.c -o $*.o + $(STRIPTOOL) -x -R .note -R .comment $*.o $(OBJ): Makefile diff --git a/libc/stdlib/malloc-simple/Makefile b/libc/stdlib/malloc-simple/Makefile index 765bf28d0..decd2edb2 100644 --- a/libc/stdlib/malloc-simple/Makefile +++ b/libc/stdlib/malloc-simple/Makefile @@ -38,8 +38,11 @@ ar-target: $(OBJS) $(MOBJ): $(MSRC) $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o + $(STRIPTOOL) -x -R .note -R .comment $*.o -$(OBJ): Makefile +$(COBJS): + $(CC) $(CFLAGS) $< -c $*.c -o $*.o + $(STRIPTOOL) -x -R .note -R .comment $*.o clean: rm -f *.[oa] *~ core diff --git a/libc/stdlib/malloc/Makefile b/libc/stdlib/malloc/Makefile index 920276c10..c86e4f0ea 100644 --- a/libc/stdlib/malloc/Makefile +++ b/libc/stdlib/malloc/Makefile @@ -40,8 +40,11 @@ ar-target: $(OBJS) $(MOBJ): $(MSRC) $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o + $(STRIPTOOL) -x -R .note -R .comment $*.o -$(OBJ): Makefile +$(COBJS): + $(CC) $(CFLAGS) $< -c $*.c -o $*.o + $(STRIPTOOL) -x -R .note -R .comment $*.o clean: rm -f *.[oa] *~ core diff --git a/libc/string/Makefile b/libc/string/Makefile index 0bdb925fd..39d9f0b5d 100644 --- a/libc/string/Makefile +++ b/libc/string/Makefile @@ -47,11 +47,15 @@ ar-target: $(OBJS) $(MOBJ): $(MSRC) $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o + $(STRIPTOOL) -x -R .note -R .comment $*.o $(MOBJ1): $(MSRC1) $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o + $(STRIPTOOL) -x -R .note -R .comment $*.o -$(OBJS): Makefile +$(COBJS): + $(CC) $(CFLAGS) $< -c $*.c -o $*.o + $(STRIPTOOL) -x -R .note -R .comment $*.o clean: rm -f *.[oa] *~ core diff --git a/libc/string/strsignal.c b/libc/string/strsignal.c index e1f7ab129..ff4f69923 100644 --- a/libc/string/strsignal.c +++ b/libc/string/strsignal.c @@ -8,8 +8,40 @@ #include #include -extern __const char *__const _sys_siglist[_NSIG]; -extern __const char *__const sys_siglist[_NSIG]; +const char *const sys_siglist[NSIG] = { + "Unknown signal", + "Hangup", + "Interrupt", + "Quit", + "Illegal instruction", + "Trace/breakpoint trap", + "IOT trap/Abort", + "Bus error", + "Floating point exception", + "Killed", + "User defined signal 1", + "Segmentation fault", + "User defined signal 2", + "Broken pipe", + "Alarm clock", + "Terminated", + "Stack fault", + "Child exited", + "Continued", + "Stopped (signal)", + "Stopped", + "Stopped (tty input)", + "Stopped (tty output)", + "Possible I/O", + "CPU time limit exceeded", + "File size limit exceeded", + "Virtual time alarm", + "Profile signal", + "Window size changed", + "File lock lost", + "Power failure", + "Unused signal" +}; /********************** Function strsignal ************************************/ diff --git a/libc/sysdeps/linux/common/Makefile b/libc/sysdeps/linux/common/Makefile index 6ab1ff90b..06f4651b9 100644 --- a/libc/sysdeps/linux/common/Makefile +++ b/libc/sysdeps/linux/common/Makefile @@ -37,7 +37,9 @@ $(LIBC): ar-target ar-target: $(OBJ) $(AR) $(ARFLAGS) $(LIBC) $(OBJ) -$(OBJ): Makefile +$(COBJS): + $(CC) $(CFLAGS) $< -c $*.c -o $*.o + $(STRIPTOOL) -x -R .note -R .comment $*.o clean: rm -f *.[oa] *~ core diff --git a/libc/sysdeps/linux/i386/Makefile b/libc/sysdeps/linux/i386/Makefile index 695450961..4ec84b3be 100644 --- a/libc/sysdeps/linux/i386/Makefile +++ b/libc/sysdeps/linux/i386/Makefile @@ -31,9 +31,13 @@ ASMOBJS=$(shell ./list_syscalls.sh) SSRC=_start.S setjmp.S longjmp.S #fork.S #clone.S SOBJS=$(patsubst %.S,%.o, $(SSRC)) +MSRC=syscalls.c +MOBJ=read.o write.o __open.o close.o + CSRC=readdir.c #select.c COBJS=$(patsubst %.c,%.o, $(CSRC)) -OBJS=$(SOBJS) $(ASMOBJS) $(COBJS) + +OBJS=$(SOBJS) $(ASMOBJS) $(COBJS) $(MOBJ) all: $(OBJS) $(LIBC) @@ -45,12 +49,19 @@ ar-target: $(OBJS) $(ASMOBJS): $(ASMSRC) $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o + $(STRIPTOOL) -x -R .note -R .comment $*.o $(SOBJS): $(SSRC) + $(CC) $(CFLAGS) $< -c -o $*.o + $(STRIPTOOL) -x -R .note -R .comment $*.o -$(COBJS): $(CSRC) +$(MOBJ): $(MSRC) + $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o + $(STRIPTOOL) -x -R .note -R .comment $*.o -$(OBJS): Makefile +$(COBJS): + $(CC) $(CFLAGS) $< -c -o $*.o + $(STRIPTOOL) -x -R .note -R .comment $*.o clean: rm -f *.[oa] *~ core diff --git a/libc/termios/Makefile b/libc/termios/Makefile index 983567ab7..2ed6b7c5f 100644 --- a/libc/termios/Makefile +++ b/libc/termios/Makefile @@ -43,8 +43,11 @@ ar-target: $(OBJS) $(MOBJ): $(MSRC) $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o + $(STRIPTOOL) -x -R .note -R .comment $*.o -$(OBJS): Makefile +$(COBJS): + $(CC) $(CFLAGS) $< -c $*.c -o $*.o + $(STRIPTOOL) -x -R .note -R .comment $*.o clean: rm -f *.[oa] *~ core diff --git a/libc/unistd/Makefile b/libc/unistd/Makefile index a9593c36b..4e5e5fc8a 100644 --- a/libc/unistd/Makefile +++ b/libc/unistd/Makefile @@ -37,6 +37,10 @@ $(LIBC): ar-target subdirs ar-target: $(OBJS) $(AR) $(ARFLAGS) $(LIBC) $(OBJS) +$(COBJS): + $(CC) $(CFLAGS) $< -c $*.c -o $*.o + $(STRIPTOOL) -x -R .note -R .comment $*.o + $(OBJ): Makefile subdirs: $(patsubst %, _dir_%, $(DIRS)) -- cgit v1.2.3