[packages/llvm/llvm-7.0] - fix discriminators in metadata, rhbz#1668033 - rel 2

baggins baggins at pld-linux.org
Sun Jun 2 01:43:23 CEST 2019


commit 97d756d7d4319576c0b3f952b4f7ebe0670627a6
Author: Jan Rękorajski <baggins at pld-linux.org>
Date:   Sun Jun 2 01:42:58 2019 +0200

    - fix discriminators in metadata, rhbz#1668033
    - rel 2

 ...-variant-part-discriminator-is-read-by-Me.patch | 59 ++++++++++++++++++++++
 0002-test-Fix-Assembler-debug-info.ll.patch        | 28 ++++++++++
 llvm.spec                                          |  6 ++-
 3 files changed, 92 insertions(+), 1 deletion(-)
---
diff --git a/llvm.spec b/llvm.spec
index 99469f0..2415a33 100644
--- a/llvm.spec
+++ b/llvm.spec
@@ -31,7 +31,7 @@ Summary:	The Low Level Virtual Machine (An Optimizing Compiler Infrastructure)
 Summary(pl.UTF-8):	Niskopoziomowa maszyna wirtualna (infrastruktura kompilatora optymalizującego)
 Name:		llvm
 Version:	7.0.1
-Release:	1
+Release:	2
 License:	University of Illinois/NCSA Open Source License
 Group:		Development/Languages
 #Source0Download: http://releases.llvm.org/download.html
@@ -53,6 +53,8 @@ Patch1:		%{name}-pld.patch
 Patch3:		x32-gcc-toolchain.patch
 Patch4:		cmake-buildtype.patch
 Patch5:		%{name}-ocaml-shared.patch
+Patch6:		0001-Ensure-that-variant-part-discriminator-is-read-by-Me.patch
+Patch7:		0002-test-Fix-Assembler-debug-info.ll.patch
 URL:		http://llvm.org/
 BuildRequires:	bash
 BuildRequires:	bison
@@ -534,6 +536,8 @@ Integracja narzędzi Clang do formatowania i zmiany nazw z Vimem.
 %patch3 -p1
 %patch4 -p1
 %patch5 -p1
+%patch6 -p1
+%patch7 -p1
 
 grep -rl /usr/bin/env tools utils | xargs sed -i -e '1{
 	s,^#!.*bin/env python,#!%{__python},
diff --git a/0001-Ensure-that-variant-part-discriminator-is-read-by-Me.patch b/0001-Ensure-that-variant-part-discriminator-is-read-by-Me.patch
new file mode 100644
index 0000000..75d5fde
--- /dev/null
+++ b/0001-Ensure-that-variant-part-discriminator-is-read-by-Me.patch
@@ -0,0 +1,59 @@
+From 2ad5ac11b17dac347d29191872b2b3d601bbcd1f Mon Sep 17 00:00:00 2001
+From: Jonas Devlieghere <jonas at devlieghere.com>
+Date: Fri, 21 Sep 2018 12:03:14 +0000
+Subject: [PATCH 1/2] Ensure that variant part discriminator is read by
+ MetadataLoader
+
+https://reviews.llvm.org/D42082 introduced variant parts to debug info
+in LLVM. Subsequent work on the Rust compiler has found a bug in that
+patch; namely, there is a path in MetadataLoader that fails to restore
+the discriminator.
+
+This patch fixes the bug.
+
+Patch by: Tom Tromey
+
+Differential revision: https://reviews.llvm.org/D52340
+
+llvm-svn: 342725
+---
+ llvm/lib/Bitcode/Reader/MetadataLoader.cpp         |  2 +-
+ llvm/test/Assembler/debug-variant-discriminator.ll | 14 ++++++++++++++
+ 2 files changed, 15 insertions(+), 1 deletion(-)
+ create mode 100644 llvm/test/Assembler/debug-variant-discriminator.ll
+
+diff --git a/lib/Bitcode/Reader/MetadataLoader.cpp b/lib/Bitcode/Reader/MetadataLoader.cpp
+index 011c41e2cecd..a7b542efc19e 100644
+--- a/lib/Bitcode/Reader/MetadataLoader.cpp
++++ b/lib/Bitcode/Reader/MetadataLoader.cpp
+@@ -1308,7 +1308,7 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata(
+                            (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));
+ 
+diff --git a/test/Assembler/debug-variant-discriminator.ll b/test/Assembler/debug-variant-discriminator.ll
+new file mode 100644
+index 000000000000..5be001cad6be
+--- /dev/null
++++ b/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)
+-- 
+2.20.1
diff --git a/0002-test-Fix-Assembler-debug-info.ll.patch b/0002-test-Fix-Assembler-debug-info.ll.patch
new file mode 100644
index 0000000..d022d97
--- /dev/null
+++ b/0002-test-Fix-Assembler-debug-info.ll.patch
@@ -0,0 +1,28 @@
+From 9bfebd6e47cb8513dcd7f7203f29489bdec7bfe4 Mon Sep 17 00:00:00 2001
+From: Jonas Devlieghere <jonas at devlieghere.com>
+Date: Fri, 21 Sep 2018 12:28:44 +0000
+Subject: [PATCH 2/2] [test] Fix Assembler/debug-info.ll
+
+Update Assembler/debug-info.ll to contain discriminator.
+
+llvm-svn: 342727
+---
+ llvm/test/Assembler/debug-info.ll | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/test/Assembler/debug-info.ll b/test/Assembler/debug-info.ll
+index 5dfb8cd93435..605afc3f1587 100644
+--- a/test/Assembler/debug-info.ll
++++ b/test/Assembler/debug-info.ll
+@@ -83,7 +83,7 @@
+ ; CHECK-NEXT: !32 = !DIFile(filename: "file", directory: "dir", checksumkind: CSK_MD5, checksum: "000102030405060708090a0b0c0d0e0f")
+ !35 = !DIFile(filename: "file", directory: "dir", checksumkind: CSK_MD5, checksum: "000102030405060708090a0b0c0d0e0f")
+ 
+-; CHECK-NEXT: !33 = !DICompositeType(tag: DW_TAG_variant_part, name: "A", scope: !14, size: 64)
++; CHECK-NEXT: !33 = !DICompositeType(tag: DW_TAG_variant_part, name: "A", scope: !14, size: 64, discriminator: !34)
+ ; CHECK-NEXT: !34 = !DIDerivedType(tag: DW_TAG_member, scope: !33, baseType: !35, size: 64, align: 64, flags: DIFlagArtificial)
+ ; CHECK-NEXT: !35 = !DIBasicType(name: "u64", size: 64, encoding: DW_ATE_unsigned)
+ !36 = !DICompositeType(tag: DW_TAG_variant_part, name: "A", scope: !16, size: 64, discriminator: !37)
+-- 
+2.20.1
+
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/llvm.git/commitdiff/97d756d7d4319576c0b3f952b4f7ebe0670627a6



More information about the pld-cvs-commit mailing list