Alexander E. Patrakov
2004-Jun-05 04:32 UTC
[klibc] Register parameters are unsafe with gcc 3.3.2
I have the following toolchain: $ ld --version GNU ld version 2.15.90.0.3 20040415 $ gcc --version gcc (GCC) 3.3.2 I attempted to build klibc with this toolchain. It builds without errors, but the included "ash" shell does not function properly. Testcase: read cmdline </proc/cmdline echo $cmdline The first command prints a message: cannot open /proc/cmdline: error 14 Other shell redirections don't work either. When I comment out the following line in klibc/klibc/arch/i386/MCONFIG: # REGPARM_OPT := -mregparm=3 -DREGPARM and rebuild klibc, everything works. Please take some action against this error, e.g. update the README file. -- Alexander E. Patrakov
H. Peter Anvin
2004-Jun-05 12:44 UTC
[klibc] Register parameters are unsafe with gcc 3.3.2
Alexander E. Patrakov wrote:> > Other shell redirections don't work either. When I comment out the > following line in klibc/klibc/arch/i386/MCONFIG: > > # REGPARM_OPT := -mregparm=3 -DREGPARM > > and rebuild klibc, everything works. Please take some action against > this error, e.g. update the README file. >It's not a gcc problem, it seems to be a bug in the klibc open() function. open() is a problematic function since it's technically defined as being varadic, and with regparm varadic and non-varadic functions have calling conventions. Thus, it's either a klibc or an ash problem, so it's in my court. I'll take care of it. -hpa
H. Peter Anvin
2004-Jun-07 10:24 UTC
[klibc] Register parameters are unsafe with gcc 3.3.2
Alexander E. Patrakov wrote:> H. Peter Anvin wrote: > >> Okay, I applied your patch, but the resulting sh binary is 60% larger >> than the old one - 90K instead of 55K (on i386.) I think this is >> sufficient enough of a delta that I think we need to ask the people >> here -- is this worth it, or is this bloat? > > The sh binary from busybox is 84924 bytes here (statically linked > against uclibc). Anything over that is probably bloat. >It's about that size when stripped. It seems to me that we need to figure out where the extra bulk comes from and get rid of it, or fix the old ash, perhaps by porting fixes. -hpa