[BusyBox] uClibc optimization bug fix

Manuel Novoa III mnovoa3 at bellsouth.net
Fri Nov 17 17:05:21 UTC 2000


When optimization is turned on, the calls to lstat, fstat, and stat are inlined
in the corresponding _x* functions.  This causes busybox ls to dump core when
compiled against an optimized uClibc (stack overflow).

The patch below simply compiles the _x*.c funcitons with inlining turned off. 

<-------------------- diff starts here -------------------------->
Index: sysdeps/linux/common/Makefile
===================================================================
RCS file: /home/mjn3/cvsroot/uClibc/sysdeps/linux/common/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- sysdeps/linux/common/Makefile	2000/11/17 16:46:10	1.2
+++ sysdeps/linux/common/Makefile	2000/11/17 16:57:05
@@ -29,14 +29,16 @@
 CSRC =closedir.c dirfd.c getdents.c getdnnm.c gethstnm.c getpagesize.c \
 	isatty.c kernel_version.c mkfifo.c opendir.c readdir.c rewinddir.c \
 	seekdir.c setegid.c seteuid.c setpgrp.c statfix.c tell.c telldir.c \
-	wait.c wait3.c _xmknod.c _fxstat.c _lxstat.c _xstat.c libc_init.c tcgetatr.c
+	wait.c wait3.c _xmknod.c libc_init.c tcgetatr.c
 COBJS=$(patsubst %.c,%.o, $(CSRC))
 
+NISRC= _fxstat.c _lxstat.c _xstat.c
+NIOBJS=$(patsubst %.c,%.o, $(NISRC))
 
 MSRC=syscalls.c
 MOBJ=$(shell ./list_syscalls.sh)
 
-OBJ=$(COBJS) $(MOBJ)
+OBJ=$(COBJS) $(NIOBJS) $(MOBJ)
 
 all: $(OBJ) $(LIBC)
 
@@ -50,7 +52,11 @@
 	$(STRIPTOOL) -x -R .note -R .comment $*.o
 
 $(COBJS):
-	$(CC) $(CFLAGS) -g $< -c $*.c -o $*.o
+	$(CC) $(CFLAGS) $< -c $*.c -o $*.o
+	$(STRIPTOOL) -x -R .note -R .comment $*.o
+
+$(NIOBJS):
+	$(CC) $(CFLAGS) $< -c $*.c -o $*.o -fno-inline
 	$(STRIPTOOL) -x -R .note -R .comment $*.o
 
 clean:





More information about the busybox mailing list