Re: [PATCH] tar: Fix build error when CONFIG_UNCOMPRESS is not selected

2015-06-28 Thread Michael Tokarev
[Rehashing a thread from 3 years ago]

28.01.2013 11:48, Denys Vlasenko wrote:
 On Monday 28 January 2013 00:17, Abdoulaye Walsimou GAYE wrote:

 diff --git a/archival/libarchive/Kbuild.src 
 b/archival/libarchive/Kbuild.src
 index 58457fc..87e1ab9 100644
 --- a/archival/libarchive/Kbuild.src
 +++ b/archival/libarchive/Kbuild.src
 -lib-$(CONFIG_TAR)   += get_header_tar.o
 +lib-$(CONFIG_TAR)   += get_header_tar.o 
 decompress_uncompress.o

 /home/walsimou/embtoolkit.git/build/packages_build-mipsel-linux-mips32/busybox-1.20.2/archival/tar.c:1065:
  undefined reference to `unpack_Z_stream'
 /home/walsimou/embtoolkit.git/build/packages_build-mipsel-linux-mips32/busybox-1.20.2/archival/tar.c:1065:
  undefined reference to `unpack_Z_stream'
 /home/walsimou/embtoolkit.git/tools-mipsel-linux-mips32/bin/mipsisa32el-unknown-linux-uclibc-ld:
  busybox_unstripped: hidden symbol `unpack_Z_stream' isn't defined
 /home/walsimou/embtoolkit.git/tools-mipsel-linux-mips32/bin/mipsisa32el-unknown-linux-uclibc-ld:
  final link failed: Bad value
 mipsisa32el-unknown-linux-uclibc-clang: error: linker command failed with 
 exit code 1 (use -v to see invocation)
 
 
 I was able to build busybox-1.20.2 with this .config
 without errors.
 
 Looks like your compiler did not optimize this out:
 
 if (opt  OPT_COMPRESS)
 USE_FOR_MMU(xformer = unpack_Z_stream;)
 USE_FOR_NOMMU(xformer_prog = uncompress;)
 
 
 even though OPT_COMPRESS is a constant zero.

The same prob exists with clang, apparently,  Here's a bugreport
filed against debian package of busybox: http://bugs.debian.org/789499 .
The proposed fix is to apply the above patch only if building
with clang :)

Basically, I'm not sure relying on dead code elimination like this is
a good idea.  I mean, the code is eliminated, there's no if() statement
in the generated code, so it is okay, but it looks like clang still
records symbols referenced in the eliminated code.  Sometimes it
is actually a good idea to keep ref symbols, eg when you build an
executable which can load modules, so that modules will use symbols
in that executable.

Thanks,

/mjt

___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


Re: [PATCH v2] applets: Add installation of individual binaries

2015-06-28 Thread Thomas Petazzoni
Hello,

There has been no feedback to the below patch. We would like to support
this feature in Buildroot, but we don't like carrying significant
feature patches without knowing upstream's decision.

Would the Busybox developers be willing to merge such a feature (the
implementation details can of course be discussed/improved).

Thanks!

Thomas

On Thu, 21 May 2015 14:48:35 -0500, Clayton Shotwell wrote:
 From: Clayton Shotwell clsho...@rockwellcollins.com
 
 Adding support to install individual binaries if the option is
 enabled. This also installs the shared libbusybox.so.* library.
 
 Signed-off-by: Clayton Shotwell clsho...@rockwellcollins.com
 
 ---
 Changes v1 - v2:
   - Changed cp -a to cp -pPR (Suggested by Bernhard)
 ---
  Makefile.custom|  4 
  applets/install.sh | 26 --
  2 files changed, 28 insertions(+), 2 deletions(-)
 
 diff --git a/Makefile.custom b/Makefile.custom
 index f8a1283..891c9ce 100644
 --- a/Makefile.custom
 +++ b/Makefile.custom
 @@ -28,6 +28,10 @@ ifeq ($(CONFIG_INSTALL_SH_APPLET_SCRIPT_WRAPPER),y)
  INSTALL_OPTS:= --scriptwrapper
  endif
  endif
 +ifeq ($(CONFIG_FEATURE_INDIVIDUAL),y)
 +INSTALL_OPTS:= --binaries
 +LIBBUSYBOX_SONAME:= 0_lib/libbusybox.so.$(BB_VER)
 +endif
  install: $(srctree)/applets/install.sh busybox busybox.links
   $(Q)DO_INSTALL_LIBS=$(strip $(LIBBUSYBOX_SONAME) $(DO_INSTALL_LIBS)) \
   $(SHELL) $ $(CONFIG_PREFIX) $(INSTALL_OPTS)
 diff --git a/applets/install.sh b/applets/install.sh
 index 95b4719..f6c097e 100755
 --- a/applets/install.sh
 +++ b/applets/install.sh
 @@ -5,19 +5,26 @@ export LC_CTYPE=POSIX
  
  prefix=$1
  if [ -z $prefix ]; then
 - echo usage: applets/install.sh DESTINATION 
 [--symlinks/--hardlinks/--scriptwrapper]
 + echo usage: applets/install.sh DESTINATION 
 [--symlinks/--hardlinks/--binaries/--scriptwrapper]
   exit 1
  fi
  
 +# Source the configuration
 +. ./.config
 +
  h=`sort busybox.links | uniq`
  
 +sharedlib_dir=0_lib
 +
  linkopts=
  scriptwrapper=n
 +binaries=n
  cleanup=0
  noclobber=0
  case $2 in
   --hardlinks) linkopts=-f;;
   --symlinks)  linkopts=-fs;;
 + --binaries)  binaries=y;;
   --scriptwrapper) scriptwrapper=y;swrapall=y;;
   --sw-sh-hard)scriptwrapper=y;linkopts=-f;;
   --sw-sh-sym) scriptwrapper=y;linkopts=-fs;;
 @@ -40,8 +47,9 @@ if [ -n $DO_INSTALL_LIBS ]  [ $DO_INSTALL_LIBS != n 
 ]; then
   for i in $DO_INSTALL_LIBS; do
   rm -f $prefix/$libdir/$i || exit 1
   if [ -f $i ]; then
 + echoInstalling $i to the target at 
 $prefix/$libdir/
   cp -pPR $i $prefix/$libdir/ || exit 1
 - chmod 0644 $prefix/$libdir/$i || exit 1
 + chmod 0644 $prefix/$libdir/`basename $i` || exit 1
   fi
   done
  fi
 @@ -68,6 +76,7 @@ install -m 755 busybox $prefix/bin/busybox || exit 1
  
  for i in $h; do
   appdir=`dirname $i`
 + app=`basename $i`
   mkdir -p $prefix/$appdir || exit 1
   if [ $scriptwrapper = y ]; then
   if [ $swrapall != y ]  [ $i = /bin/sh ]; then
 @@ -78,6 +87,19 @@ for i in $h; do
   chmod +x $prefix/$i
   fi
   echo   $prefix/$i
 + elif [ $binaries = y ]; then
 + # Copy the binary over rather
 + if [ -e $sharedlib_dir/$app ]; then
 + if [ $noclobber = 0 ] || [ ! -e $prefix/$i ]; then
 + echoCopying $sharedlib_dir/$app to 
 $prefix/$i
 + cp -pPR $sharedlib_dir/$app $prefix/$i || exit 1
 + else
 + echo   $prefix/$i already exists
 + fi
 + else
 + echo Error: Could not find $sharedlib_dir/$app
 + exit 1
 + fi
   else
   if [ $2 = --hardlinks ]; then
   bb_path=$prefix/bin/busybox



-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox