ld.lld: error: Invalid record


I am using LTO and a compile pass to make changes to a target.
So far that compile pass worked fine on many larger code projects,
however on a specific large target something seems to get wrong and lld
is not very helpful in the output:

ld.lld: /usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crt1.o
ld.lld: /tmp/jasper-73de9f.o
ld.lld: src/libjasper/.libs/libjasper.a
[lots more libraries]
ld.lld: error: Invalid record (Producer: 'LLVM11.0.0git' Reader: 'LLVM

How can I find out which LLVM-IR entry in /tmp/jasper-73de9f.o is
resulting in that problem?
Thank you!


The diagnostic may come from one of 224 instances of
`return error("Invalid record")` in lib/Bitcode/Reader/{BitcodeReader,MetadataLoader}.cpp
I think you need a -DCMAKE_BUILD_TYPE=Build build and locate the exact
place by setting a breakpoing on BitcodeReaderBase::error