Hi,

The following diff on devel/llvm unbreak www/mozilla-firefox build.

firefox used rustc with `-C lto' option for some part of its build, and
this code path expose a bug in llvm-7.

with current tree, rustc SIGSEG when building gkrust compoment of
firefox, due to this bug.

on rust side, it is documented on https://github.com/rust-lang/rust/issues/57762

I followed the recommandation to backport some llvm patches to correct
the underline problem:

- 
https://github.com/llvm-mirror/llvm/commit/da1fb72bb305d6bc1f3899d541414146934bf80f
- 
https://github.com/llvm-mirror/llvm/commit/cc1f2a595ead516812a6c50398f0f3480ebe031f
        
Technically only a part of the commits is necessary (the one on
lib/Bitcode/Reader/MetadataLoader.cpp), as other parts are for tests.

The following diff backport the two llvm patches in your devel/llvm and
bump lang/rust to ensure updated statically linked libraries are taken.

For reference, the underline llvm problem is related to DWARF variant
support in Enums (if I correctly understand the bug report in
rustc). The backport of patches could be considered for base too I
think.

Comments or ok ?
-- 
Sebastien Marie


Index: devel/llvm/Makefile
===================================================================
RCS file: /cvs/ports/devel/llvm/Makefile,v
retrieving revision 1.207
diff -u -p -r1.207 Makefile
--- devel/llvm/Makefile 28 Jan 2019 15:34:22 -0000      1.207
+++ devel/llvm/Makefile 30 Jan 2019 05:25:07 -0000
@@ -20,7 +20,7 @@ PKGSPEC-main =        llvm-=${LLVM_V}
 PKGNAME-main = llvm-${LLVM_V}
 PKGNAME-python =       py-llvm-${LLVM_V}
 PKGNAME-lldb = lldb-${LLVM_V}
-REVISION-main =        0
+REVISION-main =        1
 CATEGORIES =   devel
 DISTFILES =    llvm-${LLVM_V}.src${EXTRACT_SUFX} \
                cfe-${LLVM_V}.src${EXTRACT_SUFX} \
Index: devel/llvm/patches/patch-lib_Bitcode_Reader_MetadataLoader_cpp
===================================================================
RCS file: devel/llvm/patches/patch-lib_Bitcode_Reader_MetadataLoader_cpp
diff -N devel/llvm/patches/patch-lib_Bitcode_Reader_MetadataLoader_cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ devel/llvm/patches/patch-lib_Bitcode_Reader_MetadataLoader_cpp      30 Jan 
2019 05:25:07 -0000
@@ -0,0 +1,14 @@
+$OpenBSD$
+https://github.com/llvm-mirror/llvm/commit/da1fb72bb305d6bc1f3899d541414146934bf80f
+Index: lib/Bitcode/Reader/MetadataLoader.cpp
+--- lib/Bitcode/Reader/MetadataLoader.cpp.orig
++++ lib/Bitcode/Reader/MetadataLoader.cpp
+@@ -1308,7 +1308,7 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMeta
+                            (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: devel/llvm/patches/patch-test_Assembler_debug-info_ll
===================================================================
RCS file: devel/llvm/patches/patch-test_Assembler_debug-info_ll
diff -N devel/llvm/patches/patch-test_Assembler_debug-info_ll
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ devel/llvm/patches/patch-test_Assembler_debug-info_ll       30 Jan 2019 
05:25:07 -0000
@@ -0,0 +1,14 @@
+$OpenBSD$
+https://github.com/llvm-mirror/llvm/commit/da1fb72bb305d6bc1f3899d541414146934bf80f
+Index: test/Assembler/debug-info.ll
+--- test/Assembler/debug-info.ll.orig
++++ 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)
Index: devel/llvm/patches/patch-test_Assembler_debug-variant-discriminator_ll
===================================================================
RCS file: devel/llvm/patches/patch-test_Assembler_debug-variant-discriminator_ll
diff -N devel/llvm/patches/patch-test_Assembler_debug-variant-discriminator_ll
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ devel/llvm/patches/patch-test_Assembler_debug-variant-discriminator_ll      
30 Jan 2019 05:25:07 -0000
@@ -0,0 +1,20 @@
+$OpenBSD$
+https://github.com/llvm-mirror/llvm/commit/cc1f2a595ead516812a6c50398f0f3480ebe031f
+Index: test/Assembler/debug-variant-discriminator.ll
+--- test/Assembler/debug-variant-discriminator.ll.orig
++++ 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)
Index: lang/rust/Makefile
===================================================================
RCS file: /cvs/ports/lang/rust/Makefile,v
retrieving revision 1.90
diff -u -p -r1.90 Makefile
--- lang/rust/Makefile  27 Jan 2019 05:25:29 -0000      1.90
+++ lang/rust/Makefile  30 Jan 2019 05:25:07 -0000
@@ -19,7 +19,7 @@ CARGO_V =             0.33.0
 CLIPPY_V =             0.0.212
 RUSTFMT_V =            1.0.0
 DISTNAME =             rustc-${V}-src
-REVISION =             0
+REVISION =             1
 
 # rustc bootstrap version
 BV-aarch64 =           1.32.0-20190126

Reply via email to