* Use llvm-strip instead of binutils strip.

Two reasons:
    - with clang stage2, the dbg packages were not generated
    - strip fails on stretch and other ubuntu on some archives
  For this, I had to silent the --enable-deterministic-archives
  option (https://bugs.llvm.org/show_bug.cgi?id=39789).
  Thanks to Rebecca Palmer for the idea
  (Closes: #913946)
This commit is contained in:
Sylvestre Ledru 2018-11-26 16:12:17 +01:00
parent af6035d0d7
commit 6bcd0a96b2
4 changed files with 38 additions and 9 deletions

13
debian/changelog vendored
View File

@ -1,3 +1,16 @@
llvm-toolchain-7 (1:7.0.1~+rc2-8) unstable; urgency=medium
* Use llvm-strip instead of binutils strip.
Two reasons:
- with clang stage2, the dbg packages were not generated
- strip fails on stretch and other ubuntu on some archives
For this, I had to silent the --enable-deterministic-archives
option (https://bugs.llvm.org/show_bug.cgi?id=39789).
Thanks to Rebecca Palmer for the idea
(Closes: #913946)
-- Sylvestre Ledru <sylvestre@debian.org> Mon, 26 Nov 2018 16:12:02 +0100
llvm-toolchain-7 (1:7.0.1~+rc2-7) unstable; urgency=medium
* Bring back mips-rdhwr.diff as it isn't in rc2

View File

@ -101,3 +101,4 @@ D53557-hurd-self-exe-realpath.diff
# mips
mips-rdhwr.diff
strip-ignore-deterministic-archives.diff

View File

@ -0,0 +1,10 @@
Index: llvm-toolchain-7-7.0.1~+rc2/tools/llvm-objcopy/StripOpts.td
===================================================================
--- llvm-toolchain-7-7.0.1~+rc2.orig/tools/llvm-objcopy/StripOpts.td
+++ llvm-toolchain-7-7.0.1~+rc2/tools/llvm-objcopy/StripOpts.td
@@ -47,3 +47,5 @@ def x : Flag<["-"], "x">,
def strip_unneeded : Flag<["-", "--"], "strip-unneeded">,
HelpText<"Remove all symbols not needed by relocations">;
+
+def deterministic : Flag<["--"], "enable-deterministic-archives">;

23
debian/rules vendored
View File

@ -654,7 +654,7 @@ endif
# Delete the target build directory to save some space on the build systems
# All the files have been installed in $(CURDIR)/debian/tmp/ already
rm -rf $(TARGET_BUILD)
# rm -rf $(TARGET_BUILD)
override_dh_makeshlibs:
@ -678,25 +678,30 @@ override_dh_installman:
override_dh_strip:
: # Workaround some issues with stripping by using llvm's
if test ! -f $(CURDIR)/strip; then \
ln -s $(CURDIR)/debian/llvm-$(LLVM_VERSION)/usr/lib/llvm-$(LLVM_VERSION)/bin/llvm-strip $(CURDIR)/strip; \
fi
: # running out of diskspace on the buildds
find $(TARGET_BUILD) -name '*.o' -o -name '*.a' -type f | xargs -r rm -f
ifeq (0, $(strip $(shell dpkg --compare-versions $(DH_VERSION) ge 9.20160114; echo $$?)))
: # If we don't have the right version of debhelper, don't run the option
dh_strip -p libclang$(SONAME_EXT)-$(LLVM_VERSION) --dbgsym-migration='libclang$(SONAME_EXT)-$(LLVM_VERSION)-dbg (<< 1:7~svn327768-1~)'
dh_strip -p libllvm$(LLVM_VERSION) --dbgsym-migration='libllvm$(LLVM_VERSION)-dbg (<< 1:7~svn327768-1~)'
dh_strip -p liblldb-$(LLVM_VERSION) --dbgsym-migration='liblldb-$(LLVM_VERSION)-dbg (<< 1:7~svn327768-1~)'
dh_strip -p libomp$(SONAME_OPENMP)-$(LLVM_VERSION) --dbgsym-migration='libomp$(SONAME_OPENMP)-$(LLVM_VERSION)-dbg (<< 1:7~svn327768-1~)'
PATH=$(CURDIR)/:$$PATH dh_strip -p libclang$(SONAME_EXT)-$(LLVM_VERSION) --dbgsym-migration='libclang$(SONAME_EXT)-$(LLVM_VERSION)-dbg (<< 1:7~svn327768-1~)'
PATH=$(CURDIR)/:$$PATH dh_strip -p libllvm$(LLVM_VERSION) --dbgsym-migration='libllvm$(LLVM_VERSION)-dbg (<< 1:7~svn327768-1~)'
PATH=$(CURDIR)/:$$PATH dh_strip -p liblldb-$(LLVM_VERSION) --dbgsym-migration='liblldb-$(LLVM_VERSION)-dbg (<< 1:7~svn327768-1~)'
PATH=$(CURDIR)/:$$PATH dh_strip -p libomp$(SONAME_OPENMP)-$(LLVM_VERSION) --dbgsym-migration='libomp$(SONAME_OPENMP)-$(LLVM_VERSION)-dbg (<< 1:7~svn327768-1~)'
endif
# ifeq (${LLD_ENABLE},yes)
# dh_strip -p liblld-$(LLVM_VERSION) --dbg-package=liblld-$(LLVM_VERSION)-dbg
# PATH=$(CURDIR)/:$$PATH dh_strip -p liblld-$(LLVM_VERSION) --dbg-package=liblld-$(LLVM_VERSION)-dbg
# endif
ifeq ($(shell dpkg --compare-versions $(shell dpkg-query -W -f '$${Version}' binutils) ge 2.28 ; echo $$?),0)
# strip segfaults on libFuzzer.a
dh_strip -a -v -XlibFuzzer.a -Xlibc++.a -Xlibc++abi.a -Xlibc++experimental.a -XlibclangTidyModernizeModule.a
PATH=$(CURDIR)/:$$PATH dh_strip -a -v -XlibFuzzer.a -Xlibc++.a -Xlibc++abi.a -Xlibc++experimental.a -XlibclangTidyModernizeModule.a
else
dh_strip -a -v
PATH=$(CURDIR)/:$$PATH dh_strip -a -v
endif
: # Remove the workaround
rm $(CURDIR)/strip
override_dh_install:
# cp $(TARGET_BUILD)/lib/libLLVM-$(LLVM_VERSION).so $(DEB_INST)/usr/lib/llvm-$(LLVM_VERSION)/lib/libLLVM-$(LLVM_VERSION).so.$(SONAME_EXT)