[PATCH] More portability fixes

Denys Vlasenko vda.linux at googlemail.com
Sun Sep 13 12:41:43 UTC 2009


On Sunday 13 September 2009 08:16, Dan Fandrich wrote:
> On Sat, Sep 12, 2009 at 02:50:06PM +0200, Denys Vlasenko wrote:
> > It is almost never acceptable for busybox to increase code size
> > with no benefit in the behavior whatsoever.
> 
> I would agree, except that BusyBox that is exploiting proprietary or
> cutting-edge features to reduce the code size to begin with. Reduced
> portability is the price for that reduced size.

Yes.

> > From the first patch, I am applying everything except these two parts:
> > (1) here alloca would probably work better (won't increase code):
> 
> I considered that, but alloca() isn't standardized, so it's not clear
> it would be any better than the original.  I'm attaching an alloca version
> of that portion of the patch, anyway.

Unfortunately, with gcc-4.3.1:

function                                             old     new   delta
func_exec                                            276     287     +11

I propose to solve it by adding a new option, USE_PORTABLE_CODE,
in top-level Config.in, and conditionalze on it:

#if ENABLE_USE_PORTABLE_CODE
       char **argv = alloca(sizeof(char*) * (ap->exec_argc + 1));
#else /* gcc 4.3.1 generates smaller code: */
       char *argv[ap->exec_argc + 1];
#endif

See attached patch.
--
vda
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 7.patch
Type: text/x-diff
Size: 1255 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20090913/563b945f/attachment.bin>


More information about the busybox mailing list