summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2015-12-12 01:26:59 +0100
committerMichael Olbrich <m.olbrich@pengutronix.de>2016-06-22 07:53:35 +0200
commitf73e963ec061570d5434878daf23cfdd1ff42725 (patch)
tree590b699f05a0ed834dcf379ba9d0edf99394aba3
parent334aa735636936f0180070eb390a7350f0614d0c (diff)
downloadOSELAS.Toolchain-f73e963ec061570d5434878daf23cfdd1ff42725.tar.gz
cleanup: improve
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
-rw-r--r--rules/post/cleanup.make49
1 files changed, 39 insertions, 10 deletions
diff --git a/rules/post/cleanup.make b/rules/post/cleanup.make
index 7bc89a0..7e8c511 100644
--- a/rules/post/cleanup.make
+++ b/rules/post/cleanup.make
@@ -1,18 +1,47 @@
+TOOLCHAIN_CLEANUP_HOST_DIRS := \
+ "$(PTXCONF_SYSROOT_CROSS)/lib" \
+ "$(PTXCONF_SYSROOT_CROSS)/libexec" \
+ "$(PTXCONF_SYSROOT_CROSS)/bin" \
+ "$(PTXCONF_SYSROOT_CROSS)/$(call remove_quotes,$(PTXCONF_GNU_TARGET))/bin"
+
$(STATEDIR)/world.cleanup: $(STATEDIR)/world.targetinstall
@$(call targetinfo)
@find "$(PTXCONF_SYSROOT_CROSS)/"* -depth -type d -print0 | \
xargs -r -0 -- rmdir -v --ignore-fail-on-non-empty --
- find \
- "$(PTXCONF_SYSROOT_CROSS)/libexec/" \
- "$(PTXCONF_SYSROOT_CROSS)/bin/" \
- "$(PTXCONF_SYSROOT_CROSS)/"*/bin/ \
- -type f \( -executable -o -name "*.so*" \) \
- | xargs -n1 --verbose strip || true
- find \
- "$(PTXCONF_SYSROOT_CROSS)/" \
- -type f \( -executable -o -name "*.so*" \) \
- | xargs chrpath -k -d 2>/dev/null || true
+# # remove all static host libraries
+ find $(TOOLCHAIN_CLEANUP_HOST_DIRS) \
+ -wholename "$(PTXCONF_SYSROOT_CROSS)/lib/gcc" -prune -o \
+ -type f -name "*.a" -print0 | xargs -0 -r rm
+# # strip all host binaries
+ find $(TOOLCHAIN_CLEANUP_HOST_DIRS) \
+ -wholename "$(PTXCONF_SYSROOT_CROSS)/lib/gcc" -prune -o \
+ -type f \( -executable -o -name "*.so*" \) -print0 \
+ | xargs -0 -n1 --verbose strip --preserve-dates || true
+# # make sure there are no bogus rpaths
+ find "$(PTXCONF_SYSROOT_CROSS)/$(call remove_quotes,$(PTXCONF_GNU_TARGET))" \
+ -type f \( -executable -o -name "*.so*" \) -print0 \
+ | xargs -0 chrpath -k -d 2>/dev/null || true
+ifdef PTXCONF_TOOLCHAIN_CONFIG_SYSROOT
+# # size compromise: compressed debug sections in static libraries are too large
+ find "$(PTXCONF_SYSROOT_CROSS)/sysroot-$(call remove_quotes,$(PTXCONF_GNU_TARGET))/usr/lib" \
+ -type f -name "*.a" -print0 \
+ | xargs -0 -n1 $(PTXCONF_SYSROOT_CROSS)/bin/$(PTXCONF_GNU_TARGET)-objcopy \
+ --preserve-dates --strip-debug --keep-file-symbols
+endif
+# # compress debug sections and remove any absolute paths
+ find "$(PTXCONF_SYSROOT_CROSS)" "$(PTXCONF_SYSROOT_CROSS)/lib/gcc" \
+ $(patsubst %,-wholename % -prune -o,$(TOOLCHAIN_CLEANUP_HOST_DIRS)) \
+ -type f \( -executable -o -name "*.so*" -o -name "*.a" -o -name "*.o" \) -print0 \
+ | xargs -0 -n1 $(PTXCONF_SYSROOT_CROSS)/bin/$(PTXCONF_GNU_TARGET)-objcopy \
+ --wildcard \
+ --strip-symbol=$(GLIBC_BUILDDIR)/*.o \
+ --strip-symbol=$(GLIBC_BUILDDIR)/*.os \
+ --strip-symbol=$(PTXCONF_SYSROOT_TARGET)/usr/lib/*.o \
+ --preserve-dates --compress-debug-sections 2>/dev/null || true
+ find "$(PTXCONF_SYSROOT_TARGET)" \
+ -name "*.cmd" -print0 | xargs -0 -r rm
+
@$(call touch)
world: $(STATEDIR)/world.cleanup