mirror of
https://git.busybox.net/buildroot.git
synced 2024-11-23 13:33:28 +08:00
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: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
parent
dcd0b3cc7b
commit
12d150727a
2
Makefile
2
Makefile
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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))
|
||||
|
@ -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
|
||||
|
@ -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))
|
||||
|
@ -68,8 +68,6 @@ endef
|
||||
define SUNXI_MALI_INSTALL_TARGET_CMDS
|
||||
$(SUNXI_MALI_MAKE_ENV) $(MAKE) -C $(@D)/lib \
|
||||
$(SUNXI_MALI_MAKE_OPTS) DESTDIR=$(TARGET_DIR) install
|
||||
# add execution permissions so that libraries are properly stripped
|
||||
chmod +x $(addprefix $(TARGET_DIR)/usr/lib/lib,EGL.so GLESv1_CM.so GLESv2.so Mali.so UMP.so*)
|
||||
$(if $(BR2_PACKAGE_SUNXI_MALI_DBG),
|
||||
$(INSTALL) -m 755 $(@D)/version/version $(TARGET_DIR)/usr/bin/maliver; \
|
||||
$(INSTALL) -m 755 $(@D)/test/test $(TARGET_DIR)/usr/bin/malitest
|
||||
|
Loading…
Reference in New Issue
Block a user