[llvm-dev] 'invalid subroutine type ref' when linking custom metadata

Robin Sommer via llvm-dev llvm-dev at lists.llvm.org
Mon Jul 25 20:53:20 PDT 2016


With 3.9, llvm-link tells me 'invalid subroutine type ref' when
linking the two code pieces below, and I don't quite understand why.
It looks like it merges the debug information with the custom
metadata. I've filed a ticket already [1] but as I'm not sure if this
is indeed a bug or if I'm misunderstanding something, I thought I'd
ask here.

Any ideas? Thanks,

Robin

    > cat a.ll
    define void @a() {
      ret void
    }
    
    !bar = !{!3}
    
    !3 = !{void ()* @a}
    
    > cat b.ll
    define void @foo() !dbg !20 {
      ret void
    }
    
    !llvm.module.flags = !{!17, !18}
    
    !0 = distinct !DICompileUnit(language: DW_LANG_C89, file: !1)
    !1 = !DIFile(filename: "x.c", directory: "/tmp")
    !17 = !{i32 2, !"Dwarf Version", i32 4}
    !18 = !{i32 2, !"Debug Info Version", i32 3}
    !20 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 92, type: !21, unit: !0)
    !21 = !DISubroutineType(types: !22)
    !22 = !{null}
    !23 = !{}
    
    > llvm-link -o out a.ll b.ll
    invalid subroutine type ref
    !5 = !DISubroutineType(types: !0)
    !0 = !{void ()* @a}
    void ()* @a
    All DICompileUnits must be listed in llvm.dbg.cu
    llvm-link: error: linked module is broken!

(The *.ll files are stripped down from much larger files to find a
minimal example. I suppose the message about llvm.dbg.cu is just
because I removed a bit too much).

Robin

[1] https://llvm.org/bugs/show_bug.cgi?id=28697

-- 
Robin Sommer * ICSI/LBNL * robin at icir.org * www.icir.org/robin


More information about the llvm-dev mailing list