Rebase of the patch

This commit is contained in:
Sylvestre Ledru 2018-12-26 19:04:38 +01:00
commit 9725c78e34
9 changed files with 121 additions and 20 deletions

22
debian/changelog vendored
View File

@ -1,13 +1,27 @@
llvm-toolchain-7 (1:7.0.1-2) UNRELEASED; urgency=medium
llvm-toolchain-7 (1:7.0.1-3) unstable; urgency=medium
* Pass -Wl,--build-id to get dbgsym packages (Closes: #916975)
* 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)
* Change the jit debug path from $HOME/.debug/jit/ to
$TMPDIR/.debug/jit/ (Closes: #916393)
-- Sylvestre Ledru <sylvestre@debian.org> Fri, 21 Dec 2018 08:24:20 +0100
-- Sylvestre Ledru <sylvestre@debian.org> Wed, 26 Dec 2018 12:24:01 +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
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 <sylvestre@debian.org> 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 <sylvestre@debian.org> Sun, 16 Dec 2018 13:07:54 +0100

14
debian/control vendored
View File

@ -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 -------------

View File

@ -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<DICompositeType>(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)

15
debian/patches/debug-jit-path.diff vendored Normal file
View File

@ -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/";

View File

@ -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
@ -132,3 +133,5 @@ powerpcspe-add-missing-include-path.diff
D49754-powerpcspe-clang.diff
D54409-powerpcspe-register-spilling.diff
D54584-powerpcspe-double-parameter.diff
D52340-rustc-debuginfo.diff

View File

@ -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

View File

@ -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,28 @@ 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 <stdint.h>
#include <stddef.h>
@ -609,8 +631,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 <vector>
int main (void)

13
debian/rules vendored
View File

@ -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)

View File

@ -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