Commit 12d15072 authored by Thomas Petazzoni's avatar Thomas Petazzoni Committed by Peter Korsgaard
Browse files

Strip *.so* and not only executable files



Our current stripping strategy requires that shared libraries have the
executable permission. However, this is by far not something
recognized as a standard behavior: Debian/Ubuntu distributions for
example do not have executable permissions on their
libraries. Therefore, pushing to upstream packages fixes that add the
executable permissions is not easy.

As a result, this commit improves the stripping logic so that it not
only strips the files that are executable, but also the ones that
match '*.so*', which should match both the shared libraries and the
dlopen()'able plugins, as long as they have a .so extension.

Thanks to this addition, a number of manual "chmod +x" done by various
packages can be removed.

Signed-off-by: default avatarThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: default avatarPeter Korsgaard <peter@korsgaard.com>
parent dcd0b3cc
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -487,7 +487,7 @@ STRIP_FIND_CMD = find $(TARGET_DIR)
ifneq (,$(call qstrip,$(BR2_STRIP_EXCLUDE_DIRS)))
STRIP_FIND_CMD += \( $(call finddirclauses,$(TARGET_DIR),$(call qstrip,$(BR2_STRIP_EXCLUDE_DIRS))) \) -prune -o
endif
STRIP_FIND_CMD += -type f -perm /111
STRIP_FIND_CMD += -type f \( -perm /111 -o -name '*.so*' \)
STRIP_FIND_CMD += -not \( $(call findfileclauses,libpthread*.so* $(call qstrip,$(BR2_STRIP_EXCLUDE_FILES))) \) -print

target-finalize:
+1 −3
Original line number Diff line number Diff line
@@ -103,14 +103,12 @@ HOST_GCC_FINAL_POST_INSTALL_HOOKS += HOST_GCC_FINAL_LD_LINUX_LINK
endif

# Cannot use the HOST_GCC_FINAL_USR_LIBS mechanism below, because we want
# libgcc_s to be installed in /lib and not /usr/lib. We add +x on
# libgcc_s to ensure it will be stripped.
# libgcc_s to be installed in /lib and not /usr/lib.
define HOST_GCC_FINAL_INSTALL_LIBGCC
	-cp -dpf $(HOST_DIR)/usr/$(GNU_TARGET_NAME)/lib*/libgcc_s* \
		$(STAGING_DIR)/lib/
	-cp -dpf $(HOST_DIR)/usr/$(GNU_TARGET_NAME)/lib*/libgcc_s* \
		$(TARGET_DIR)/lib/
	-chmod +x $(TARGET_DIR)/lib/libgcc_s.so.1
endef

HOST_GCC_FINAL_POST_INSTALL_HOOKS += HOST_GCC_FINAL_INSTALL_LIBGCC
+0 −7
Original line number Diff line number Diff line
@@ -57,12 +57,5 @@ endef
endif
endif # GETTEXT_TOOLS = n

# Library lacks +x so strip skips it
define GETTEXT_FIX_LIBRARY_MODE
	-chmod +x $(TARGET_DIR)/usr/lib/libintl.so*
endef

GETTEXT_POST_INSTALL_TARGET_HOOKS += GETTEXT_FIX_LIBRARY_MODE

$(eval $(autotools-package))
$(eval $(host-autotools-package))
+0 −8
Original line number Diff line number Diff line
@@ -20,14 +20,6 @@ endef
LIBICONV_POST_INSTALL_TARGET_HOOKS += LIBICONV_TARGET_REMOVE_PRELOADABLE_LIBS
LIBICONV_POST_INSTALL_STAGING_HOOKS += LIBICONV_STAGING_REMOVE_PRELOADABLE_LIBS

# Library lacks +x so strip skips it
define LIBICONV_FIX_LIBRARY_MODE
	-chmod +x $(TARGET_DIR)/usr/lib/libcharset.so*
	-chmod +x $(TARGET_DIR)/usr/lib/libiconv.so*
endef

LIBICONV_POST_INSTALL_TARGET_HOOKS += LIBICONV_FIX_LIBRARY_MODE

$(eval $(autotools-package))

# Configurations where the toolchain supports locales and the libiconv
+0 −7
Original line number Diff line number Diff line
@@ -66,11 +66,4 @@ define PCIUTILS_INSTALL_STAGING_CMDS
endef


# Library lacks +x so strip skips it
define PCIUTILS_FIX_LIBRARY_MODE
	-chmod +x $(TARGET_DIR)/usr/lib/libpci.so*
endef

PCIUTILS_POST_INSTALL_TARGET_HOOKS += PCIUTILS_FIX_LIBRARY_MODE

$(eval $(generic-package))
Loading