Re: [PATCH] tools: sstrip: update to latest version

2020-11-18 Thread Rui Salvaterra
Hi, Paul,

On Wed, 18 Nov 2020 at 04:47, Paul Spooren  wrote:
>
> LGTM, tested and works fine.
>
> Could you please create a slightly more verbose patch name for
> 001-compile.patch?

Sure, I'll send a follow-up patch to make it more explanatory.

> Do you see any possible success in pinging upstream to unify their
> versioning? sstrip 3.1a still outputs version 2.0.

Heh… You already pinged them in July, I guess I'll add another
comment, but don't hold your breath, upstream doesn't seem very
responsive… :/

> Please create an additional patch to enable -z by default.

I'll also include this in the follow-up patch.

Thanks,
Rui

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


Re: [PATCH] tools: sstrip: update to latest version

2020-11-17 Thread Paul Spooren
On Wed Nov 11, 2020 at 1:53 PM HST, Rui Salvaterra wrote:
> Drop our local sstrip copy and use the current ELFKickers upstream
> version.
> Patch the original makefile in order to avoid building elftoc, since it
> fails
> with musl's elf.h. This is fine, since we only need sstrip anyway.
> Finally, add the possibility to pass additional arguments to sstrip (-z
> being
> the obvious candidate).
>
> Signed-off-by: Rui Salvaterra 

LGTM, tested and works fine.

Could you please create a slightly more verbose patch name for
001-compile.patch?

Do you see any possible success in pinging upstream to unify their
versioning? sstrip 3.1a still outputs version 2.0.

Please create an additional patch to enable -z by default.

> ---
> config/Config-build.in | 8 +
> rules.mk | 2 +-
> tools/sstrip/Makefile | 15 +-
> tools/sstrip/patches/001-compile.patch | 19 +
> tools/sstrip/src/sstrip.c | 466 -
> 5 files changed, 36 insertions(+), 474 deletions(-)
> create mode 100644 tools/sstrip/patches/001-compile.patch
> delete mode 100644 tools/sstrip/src/sstrip.c
>
> diff --git a/config/Config-build.in b/config/Config-build.in
> index 178afbdb94..c54bc243c5 100644
> --- a/config/Config-build.in
> +++ b/config/Config-build.in
> @@ -182,6 +182,14 @@ menu "Global build settings"
> help
> Specifies arguments passed to the strip command when stripping binaries.
>  
> + config SSTRIP_ARGS
> + string
> + prompt "Sstrip arguments"
> + depends on USE_SSTRIP
> + default ""
> + help
> + Specifies arguments passed to the sstrip command when stripping
> binaries.
> +
> config STRIP_KERNEL_EXPORTS
> bool "Strip unnecessary exports from the kernel image"
> help
> diff --git a/rules.mk b/rules.mk
> index e416126030..5c1c141c11 100644
> --- a/rules.mk
> +++ b/rules.mk
> @@ -328,7 +328,7 @@ else
> STRIP:=$(TARGET_CROSS)strip $(call qstrip,$(CONFIG_STRIP_ARGS))
> else
> ifneq ($(CONFIG_USE_SSTRIP),)
> - STRIP:=$(STAGING_DIR_HOST)/bin/sstrip
> + STRIP:=$(STAGING_DIR_HOST)/bin/sstrip $(call
> qstrip,$(CONFIG_SSTRIP_ARGS))
> endif
> endif
> RSTRIP= \
> diff --git a/tools/sstrip/Makefile b/tools/sstrip/Makefile
> index bab172a95a..590d183db0 100644
> --- a/tools/sstrip/Makefile
> +++ b/tools/sstrip/Makefile
> @@ -6,18 +6,19 @@
> #
> include $(TOPDIR)/rules.mk
>  
> -PKG_NAME:=sstrip
> -PKG_VERSION:=2.0
> +PKG_NAME:=ELFkickers
> +PKG_VERSION:=3.1a
> +
> +PKG_SOURCE_URL:=https://www.muppetlabs.com/~breadbox/pub/software
> +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
> +PKG_HASH:=06430880aaf4919c5f99fc629da7000347421668c2cf32bced2d401aac276508
> +
> PKG_RELEASE:=1
>  
> include $(INCLUDE_DIR)/host-build.mk
>  
> -define Host/Compile
> - $(HOSTCC) $(HOST_CFLAGS) -include endian.h -o $(HOST_BUILD_DIR)/sstrip
> src/sstrip.c
> -endef
> -
> define Host/Install
> - $(CP) $(HOST_BUILD_DIR)/sstrip $(STAGING_DIR_HOST)/bin/
> + $(CP) $(HOST_BUILD_DIR)/bin/sstrip $(STAGING_DIR_HOST)/bin/
> endef
>  
> define Host/Clean
> diff --git a/tools/sstrip/patches/001-compile.patch
> b/tools/sstrip/patches/001-compile.patch
> new file mode 100644
> index 00..9d3346edfb
> --- /dev/null
> +++ b/tools/sstrip/patches/001-compile.patch
> @@ -0,0 +1,19 @@
> +--- a/Makefile
>  b/Makefile
> +@@ -2,7 +2,7 @@
> +
> + prefix = /usr/local
> +
> +-PROGRAMS = elfls objres rebind sstrip elftoc ebfc infect
> ++PROGRAMS = elfls objres rebind sstrip ebfc infect
> +
> + all: $(PROGRAMS)
> +
> +@@ -19,7 +19,6 @@ elfls: bin/elfls doc/elfls.1
> + objres: bin/objres doc/objres.1
> + rebind: bin/rebind doc/rebind.1
> + sstrip: bin/sstrip doc/sstrip.1
> +-elftoc: bin/elftoc doc/elftoc.1
> + ebfc: bin/ebfc doc/ebfc.1
> + infect: bin/infect doc/infect.1
> +
> diff --git a/tools/sstrip/src/sstrip.c b/tools/sstrip/src/sstrip.c
> deleted file mode 100644
> index 12cf12e095..00
> --- a/tools/sstrip/src/sstrip.c
> +++ /dev/null
> @@ -1,466 +0,0 @@
> -/* http://www.muppetlabs.com/~breadbox/software/elfkickers.html */
> -
> -/* sstrip: Copyright (C) 1999-2001 by Brian Raiter, under the GNU
> - * General Public License. No warranty. See COPYING for details.
> - *
> - * Aug 23, 2004 Hacked by Manuel Novoa III  to
> - * handle targets of different endianness and/or elf class, making
> - * it more useful in a cross-devel environment.
> - */
> -
> -/* == original README ===
> - *
> - * sstrip is a small utility that removes the contents at the end of an
> - * ELF file that are not part of the program's memory image.
> - *
> - * Most ELF executables are built with both a program header table and
> a
> - * section header table. However, only the former is required in order
> - * for the OS to load, link and execute a program. sstrip attempts to
> - * extract the ELF header, the program header table, and its contents,
> - * leaving everything else in the bit bucket. It can only remove parts
> of
> - * the file that occur at the end, after the parts to be saved.
> However,
> - * this almost always includes the section header table, and
> occasi