Closed Stamp1993 closed 3 years ago
I have exactly the same problem
$ ~/llvm-project/llvm/build/bin/llvm-cbe main.ll
/home/sha/llvm-project/llvm/build/bin/llvm-cbe: main.ll:192:163: error: invalid field 'variables'
!7 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 3, type: !8, isLocal: false, isDefinition: true, scopeLine: 3, isOptimized: false, unit: !0, variables: !2)
^
Same using clang-9, llvm-10, ubuntu 18.04:
~/decompile_tool/llvm-cbe/build/tools/llvm-cbe/llvm-cbe main.ll
/home/muqi/decompile_tool/llvm-cbe/build/tools/llvm-cbe/llvm-cbe: main.ll:192:163: error: invalid field 'variables'
!7 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 3, type: !8, isLocal: false, isDefinition: true, scopeLine: 3, isOptimized: false, unit: !0, variables: !2)
@Muqi-Zou, since you said “clang-9, llvm-10” am pretty sure the problem is you're producing LLVM IR with one version of LLVM (Clang 9 is LLVM 9) but consuming it with a different one (LLVM 10). There is not full compatibility of LLVM IR between versions, it is an unstable format.
Perhaps that is also @Stamp1993 and @NulAsh's problem? You really need to use the same LLVM version for Clang and for LLVM-CBE.
I don't know about Ubuntu 18.04, but on Ubuntu 20.04 I could do sudo apt install llvm-10-dev clang-10
and thus get matching LLVM 10 versions of the LLVM framework and Clang.
If there's not LLVM 10 available on 18.04, maybe there's LLVM 9 or something?
@Muqi-Zou, since you said “clang-9, llvm-10” am pretty sure the problem is you're producing LLVM IR with one version of LLVM (Clang 9 is LLVM 9) but consuming it with a different one (LLVM 10). There is not full compatibility of LLVM IR between versions, it is an unstable format.
Perhaps that is also @Stamp1993 and @NulAsh's problem? You really need to use the same LLVM version for Clang and for LLVM-CBE.
Clang 10.0 + llvm 10.0 + ubuntu 18.04 works! Thanks a lot.
llvm-cbe compiles, but both when building and testing llvm-cbe on Step 3: Usage Examples or when I try to use it for any of my generated IR I get the same error:
error: invalid field 'variables'
Is it some version incompatibility, wrong compilers, or my mistake? I think 'variables' fields should be supported somehow