Hi

 

The tool sstrip in staging_dir/host/bin/ seems to causing some minor
issue on the stripped binaries. Those binaries are able to run properly
and I haven't found any problem. But when I check some of the stripped
libraries I got

 

 

xw...@freeman-lptp1:~/openwrt$ file
./build_dir/ubicom32/root-ubicom32/usr/lib/

libssl.so.0.9.8

./build_dir/ubicom32/root-ubicom32/usr/lib/libssl.so.0.9.8: ELF 32-bit
MSB share

d object, version 1 (SYSV), corrupted section header size

xw...@freeman-lptp1:~/openwrt$ ubicom32-linux-uclibc-readelf -a
./build_dir/ubi

com32/root-ubicom32/usr/lib/libssl.so.0.9.8

 

ELF Header:

  Magic:   7f 45 4c 46 01 02 01 00 00 00 00 00 00 00 00 00

  Class:                             ELF32

  Data:                              2's complement, big endian

  Version:                           1 (current)

  OS/ABI:                            UNIX - System V

  ABI Version:                       0

  Type:                              DYN (Shared object file)

  Machine:                           Ubicom32 32-bit microcontrollers

  Version:                           0x1

  Entry point address:               0xbe50

  Start of program headers:          52 (bytes into file)

  Start of section headers:          0 (bytes into file)

  Flags:                             0x40000002

  Size of this header:               52 (bytes)

  Size of program headers:           32 (bytes)

  Number of program headers:         4

  Size of section headers:           0 (bytes)

  Number of section headers:         0

  Section header string table index: 0 <corrupt: out of range>

 

There are no sections in this file.

 

There are no sections in this file.

 

This simple change fixes the issue.

 

xw...@freeman-lptp1:~/openwrt$ git diff rules.mk diff --git a/rules.mk
b/rules.mk index 96ff9cb..135609e 100644

--- a/rules.mk

+++ b/rules.mk

@@ -169,7 +169,7 @@ ifneq ($(CONFIG_NO_STRIP),)  else

   RSTRIP:= \

     NM="$(TARGET_CROSS)nm" \

-    STRIP="$(STRIP)" \

+    STRIP="$(TARGET_CROSS)strip" \

     STRIP_KMOD="$(KERNEL_CROSS)strip --strip-unneeded
--remove-section=.comment

     $(SCRIPT_DIR)/rstrip.sh

 endif

 

However, I did notice that the stripped binaries are slightly smaller,
maybe 1%, when sstrip is used. So I wonder if anybody in this group knew
this 'corrupted' ELF header issue and thinks it is deliberately done so.

 

It seems odd that we use $(TARGET_CROSS)nm but do not use the target
specific strip tool when it is available though, even with a slightly
size benefit. 

 

Thanks

Freeman

 

 

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to