From f0f0ba2c6c3b9ae3d6c822fbb2f9f969b6cfb849 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Thu, 20 Dec 2018 17:16:38 +0200 Subject: [PATCH 01/12] Fix -dbgsym creation - build with -g1 also on 64bit architectures - should be -g, but this causes buildd disk space issues - enable BuildID so that clang built binaries can be in -dbgsym - override_dh_strip: limit all workarounds to binutils < 2.31.1-11 --- debian/rules | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/debian/rules b/debian/rules index dbacd079..60b914eb 100755 --- a/debian/rules +++ b/debian/rules @@ -73,6 +73,9 @@ opt_flags = -O2 -DNDEBUG # Only enable g1 on archs which needs it (it fixes an OOM during dh_strip due to huge symbols) ifeq ($(DEB_HOST_ARCH_BITS),32) opt_flags += -g1 +else +# Should be -g, but this causes buildd disk space issues +opt_flags += -g1 endif ifneq (,$(findstring $(DEB_HOST_ARCH),armel)) @@ -360,11 +363,12 @@ override_dh_auto_configure: preconfigure -DLLVM_ENABLE_FFI=ON \ $(CMAKE_EXTRA) \ -DLIBCLANG_LIBRARY_VERSION=$(SONAME_EXT) \ + -DENABLE_LINKER_BUILD_ID=ON \ -DPOLLY_BUNDLED_JSONCPP=OFF \ -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="WebAssembly;AVR" \ -DCLANG_ENABLE_BOOTSTRAP=ON \ -DCLANG_VENDOR=$(VENDOR) \ - -DCLANG_BOOTSTRAP_PASSTHROUGH="CMAKE_INSTALL_PREFIX;CMAKE_VERBOSE_MAKEFILE;CMAKE_BUILD_TYPE;CMAKE_CXX_FLAGS_RELWITHDEBINFO;LLVM_LINK_LLVM_DYLIB;LLVM_INSTALL_UTILS;LLVM_VERSION_SUFFIX;LLVM_ENABLE_SPHINX;SPHINX_WARNINGS_AS_ERRORS;LLVM_BUILD_LLVM_DYLIB;LLVM_ENABLE_RTTI;LLVM_ENABLE_FFI;LIBCLANG_LIBRARY_VERSION;POLLY_BUNDLED_JSONCPP;LLVM_EXPERIMENTAL_TARGETS_TO_BUILD;LLVM_USE_PERF;LLVM_ENABLE_ASSERTIONS;LLVM_BINUTILS_INCDIR;LLVM_HOST_TRIPLE;;LLVM_COMPILER_CHECKED;COMPILER_RT_BUILD_BUILTINS;LIBOMP_LIBFLAGS;CMAKE_SHARED_LINKER_FLAGS" + -DCLANG_BOOTSTRAP_PASSTHROUGH="CMAKE_INSTALL_PREFIX;CMAKE_VERBOSE_MAKEFILE;CMAKE_BUILD_TYPE;CMAKE_CXX_FLAGS_RELWITHDEBINFO;LLVM_LINK_LLVM_DYLIB;LLVM_INSTALL_UTILS;LLVM_VERSION_SUFFIX;LLVM_ENABLE_SPHINX;SPHINX_WARNINGS_AS_ERRORS;LLVM_BUILD_LLVM_DYLIB;LLVM_ENABLE_RTTI;LLVM_ENABLE_FFI;LIBCLANG_LIBRARY_VERSION;ENABLE_LINKER_BUILD_ID;POLLY_BUNDLED_JSONCPP;LLVM_EXPERIMENTAL_TARGETS_TO_BUILD;LLVM_USE_PERF;LLVM_ENABLE_ASSERTIONS;LLVM_BINUTILS_INCDIR;LLVM_HOST_TRIPLE;;LLVM_COMPILER_CHECKED;COMPILER_RT_BUILD_BUILTINS;LIBOMP_LIBFLAGS;CMAKE_SHARED_LINKER_FLAGS" # make @@ -693,7 +697,7 @@ endif # ifeq (${LLD_ENABLE},yes) # 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) lt 2.28 ; echo $$?),0) +ifeq ($(shell dpkg --compare-versions $(shell dpkg-query -W -f '$${Version}' binutils) lt 2.31.1-11 ; echo $$?),0) : # 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; \ @@ -702,13 +706,12 @@ ifeq ($(shell dpkg --compare-versions $(shell dpkg-query -W -f '$${Version}' bin PATH=$(CURDIR)/:$$PATH LD_LIBRARY_PATH=$(DEB_INST)/usr/lib/llvm-$(LLVM_VERSION)/lib/:/usr/lib/*/libfakeroot dh_strip -a -v -XlibFuzzer.a -Xlibc++.a -Xlibc++abi.a -Xlibc++experimental.a -XlibclangTidyModernizeModule.a : # Remove the workaround rm $(CURDIR)/strip + : # for some reasons, the +x might be removed + chmod -f +x $(CURDIR)/debian/*/usr/lib/llvm-$(LLVM_VERSION)/bin/* || true else dh_strip -a -v endif - : # for some reasons, the +x might be removed - chmod -f +x $(CURDIR)/debian/*/usr/lib/llvm-$(LLVM_VERSION)/bin/* || true - 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) ifeq (${POLLY_ENABLE},yes) From b9b61aeece0c545b54841a1bb0997314ca8f2385 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 21 Dec 2018 17:08:14 +0100 Subject: [PATCH 02/12] Enable -DENABLE_LINKER_BUILD_ID:BOOL=ON as, unlike gcc, isn't enabled by default in clang. Once more, thanks to Rebecca Palmer (Closes: #916975) --- debian/changelog | 10 +++++++++- debian/rules | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 36044aa8..0f60031a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,7 +1,15 @@ +llvm-toolchain-7 (1:7.0.1-2) unstable; urgency=medium + + * Enable -DENABLE_LINKER_BUILD_ID:BOOL=ON as, unlike gcc, isn't enabled + by default in clang. + Once more, thanks to Rebecca Palmer (Closes: #916975) + + -- Sylvestre Ledru Fri, 21 Dec 2018 17:07:44 +0100 + llvm-toolchain-7 (1:7.0.1-1) unstable; urgency=medium * New release - * Remove the dbg workaround. Hopefully, the new version of + * Remove the dbg workaround. Hopefully, the new version of binutils will fix it (Closes: #913946) -- Sylvestre Ledru Sun, 16 Dec 2018 13:07:54 +0100 diff --git a/debian/rules b/debian/rules index dbacd079..004484b2 100755 --- a/debian/rules +++ b/debian/rules @@ -363,6 +363,7 @@ override_dh_auto_configure: preconfigure -DPOLLY_BUNDLED_JSONCPP=OFF \ -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="WebAssembly;AVR" \ -DCLANG_ENABLE_BOOTSTRAP=ON \ + -DENABLE_LINKER_BUILD_ID:BOOL=ON \ -DCLANG_VENDOR=$(VENDOR) \ -DCLANG_BOOTSTRAP_PASSTHROUGH="CMAKE_INSTALL_PREFIX;CMAKE_VERBOSE_MAKEFILE;CMAKE_BUILD_TYPE;CMAKE_CXX_FLAGS_RELWITHDEBINFO;LLVM_LINK_LLVM_DYLIB;LLVM_INSTALL_UTILS;LLVM_VERSION_SUFFIX;LLVM_ENABLE_SPHINX;SPHINX_WARNINGS_AS_ERRORS;LLVM_BUILD_LLVM_DYLIB;LLVM_ENABLE_RTTI;LLVM_ENABLE_FFI;LIBCLANG_LIBRARY_VERSION;POLLY_BUNDLED_JSONCPP;LLVM_EXPERIMENTAL_TARGETS_TO_BUILD;LLVM_USE_PERF;LLVM_ENABLE_ASSERTIONS;LLVM_BINUTILS_INCDIR;LLVM_HOST_TRIPLE;;LLVM_COMPILER_CHECKED;COMPILER_RT_BUILD_BUILTINS;LIBOMP_LIBFLAGS;CMAKE_SHARED_LINKER_FLAGS" From 90e5dc22a451a22ca0c4a52e3539e5465f9d22ef Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 21 Dec 2018 20:48:06 +0100 Subject: [PATCH 03/12] Revert "Enable -DENABLE_LINKER_BUILD_ID:BOOL=ON as, unlike gcc, isn't enabled by default in clang. Once more, thanks to Rebecca Palmer (Closes: #916975)" This reverts commit b9b61aeece0c545b54841a1bb0997314ca8f2385. --- debian/changelog | 10 +--------- debian/rules | 1 - 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/debian/changelog b/debian/changelog index 0f60031a..36044aa8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,15 +1,7 @@ -llvm-toolchain-7 (1:7.0.1-2) unstable; urgency=medium - - * Enable -DENABLE_LINKER_BUILD_ID:BOOL=ON as, unlike gcc, isn't enabled - by default in clang. - Once more, thanks to Rebecca Palmer (Closes: #916975) - - -- Sylvestre Ledru Fri, 21 Dec 2018 17:07:44 +0100 - llvm-toolchain-7 (1:7.0.1-1) unstable; urgency=medium * New release - * Remove the dbg workaround. Hopefully, the new version of + * Remove the dbg workaround. Hopefully, the new version of binutils will fix it (Closes: #913946) -- Sylvestre Ledru Sun, 16 Dec 2018 13:07:54 +0100 diff --git a/debian/rules b/debian/rules index 004484b2..dbacd079 100755 --- a/debian/rules +++ b/debian/rules @@ -363,7 +363,6 @@ override_dh_auto_configure: preconfigure -DPOLLY_BUNDLED_JSONCPP=OFF \ -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="WebAssembly;AVR" \ -DCLANG_ENABLE_BOOTSTRAP=ON \ - -DENABLE_LINKER_BUILD_ID:BOOL=ON \ -DCLANG_VENDOR=$(VENDOR) \ -DCLANG_BOOTSTRAP_PASSTHROUGH="CMAKE_INSTALL_PREFIX;CMAKE_VERBOSE_MAKEFILE;CMAKE_BUILD_TYPE;CMAKE_CXX_FLAGS_RELWITHDEBINFO;LLVM_LINK_LLVM_DYLIB;LLVM_INSTALL_UTILS;LLVM_VERSION_SUFFIX;LLVM_ENABLE_SPHINX;SPHINX_WARNINGS_AS_ERRORS;LLVM_BUILD_LLVM_DYLIB;LLVM_ENABLE_RTTI;LLVM_ENABLE_FFI;LIBCLANG_LIBRARY_VERSION;POLLY_BUNDLED_JSONCPP;LLVM_EXPERIMENTAL_TARGETS_TO_BUILD;LLVM_USE_PERF;LLVM_ENABLE_ASSERTIONS;LLVM_BINUTILS_INCDIR;LLVM_HOST_TRIPLE;;LLVM_COMPILER_CHECKED;COMPILER_RT_BUILD_BUILTINS;LIBOMP_LIBFLAGS;CMAKE_SHARED_LINKER_FLAGS" From 5acdfc0423c5b303865bfd2f3c04d4d1f7ff683d Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 21 Dec 2018 20:49:26 +0100 Subject: [PATCH 04/12] Revert "Revert "Enable -DENABLE_LINKER_BUILD_ID:BOOL=ON as, unlike gcc, isn't enabled by default in clang. Once more, thanks to Rebecca Palmer (Closes: #916975)"" This reverts commit 90e5dc22a451a22ca0c4a52e3539e5465f9d22ef. --- debian/changelog | 10 +++++++++- debian/rules | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 36044aa8..0f60031a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,7 +1,15 @@ +llvm-toolchain-7 (1:7.0.1-2) unstable; urgency=medium + + * Enable -DENABLE_LINKER_BUILD_ID:BOOL=ON as, unlike gcc, isn't enabled + by default in clang. + Once more, thanks to Rebecca Palmer (Closes: #916975) + + -- Sylvestre Ledru Fri, 21 Dec 2018 17:07:44 +0100 + llvm-toolchain-7 (1:7.0.1-1) unstable; urgency=medium * New release - * Remove the dbg workaround. Hopefully, the new version of + * Remove the dbg workaround. Hopefully, the new version of binutils will fix it (Closes: #913946) -- Sylvestre Ledru Sun, 16 Dec 2018 13:07:54 +0100 diff --git a/debian/rules b/debian/rules index 60b914eb..98f7ec63 100755 --- a/debian/rules +++ b/debian/rules @@ -367,6 +367,7 @@ override_dh_auto_configure: preconfigure -DPOLLY_BUNDLED_JSONCPP=OFF \ -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="WebAssembly;AVR" \ -DCLANG_ENABLE_BOOTSTRAP=ON \ + -DENABLE_LINKER_BUILD_ID:BOOL=ON \ -DCLANG_VENDOR=$(VENDOR) \ -DCLANG_BOOTSTRAP_PASSTHROUGH="CMAKE_INSTALL_PREFIX;CMAKE_VERBOSE_MAKEFILE;CMAKE_BUILD_TYPE;CMAKE_CXX_FLAGS_RELWITHDEBINFO;LLVM_LINK_LLVM_DYLIB;LLVM_INSTALL_UTILS;LLVM_VERSION_SUFFIX;LLVM_ENABLE_SPHINX;SPHINX_WARNINGS_AS_ERRORS;LLVM_BUILD_LLVM_DYLIB;LLVM_ENABLE_RTTI;LLVM_ENABLE_FFI;LIBCLANG_LIBRARY_VERSION;ENABLE_LINKER_BUILD_ID;POLLY_BUNDLED_JSONCPP;LLVM_EXPERIMENTAL_TARGETS_TO_BUILD;LLVM_USE_PERF;LLVM_ENABLE_ASSERTIONS;LLVM_BINUTILS_INCDIR;LLVM_HOST_TRIPLE;;LLVM_COMPILER_CHECKED;COMPILER_RT_BUILD_BUILTINS;LIBOMP_LIBFLAGS;CMAKE_SHARED_LINKER_FLAGS" From a7324bb040c7397d08a7968cb878093e7b0cc9f4 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 21 Dec 2018 20:50:25 +0100 Subject: [PATCH 05/12] add the changelog --- debian/changelog | 2 +- debian/rules | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 0f60031a..eb39d048 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,7 +1,7 @@ llvm-toolchain-7 (1:7.0.1-2) unstable; urgency=medium * Enable -DENABLE_LINKER_BUILD_ID:BOOL=ON as, unlike gcc, isn't enabled - by default in clang. + by default in clang. Thanks to Adrian Bunk for the patch. Once more, thanks to Rebecca Palmer (Closes: #916975) -- Sylvestre Ledru Fri, 21 Dec 2018 17:07:44 +0100 diff --git a/debian/rules b/debian/rules index 98f7ec63..60b914eb 100755 --- a/debian/rules +++ b/debian/rules @@ -367,7 +367,6 @@ override_dh_auto_configure: preconfigure -DPOLLY_BUNDLED_JSONCPP=OFF \ -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="WebAssembly;AVR" \ -DCLANG_ENABLE_BOOTSTRAP=ON \ - -DENABLE_LINKER_BUILD_ID:BOOL=ON \ -DCLANG_VENDOR=$(VENDOR) \ -DCLANG_BOOTSTRAP_PASSTHROUGH="CMAKE_INSTALL_PREFIX;CMAKE_VERBOSE_MAKEFILE;CMAKE_BUILD_TYPE;CMAKE_CXX_FLAGS_RELWITHDEBINFO;LLVM_LINK_LLVM_DYLIB;LLVM_INSTALL_UTILS;LLVM_VERSION_SUFFIX;LLVM_ENABLE_SPHINX;SPHINX_WARNINGS_AS_ERRORS;LLVM_BUILD_LLVM_DYLIB;LLVM_ENABLE_RTTI;LLVM_ENABLE_FFI;LIBCLANG_LIBRARY_VERSION;ENABLE_LINKER_BUILD_ID;POLLY_BUNDLED_JSONCPP;LLVM_EXPERIMENTAL_TARGETS_TO_BUILD;LLVM_USE_PERF;LLVM_ENABLE_ASSERTIONS;LLVM_BINUTILS_INCDIR;LLVM_HOST_TRIPLE;;LLVM_COMPILER_CHECKED;COMPILER_RT_BUILD_BUILTINS;LIBOMP_LIBFLAGS;CMAKE_SHARED_LINKER_FLAGS" From 26ea04bc08575128570826d70fe91901352c9282 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 21 Dec 2018 20:50:56 +0100 Subject: [PATCH 06/12] Build with -g1 also on 64bit architectures (thanks to Adrian too) --- debian/changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/changelog b/debian/changelog index eb39d048..a8b4b48b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,7 @@ llvm-toolchain-7 (1:7.0.1-2) unstable; urgency=medium * Enable -DENABLE_LINKER_BUILD_ID:BOOL=ON as, unlike gcc, isn't enabled by default in clang. Thanks to Adrian Bunk for the patch. Once more, thanks to Rebecca Palmer (Closes: #916975) + * Build with -g1 also on 64bit architectures (thanks to Adrian too) -- Sylvestre Ledru Fri, 21 Dec 2018 17:07:44 +0100 From 2416269467faa2810443ac43566fcececb450b5d Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 22 Dec 2018 00:01:00 +0100 Subject: [PATCH 07/12] consistency in the clang name --- debian/control | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/debian/control b/debian/control index aca8ea5d..a1baf8cd 100644 --- a/debian/control +++ b/debian/control @@ -104,7 +104,7 @@ Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Pre-Depends: ${misc:Pre-Depends} Multi-Arch: same -Description: C interface to the clang library +Description: C interface to the Clang library Clang project is a C, C++, Objective C and Objective C++ front-end based on the LLVM compiler. Its goal is to offer a replacement to the GNU Compiler Collection (GCC). @@ -112,7 +112,7 @@ Description: C interface to the clang library Clang implements all of the ISO C++ 1998, 11 and 14 standards and also provides most of the support of C++17. . - This package contains the clang library. + This package contains the Clang library. . The C Interface to Clang provides a relatively small API that exposes facilities for parsing source code into an abstract syntax tree (AST), @@ -126,7 +126,7 @@ Section: libdevel Depends: ${shlibs:Depends}, ${misc:Depends}, ${dep:devlibs}, ${dep:devlibs-objc}, libclang1-7 (= ${binary:Version}), libclang-common-7-dev (= ${binary:Version}) -Description: clang library - Development package +Description: Clang library - Development package Clang project is a C, C++, Objective C and Objective C++ front-end based on the LLVM compiler. Its goal is to offer a replacement to the GNU Compiler Collection (GCC). @@ -134,14 +134,14 @@ Description: clang library - Development package Clang implements all of the ISO C++ 1998, 11 and 14 standards and also provides most of the support of C++17. . - This package contains the clang headers to develop extensions over + This package contains the Clang headers to develop extensions over libclang1-7. Package: libclang-common-7-dev Architecture: any Section: libdevel Depends: ${shlibs:Depends}, ${misc:Depends}, libllvm7 (= ${binary:Version}) -Description: clang library - Common development package +Description: Clang library - Common development package Clang project is a C, C++, Objective C and Objective C++ front-end based on the LLVM compiler. Its goal is to offer a replacement to the GNU Compiler Collection (GCC). @@ -149,7 +149,7 @@ Description: clang library - Common development package Clang implements all of the ISO C++ 1998, 11 and 14 standards and also provides most of the support of C++17. . - This package contains the clang generic headers and some libraries + This package contains the Clang generic headers and some libraries (profiling, etc). @@ -205,7 +205,7 @@ Description: Clang examples Clang implements all of the ISO C++ 1998, 11 and 14 standards and also provides most of the support of C++17. . - This package contains the clang examples. + This package contains the Clang examples. # ------------- LLVM ------------- From a314e76e19515891db535ba42cebca9ae7d5d7a3 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 22 Dec 2018 00:01:56 +0100 Subject: [PATCH 08/12] add tests for the dbg & buildid issue --- debian/qualify-clang.sh | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/debian/qualify-clang.sh b/debian/qualify-clang.sh index 1fbc80c9..74d96f5e 100755 --- a/debian/qualify-clang.sh +++ b/debian/qualify-clang.sh @@ -8,7 +8,7 @@ fi VERSION=$(dpkg-parsechangelog | sed -rne "s,^Version: 1:([0-9]+).*,\1,p") DETAILED_VERSION=$(dpkg-parsechangelog | sed -rne "s,^Version: 1:([0-9.]+)(~|-)(.*),\1\2\3,p") -LIST="libomp5-${VERSION}_${DETAILED_VERSION}_amd64.deb libomp-${VERSION}-dev_${DETAILED_VERSION}_amd64.deb lldb-${VERSION}_${DETAILED_VERSION}_amd64.deb python-lldb-${VERSION}_${DETAILED_VERSION}_amd64.deb libllvm7_${DETAILED_VERSION}_amd64.deb llvm-${VERSION}-dev_${DETAILED_VERSION}_amd64.deb liblldb-${VERSION}-dev_${DETAILED_VERSION}_amd64.deb libclang1-${VERSION}_${DETAILED_VERSION}_amd64.deb libclang-common-${VERSION}-dev_${DETAILED_VERSION}_amd64.deb llvm-${VERSION}_${DETAILED_VERSION}_amd64.deb liblldb-${VERSION}_${DETAILED_VERSION}_amd64.deb llvm-${VERSION}-runtime_${DETAILED_VERSION}_amd64.deb lld-${VERSION}_${DETAILED_VERSION}_amd64.deb libfuzzer-${VERSION}-dev_${DETAILED_VERSION}_amd64.deb libclang-${VERSION}-dev_${DETAILED_VERSION}_amd64.deb libc++-${VERSION}-dev_${DETAILED_VERSION}_amd64.deb libc++abi-${VERSION}-dev_${DETAILED_VERSION}_amd64.deb libc++1-${VERSION}_${DETAILED_VERSION}_amd64.deb libc++abi1-${VERSION}_${DETAILED_VERSION}_amd64.deb clang-${VERSION}_${DETAILED_VERSION}_amd64.deb llvm-${VERSION}-tools_${DETAILED_VERSION}_amd64.deb clang-tools-${VERSION}_${DETAILED_VERSION}_amd64.deb" +LIST="libomp5-${VERSION}_${DETAILED_VERSION}_amd64.deb libomp-${VERSION}-dev_${DETAILED_VERSION}_amd64.deb lldb-${VERSION}_${DETAILED_VERSION}_amd64.deb python-lldb-${VERSION}_${DETAILED_VERSION}_amd64.deb libllvm7_${DETAILED_VERSION}_amd64.deb llvm-${VERSION}-dev_${DETAILED_VERSION}_amd64.deb liblldb-${VERSION}-dev_${DETAILED_VERSION}_amd64.deb libclang1-${VERSION}_${DETAILED_VERSION}_amd64.deb libclang-common-${VERSION}-dev_${DETAILED_VERSION}_amd64.deb llvm-${VERSION}_${DETAILED_VERSION}_amd64.deb liblldb-${VERSION}_${DETAILED_VERSION}_amd64.deb llvm-${VERSION}-runtime_${DETAILED_VERSION}_amd64.deb lld-${VERSION}_${DETAILED_VERSION}_amd64.deb libfuzzer-${VERSION}-dev_${DETAILED_VERSION}_amd64.deb libclang-${VERSION}-dev_${DETAILED_VERSION}_amd64.deb libc++-${VERSION}-dev_${DETAILED_VERSION}_amd64.deb libc++abi-${VERSION}-dev_${DETAILED_VERSION}_amd64.deb libc++1-${VERSION}_${DETAILED_VERSION}_amd64.deb libc++abi1-${VERSION}_${DETAILED_VERSION}_amd64.deb clang-${VERSION}_${DETAILED_VERSION}_amd64.deb llvm-${VERSION}-tools_${DETAILED_VERSION}_amd64.deb clang-tools-${VERSION}_${DETAILED_VERSION}_amd64.deb clang-${VERSION}-dbgsym_${DETAILED_VERSION}_amd64.deb libclang1-${VERSION}-dbgsym_${DETAILED_VERSION}_amd64.deb" echo "To install everything:" echo "sudo dpkg -i $LIST" L="" @@ -234,6 +234,21 @@ clang-$VERSION -fuse-ld=lld -flto -O2 foo.c main.c -o foo clang-$VERSION -fuse-ld=lld-$VERSION -O2 foo.c main.c -o foo ./foo > /dev/null +# Bug 916975 +file foo &> foo.log +if ! grep -q "BuildID" foo.log; then + echo "BuildID isn't part of the generated binary (lld generation)" + exit 1 +fi +# Bug 916975 +clang-$VERSION -O2 foo.c main.c -o foo2 +file foo2 &> foo2.log +if ! grep "BuildID" foo2.log; then + echo "BuildID isn't part of the generated binary (ld generation)" + exit 1 +fi + + cat << EOF > test_fuzzer.cc #include #include @@ -609,8 +624,20 @@ if test ! -f /usr/bin/lldb-$VERSION; then exit -1; fi - +# bug 913946 lldb-$VERSION -s lldb-cmd.txt bar +if dpkg -l|grep -q clang-$VERSION-dbgsym; then + # Testing if clang dbg symbol are here + lldb-$VERSION -s lldb-cmd.txt clang-$VERSION &> foo.log + if ! grep "main at driver.cpp" foo.log; then + echo "Could not find the debug info" + echo "Or the main() of clang isn't in driver.cpp anymore" + exit -1 + fi +else + echo "clang-$VERSION-dbgsym isn't installed" +fi + echo ' #include int main (void) From a2cde1ab59a9943c932154fc15510460b7a9205b Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 22 Dec 2018 00:01:56 +0100 Subject: [PATCH 09/12] add tests for the dbg & buildid issue --- debian/qualify-clang.sh | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/debian/qualify-clang.sh b/debian/qualify-clang.sh index 1fbc80c9..710cae55 100755 --- a/debian/qualify-clang.sh +++ b/debian/qualify-clang.sh @@ -8,7 +8,7 @@ fi VERSION=$(dpkg-parsechangelog | sed -rne "s,^Version: 1:([0-9]+).*,\1,p") DETAILED_VERSION=$(dpkg-parsechangelog | sed -rne "s,^Version: 1:([0-9.]+)(~|-)(.*),\1\2\3,p") -LIST="libomp5-${VERSION}_${DETAILED_VERSION}_amd64.deb libomp-${VERSION}-dev_${DETAILED_VERSION}_amd64.deb lldb-${VERSION}_${DETAILED_VERSION}_amd64.deb python-lldb-${VERSION}_${DETAILED_VERSION}_amd64.deb libllvm7_${DETAILED_VERSION}_amd64.deb llvm-${VERSION}-dev_${DETAILED_VERSION}_amd64.deb liblldb-${VERSION}-dev_${DETAILED_VERSION}_amd64.deb libclang1-${VERSION}_${DETAILED_VERSION}_amd64.deb libclang-common-${VERSION}-dev_${DETAILED_VERSION}_amd64.deb llvm-${VERSION}_${DETAILED_VERSION}_amd64.deb liblldb-${VERSION}_${DETAILED_VERSION}_amd64.deb llvm-${VERSION}-runtime_${DETAILED_VERSION}_amd64.deb lld-${VERSION}_${DETAILED_VERSION}_amd64.deb libfuzzer-${VERSION}-dev_${DETAILED_VERSION}_amd64.deb libclang-${VERSION}-dev_${DETAILED_VERSION}_amd64.deb libc++-${VERSION}-dev_${DETAILED_VERSION}_amd64.deb libc++abi-${VERSION}-dev_${DETAILED_VERSION}_amd64.deb libc++1-${VERSION}_${DETAILED_VERSION}_amd64.deb libc++abi1-${VERSION}_${DETAILED_VERSION}_amd64.deb clang-${VERSION}_${DETAILED_VERSION}_amd64.deb llvm-${VERSION}-tools_${DETAILED_VERSION}_amd64.deb clang-tools-${VERSION}_${DETAILED_VERSION}_amd64.deb" +LIST="libomp5-${VERSION}_${DETAILED_VERSION}_amd64.deb libomp-${VERSION}-dev_${DETAILED_VERSION}_amd64.deb lldb-${VERSION}_${DETAILED_VERSION}_amd64.deb python-lldb-${VERSION}_${DETAILED_VERSION}_amd64.deb libllvm7_${DETAILED_VERSION}_amd64.deb llvm-${VERSION}-dev_${DETAILED_VERSION}_amd64.deb liblldb-${VERSION}-dev_${DETAILED_VERSION}_amd64.deb libclang1-${VERSION}_${DETAILED_VERSION}_amd64.deb libclang-common-${VERSION}-dev_${DETAILED_VERSION}_amd64.deb llvm-${VERSION}_${DETAILED_VERSION}_amd64.deb liblldb-${VERSION}_${DETAILED_VERSION}_amd64.deb llvm-${VERSION}-runtime_${DETAILED_VERSION}_amd64.deb lld-${VERSION}_${DETAILED_VERSION}_amd64.deb libfuzzer-${VERSION}-dev_${DETAILED_VERSION}_amd64.deb libclang-${VERSION}-dev_${DETAILED_VERSION}_amd64.deb libc++-${VERSION}-dev_${DETAILED_VERSION}_amd64.deb libc++abi-${VERSION}-dev_${DETAILED_VERSION}_amd64.deb libc++1-${VERSION}_${DETAILED_VERSION}_amd64.deb libc++abi1-${VERSION}_${DETAILED_VERSION}_amd64.deb clang-${VERSION}_${DETAILED_VERSION}_amd64.deb llvm-${VERSION}-tools_${DETAILED_VERSION}_amd64.deb clang-tools-${VERSION}_${DETAILED_VERSION}_amd64.deb clang-${VERSION}-dbgsym_${DETAILED_VERSION}_amd64.deb libclang1-${VERSION}-dbgsym_${DETAILED_VERSION}_amd64.deb" echo "To install everything:" echo "sudo dpkg -i $LIST" L="" @@ -234,6 +234,27 @@ clang-$VERSION -fuse-ld=lld -flto -O2 foo.c main.c -o foo clang-$VERSION -fuse-ld=lld-$VERSION -O2 foo.c main.c -o foo ./foo > /dev/null +# Bug 916975 +file foo &> foo.log +if ! grep -q "BuildID" foo.log; then + echo "BuildID isn't part of the generated binary (lld generation)" + exit 1 +fi +# Bug 916975 +clang-$VERSION -O2 foo.c main.c -o foo2 +file foo2 &> foo2.log +if ! grep "BuildID" foo2.log; then + echo "BuildID isn't part of the generated binary (ld generation)" + exit 1 +fi +strip foo2 +file foo2 &> foo2.log +if ! grep "BuildID" foo2.log; then + echo "BuildID isn't part of the generated binary (stripped)" + exit 1 +fi +rm foo2 foo2.log + cat << EOF > test_fuzzer.cc #include #include @@ -609,8 +630,20 @@ if test ! -f /usr/bin/lldb-$VERSION; then exit -1; fi - +# bug 913946 lldb-$VERSION -s lldb-cmd.txt bar +if dpkg -l|grep -q clang-$VERSION-dbgsym; then + # Testing if clang dbg symbol are here + lldb-$VERSION -s lldb-cmd.txt clang-$VERSION &> foo.log + if ! grep "main at driver.cpp" foo.log; then + echo "Could not find the debug info" + echo "Or the main() of clang isn't in driver.cpp anymore" + exit -1 + fi +else + echo "clang-$VERSION-dbgsym isn't installed" +fi + echo ' #include int main (void) From c77a496667331166a3a26007044c70c215a7011c Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 22 Dec 2018 21:23:44 +0100 Subject: [PATCH 10/12] Also install clang-7-dbgsym libclang1-7-dbgsym in autopkgtest to verify that debug symbols are present --- debian/changelog | 7 +++++++ debian/prepare-new-release.sh | 2 +- debian/tests/control | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index a8b4b48b..6a2fb94c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +llvm-toolchain-7 (1:7.0.1-3) unstable; urgency=medium + + * Also install clang-7-dbgsym libclang1-7-dbgsym in autopkgtest + to verify that debug symbols are present + + -- Sylvestre Ledru Sat, 22 Dec 2018 21:23:36 +0100 + llvm-toolchain-7 (1:7.0.1-2) unstable; urgency=medium * Enable -DENABLE_LINKER_BUILD_ID:BOOL=ON as, unlike gcc, isn't enabled diff --git a/debian/prepare-new-release.sh b/debian/prepare-new-release.sh index 432f8144..a0db4e9d 100644 --- a/debian/prepare-new-release.sh +++ b/debian/prepare-new-release.sh @@ -6,7 +6,7 @@ TARGET_VERSION_2=7_0 ORIG_VERSION_3=60 TARGET_VERSION_3=70 -LIST=`ls debian/control debian/orig-tar.sh debian/rules debian/patches/clang-analyzer-force-version.diff debian/patches/clang-format-version.diff debian/patches/python-clangpath.diff debian/patches/scan-build-clang-path.diff debian/patches/lldb-libname.diff debian/patches/fix-scan-view-path.diff debian/patches/lldb-addversion-suffix-to-llvm-server-exec.patch debian/patches/clang-tidy-run-bin.diff debian/patches/clang-apply-replacements.diff debian/patches/fix-scan-view-path.diff debian/qualify-clang.sh debian/README` +LIST=`ls debian/control debian/orig-tar.sh debian/rules debian/patches/clang-analyzer-force-version.diff debian/patches/clang-format-version.diff debian/patches/python-clangpath.diff debian/patches/scan-build-clang-path.diff debian/patches/lldb-libname.diff debian/patches/fix-scan-view-path.diff debian/patches/lldb-addversion-suffix-to-llvm-server-exec.patch debian/patches/clang-tidy-run-bin.diff debian/patches/clang-apply-replacements.diff debian/patches/fix-scan-view-path.diff debian/qualify-clang.sh debian/README debian/tests/control` for F in $LIST; do sed -i -e "s|$ORIG_VERSION_3|$TARGET_VERSION_3|g" $F sed -i -e "s|$ORIG_VERSION_2|$TARGET_VERSION_2|g" $F diff --git a/debian/tests/control b/debian/tests/control index 9ef42f09..b4c8ea98 100644 --- a/debian/tests/control +++ b/debian/tests/control @@ -1,3 +1,3 @@ Test-Command: bash -v ./debian/qualify-clang.sh -Depends: @, cmake, g++, file +Depends: @, cmake, g++, file, clang-7-dbgsym, libclang1-7-dbgsym Restrictions: allow-stderr From 61441bd1270aa885d9942b72d7bdc2f1ef26992d Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 26 Dec 2018 12:24:30 +0100 Subject: [PATCH 11/12] Cherry-pick upstream fix D52340 to address a rustc debuginfo (Closes: #917209) --- debian/changelog | 4 ++- debian/patches/D52340-rustc-debuginfo.diff | 32 ++++++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 debian/patches/D52340-rustc-debuginfo.diff diff --git a/debian/changelog b/debian/changelog index 6a2fb94c..5cbedeae 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,8 +2,10 @@ llvm-toolchain-7 (1:7.0.1-3) unstable; urgency=medium * Also install clang-7-dbgsym libclang1-7-dbgsym in autopkgtest to verify that debug symbols are present + * Cherry-pick upstream fix D52340 to address a rustc debuginfo + (Closes: #917209) - -- Sylvestre Ledru Sat, 22 Dec 2018 21:23:36 +0100 + -- Sylvestre Ledru Wed, 26 Dec 2018 12:24:01 +0100 llvm-toolchain-7 (1:7.0.1-2) unstable; urgency=medium diff --git a/debian/patches/D52340-rustc-debuginfo.diff b/debian/patches/D52340-rustc-debuginfo.diff new file mode 100644 index 00000000..a9e9a33b --- /dev/null +++ b/debian/patches/D52340-rustc-debuginfo.diff @@ -0,0 +1,32 @@ +Index: llvm/lib/Bitcode/Reader/MetadataLoader.cpp +=================================================================== +--- llvm.orig/lib/Bitcode/Reader/MetadataLoader.cpp ++++ llvm/lib/Bitcode/Reader/MetadataLoader.cpp +@@ -1313,7 +1313,7 @@ + (Context, Tag, Name, File, Line, Scope, BaseType, + SizeInBits, AlignInBits, OffsetInBits, Flags, + Elements, RuntimeLang, VTableHolder, TemplateParams, +- Identifier)); ++ Identifier, Discriminator)); + if (!IsNotUsedInTypeRef && Identifier) + MetadataList.addTypeRef(*Identifier, *cast(CT)); + +Index: llvm/test/Assembler/debug-variant-discriminator.ll +=================================================================== +--- llvm.orig/test/Assembler/debug-variant-discriminator.ll ++++ llvm/test/Assembler/debug-variant-discriminator.ll +@@ -0,0 +1,14 @@ ++; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | FileCheck %s ++; RUN: verify-uselistorder %s ++ ++; CHECK: !named = !{!0, !1, !2} ++!named = !{!0, !1, !2} ++ ++; CHECK: !0 = !DICompositeType(tag: DW_TAG_structure_type, name: "Outer", size: 64, align: 64, identifier: "Outer") ++; CHECK-NEXT: !1 = !DICompositeType(tag: DW_TAG_variant_part, scope: !0, size: 64, discriminator: !2) ++; CHECK-NEXT: !2 = !DIDerivedType(tag: DW_TAG_member, scope: !1, baseType: !3, size: 64, align: 64, flags: DIFlagArtificial) ++; CHECK-NEXT: !3 = !DIBasicType(name: "u64", size: 64, encoding: DW_ATE_unsigned) ++!0 = !DICompositeType(tag: DW_TAG_structure_type, name: "Outer", size: 64, align: 64, identifier: "Outer") ++!1 = !DICompositeType(tag: DW_TAG_variant_part, scope: !0, size: 64, discriminator: !2) ++!2 = !DIDerivedType(tag: DW_TAG_member, scope: !1, baseType: !3, size: 64, align: 64, flags: DIFlagArtificial) ++!3 = !DIBasicType(name: "u64", size: 64, encoding: DW_ATE_unsigned) diff --git a/debian/patches/series b/debian/patches/series index a620afa6..7f6e380f 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -132,3 +132,4 @@ powerpcspe-add-missing-include-path.diff D49754-powerpcspe-clang.diff D54409-powerpcspe-register-spilling.diff D54584-powerpcspe-double-parameter.diff +D52340-rustc-debuginfo.diff From d4981f0ad40393f289da596cc3269685d9241116 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 26 Dec 2018 18:59:28 +0100 Subject: [PATCH 12/12] Change the jit debug path from $HOME/.debug/jit/ to $TMPDIR/.debug/jit/ (Closes: #916393) --- debian/changelog | 2 ++ debian/patches/debug-jit-path.diff | 15 +++++++++++++++ debian/patches/series | 2 ++ 3 files changed, 19 insertions(+) create mode 100644 debian/patches/debug-jit-path.diff diff --git a/debian/changelog b/debian/changelog index 5cbedeae..27179295 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,8 @@ llvm-toolchain-7 (1:7.0.1-3) unstable; urgency=medium to verify that debug symbols are present * Cherry-pick upstream fix D52340 to address a rustc debuginfo (Closes: #917209) + * Change the jit debug path from $HOME/.debug/jit/ to + $TMPDIR/.debug/jit/ (Closes: #916393) -- Sylvestre Ledru Wed, 26 Dec 2018 12:24:01 +0100 diff --git a/debian/patches/debug-jit-path.diff b/debian/patches/debug-jit-path.diff new file mode 100644 index 00000000..78dc89aa --- /dev/null +++ b/debian/patches/debug-jit-path.diff @@ -0,0 +1,15 @@ +Index: llvm-toolchain-7_7.0.1~+rc3/lib/ExecutionEngine/PerfJITEvents/PerfJITEventListener.cpp +=================================================================== +--- llvm-toolchain-7_7.0.1~+rc3.orig/lib/ExecutionEngine/PerfJITEvents/PerfJITEventListener.cpp ++++ llvm-toolchain-7_7.0.1~+rc3/lib/ExecutionEngine/PerfJITEvents/PerfJITEventListener.cpp +@@ -294,8 +294,8 @@ bool PerfJITEventListener::InitDebugging + // search for location to dump data to + if (const char *BaseDir = getenv("JITDUMPDIR")) + Path.append(BaseDir); +- else if (!sys::path::home_directory(Path)) +- Path = "."; ++ else ++ sys::path::system_temp_directory(/*ErasedOnReboot*/ true, Path); + + // create debug directory + Path += "/.debug/jit/"; diff --git a/debian/patches/series b/debian/patches/series index 7f6e380f..e413cce7 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -20,6 +20,7 @@ x32-fix-driver-search-paths.diff symbolizer-path.diff clang-tidy-run-bin.diff 0001-tools-clang-cmake-resolve-symlinks-in-ClangConfig.cmake.patch +debug-jit-path.diff # commented because of bug 903709 #force-gcc-header-obj.diff @@ -133,3 +134,4 @@ D49754-powerpcspe-clang.diff D54409-powerpcspe-register-spilling.diff D54584-powerpcspe-double-parameter.diff D52340-rustc-debuginfo.diff +