Strange pipe behaviour in the latest svn version

Denis Vlasenko vda.linux at googlemail.com
Thu Oct 19 18:08:45 UTC 2006


On Thursday 19 October 2006 19:30, Denis Vlasenko wrote:
> On Wednesday 18 October 2006 07:41, Alexander Griesser wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> > 
> > Denis Vlasenko wrote:
> > >> Did somebody revert
> > >> http://busybox.net/downloads/patches/svn-16017.patch
> > >> or is this a new bug?
> > > 
> > > Not reverted, it is simply gone along with old build system...
> > > 
> > > Alexander, can you check and let us know whether
> > > removing "-Wl,--sort-common -Wl,--gc-sections" helps?
> > 
> > If I understand this correctly, these flags are set automatically
> > when CONFIG_STATIC is defined, right?
> 
> No. They are used always. This is clearly visible in the
> Makefile fragment you quoted below:
> 
> > || ifdef CONFIG_STATIC
> > ||       cmd_busybox__ ?= $(srctree)/scripts/trylink $(CC) \
> > ||       -static \
> > ||       -o $@ \
> > ||       -Wl,--warn-common -Wl,--sort-common -Wl,--gc-sections \
> > ||       -Wl,--start-group $(busybox-all) -Wl,--end-group
> > || else
> > ||       cmd_busybox__ ?= $(srctree)/scripts/trylink $(CC) -o $@ \
> > ||       -Wl,--warn-common -Wl,--sort-common -Wl,--gc-sections \
> > ||       -Wl,--start-group $(busybox-all) -Wl,--end-group
> > || endif
> > 
> > I enabled CONFIG_STATIC, see here:
> > 
> > || tuxx at vi-edv003:~/busybox/busybox$ grep CONFIG_STATIC .config
> > || CONFIG_STATIC=y
> > || tuxx at vi-edv003:~/busybox/busybox$
> > 
> > I could try to not build busybox as a static binary...
> > OK, that works, here are the outputs:
> > 
> > Compiled as static binary:
> > || $ ldd /bin/busybox
> > || $       not a dynamic executable
> > || $ readlink -f /boot/vmlinuz
> > || /system/boot/vmlinuz.386
> > || $ readlink -f /boot/vmlinuz | cut -d. -f2
> > || $
> > 
> > Compiled as dynamic executable:
> > || $ ldd /bin/busybox
> > ||         linux-gate.so.1 =>  (0xffffe000)
> > ||         libcrypt.so.1 => /lib/tls/libcrypt.so.1 (0xb7ed7000)
> > ||         libm.so.6 => /lib/tls/libm.so.6 (0xb7eb1000)
> > ||         libc.so.6 => /lib/tls/libc.so.6 (0xb7d78000)
> > ||         /lib/ld-linux.so.2 (0xb7f09000)
> > || $ readlink -f /boot/vmlinuz
> > || /system/boot/vmlinuz.386
> > || $ readlink -f /boot/vmlinuz | cut -d. -f2
> > || 386
> > || $
> 
> Bingo! static busybox doesn't fflush stdout!

glibc source:

Makerules:
                 PROVIDE(__start___libc_atexit = .);\
                 __libc_atexit : { *(__libc_atexit) }\
                 PROVIDE(__stop___libc_atexit = .);\


libio/genops.c:

#ifdef text_set_element
text_set_element(__libc_atexit, _IO_cleanup);
#endif


include/libc-symbols.h:

#ifdef HAVE_ELF

/* Make SYMBOL, which is in the text segment, an element of SET.  */
# define text_set_element(set, symbol)  _elf_set_element(set, symbol)

/* These are all done the same way in ELF.
   There is a new section created for each set.  */
# ifdef SHARED
/* When building a shared library, make the set section writable,
   because it will need to be relocated at run time anyway.  */
#  define _elf_set_element(set, symbol) \
  static const void *__elf_set_##set##_element_##symbol##__ \
    __attribute__ ((used, section (#set))) = &(symbol)
# else


And of course:

void
exit (int status)
{
...
  RUN_HOOK (__libc_atexit, ());

  _exit (status);
}


http://sources.redhat.com/bugzilla/show_bug.cgi?id=3400
--
vda



More information about the busybox mailing list