Skip to content

LLVM5: Failed to strip malformed debug info #53204

Closed
@cuviper

Description

@cuviper

In Rust 1.28, building the full compiler with full debuginfo (as we do in Fedora) sees debuginfo errors with external LLVM5 (Fedora 27 and EPEL7). Fedora 28+ with LLVM6 looks fine.

For example, from the logs in this failed build:

Building stage1 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
...
fragment covers entire variable
  tail call void @llvm.dbg.value(metadata i64* %2, i64 0, metadata !5287, metadata !401), !dbg !5300
!5287 = !DILocalVariable(name: "global_s", scope: !5288, file: !99, line: 1, type: !5196, align: 8)
!401 = !DIExpression(DW_OP_LLVM_fragment, 0, 64)
fragment is larger than or outside of variable
  tail call void @llvm.dbg.value(metadata i64* %3, i64 0, metadata !5287, metadata !404), !dbg !5300
!5287 = !DILocalVariable(name: "global_s", scope: !5288, file: !99, line: 1, type: !5196, align: 8)
!404 = !DIExpression(DW_OP_LLVM_fragment, 64, 64)
fragment covers entire variable
  tail call void @llvm.dbg.value(metadata i64* %2, i64 0, metadata !5868, metadata !401), !dbg !5879
!5868 = !DILocalVariable(name: "global_s", scope: !5869, file: !99, line: 1, type: !5778, align: 8)
!401 = !DIExpression(DW_OP_LLVM_fragment, 0, 64)
fragment is larger than or outside of variable
  tail call void @llvm.dbg.value(metadata i64* %3, i64 0, metadata !5868, metadata !404), !dbg !5879
!5868 = !DILocalVariable(name: "global_s", scope: !5869, file: !99, line: 1, type: !5778, align: 8)
!404 = !DIExpression(DW_OP_LLVM_fragment, 64, 64)
fragment is larger than or outside of variable
  call void @llvm.dbg.value(metadata { {}*, {}* }* %35, i64 0, metadata !8646, metadata !1442), !dbg !8637
!8646 = !DILocalVariable(name: "format", scope: !8638, file: !307, line: 1, type: !411, align: 1)
!1442 = !DIExpression(DW_OP_LLVM_fragment, 0, 64)
fragment is larger than or outside of variable
  call void @llvm.dbg.value(metadata i64* %37, i64 0, metadata !8646, metadata !1445), !dbg !8637
!8646 = !DILocalVariable(name: "format", scope: !8638, file: !307, line: 1, type: !411, align: 1)
!1445 = !DIExpression(DW_OP_LLVM_fragment, 64, 64)
fragment is larger than or outside of variable
  call void @llvm.dbg.value(metadata i8** %40, i64 0, metadata !8646, metadata !8667), !dbg !8637
!8646 = !DILocalVariable(name: "format", scope: !8638, file: !307, line: 1, type: !411, align: 1)
!8667 = !DIExpression(DW_OP_LLVM_fragment, 128, 64)
fragment is larger than or outside of variable
  call void @llvm.dbg.value(metadata i8* %42, i64 0, metadata !8646, metadata !8668), !dbg !8637
!8646 = !DILocalVariable(name: "format", scope: !8638, file: !307, line: 1, type: !411, align: 1)
!8668 = !DIExpression(DW_OP_LLVM_fragment, 192, 64)
fragment covers entire variable
  tail call void @llvm.dbg.value(metadata i64* %2, i64 0, metadata !5527, metadata !389), !dbg !5540
!5527 = !DILocalVariable(name: "global_s", scope: !5528, file: !87, line: 1, type: !5426, align: 8)
!389 = !DIExpression(DW_OP_LLVM_fragment, 0, 64)
fragment is larger than or outside of variable
  tail call void @llvm.dbg.value(metadata i64* %3, i64 0, metadata !5527, metadata !392), !dbg !5540
!5527 = !DILocalVariable(name: "global_s", scope: !5528, file: !87, line: 1, type: !5426, align: 8)
!392 = !DIExpression(DW_OP_LLVM_fragment, 64, 64)
fragment covers entire variable
  tail call void @llvm.dbg.value(metadata i64* %2, i64 0, metadata !6274, metadata !389), !dbg !6285
!6274 = !DILocalVariable(name: "global_s", scope: !6275, file: !87, line: 1, type: !6182, align: 8)
!389 = !DIExpression(DW_OP_LLVM_fragment, 0, 64)
fragment is larger than or outside of variable
  tail call void @llvm.dbg.value(metadata i64* %3, i64 0, metadata !6274, metadata !392), !dbg !6285
!6274 = !DILocalVariable(name: "global_s", scope: !6275, file: !87, line: 1, type: !6182, align: 8)
!392 = !DIExpression(DW_OP_LLVM_fragment, 64, 64)
warning: ignoring invalid debug info in std5-25124471f09f727a26c64c3844c8702a.rs
DICompileUnit not listed in llvm.dbg.cu
!98 = distinct !DICompileUnit(language: DW_LANG_Rust, file: !99, producer: "clang LLVM (rustc version 1.28.0)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !100, globals: !201)
warning: ignoring invalid debug info in std5-25124471f09f727a26c64c3844c8702a.rs
LLVM ERROR: Failed to strip malformed debug info
error: Could not compile `std`.

I believe this is the effect of #50949, per @eddyb:

(The second commit passes tests locally but might not on older LLVM versions)

I reverted that commit da579ef locally, and it looks like this has fixed it. Maybe we can keep that hack in place just for LLVM5? (skipping it on LLVM6+)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions