<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><br><div dir="ltr">On Jan 23, 2019, at 1:24 AM, xuruobin <<a href="mailto:xuruobin@huawei.com">xuruobin@huawei.com</a>> wrote:<br><br></div><blockquote type="cite"><div dir="ltr"><span>Hi vedant,</span><br><span></span><br><span>  The program didn't pass the checking "OF->getArch() != Triple(Arch).getArch()" loadBinaryFormat in CoverageMappingReader.cpp and returned an error. It's because "OF->getArch()" returned null and "Triple(Arch).getArch()" returned XXXX(name of my arch). </span><br><span>  The returned value of  " OF->getArch()" is decided by " EF.getHeader()->e_machine" but I found "e_machine" is defined somewhere in MCAssembler</span></div></blockquote><div><br></div><div>I haven’t double-checked, but I thought this definition came from llvm/Support/ELF.h?</div><div><br></div><br><blockquote type="cite"><div dir="ltr"><span>(My compiler uses binutils as assembler) . </span>Although I make some hacks to pass this checking, I still get other errors. So my problem is whether llvm-cov has to work with MCAssembler and is it possible to do it with binutils?</div></blockquote><div><br></div><div>Coverage support should be / is largely compatible with binutils, but you may have to watch out for this BFD bug: <a href="https://clang.llvm.org/docs/SourceBasedCodeCoverage.html#drawbacks-and-limitations">https://clang.llvm.org/docs/SourceBasedCodeCoverage.html#drawbacks-and-limitations</a></div><div><br></div><div>What is the error you see?</div><div><br></div><div>vedant </div><br><blockquote type="cite"><div dir="ltr"><span></span><br><span>Best,</span><br><span>Ruobin</span><br><span></span><br><blockquote type="cite"><span>-----邮件原件-----</span><br></blockquote><blockquote type="cite"><span>发件人: <a href="mailto:vsk@apple.com">vsk@apple.com</a> [<a href="mailto:vsk@apple.com">mailto:vsk@apple.com</a>]</span><br></blockquote><blockquote type="cite"><span>发送时间: 2019年1月23日 1:24</span><br></blockquote><blockquote type="cite"><span>收件人: xuruobin <<a href="mailto:xuruobin@huawei.com">xuruobin@huawei.com</a>></span><br></blockquote><blockquote type="cite"><span>抄送: <a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>; Yuchao (Michael)</span><br></blockquote><blockquote type="cite"><span><<a href="mailto:michael.yuchao@huawei.com">michael.yuchao@huawei.com</a>></span><br></blockquote><blockquote type="cite"><span>主题: Re: [llvm-dev] How to add new arch for llvm-cov show?</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>Hi Ruobin,</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><blockquote type="cite"><span>On Jan 21, 2019, at 5:21 PM, xuruobin via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>></span><br></blockquote></blockquote><blockquote type="cite"><span>wrote:</span><br></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>Hi all,</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>I'm trying to support llvm-cov for a new architecture and I have successfully</span><br></blockquote></blockquote><blockquote type="cite"><span>built compiler-rt for my arch. Following steps shown in</span><br></blockquote><blockquote type="cite"><span><a href="https://clang.llvm.org/docs/SourceBasedCodeCoverage.html">https://clang.llvm.org/docs/SourceBasedCodeCoverage.html</a> , I encountered</span><br></blockquote><blockquote type="cite"><span>an error for the last step(step of llvm-cov show).</span><br></blockquote><blockquote type="cite"><blockquote type="cite"><span>The command line was (supposed my arch is XXXX)</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>"llvm-cov show -arch=XXXX ./foo -instr-profile=foo.profdata"</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>and the error was</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>"Failed to load coverage: No object file for requested architecture."</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>I think I should add my arch information to somewhere(maybe an llvm-cov</span><br></blockquote></blockquote><blockquote type="cite"><span>support list?) but I don't know where to add these information. Can</span><br></blockquote><blockquote type="cite"><span>someone give me some suggestions?</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>You’ll need to teach libObject about this architecture. Specifically, the</span><br></blockquote><blockquote type="cite"><span>coverage reader checks that calling getArch() on a loaded ObjectFile matches</span><br></blockquote><blockquote type="cite"><span>Triple(Arch).getArch() (see loadBinaryFormat in</span><br></blockquote><blockquote type="cite"><span>CoverageMappingReader.cpp).</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>best,</span><br></blockquote><blockquote type="cite"><span>vedant</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>Best Regards,</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>Ruobin.</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>_______________________________________________</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>LLVM Developers mailing list</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span><a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a></span><br></blockquote></blockquote><span></span><br></div></blockquote></body></html>