<div dir="ltr">Could you try putting together a prototype patch and testing it locally to see if it solves your problem?</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Jan 11, 2020 at 7:11 PM Shi, Steven via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div lang="EN-US">
<div class="gmail-m_5445184315315831376WordSection1">
<p class="MsoNormal">I checked the LLVM master code and find that the “-use-unknown-locations” option and its related logic is only supported for Dwarf debug info as below. These codes are missing in the Codeview side. It looks the “-use-unknown-locations”
option logic is not complex, could we port the code logic into llvm\lib\CodeGen\AsmPrinter\CodeViewDebug.cpp as well? I’ve submitted a BZ for this requirment:
<a href="https://bugs.llvm.org/show_bug.cgi?id=44522" target="_blank">https://bugs.llvm.org/show_bug.cgi?id=44522</a>
<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">llvm-project\llvm\lib\CodeGen\AsmPrinter\DwarfDebug.cpp :<u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">static cl::opt<DefaultOnOff> UnknownLocations(<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New""> "use-unknown-locations", cl::Hidden,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New""> cl::desc("Make an absence of debug location information explicit."),<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New""> cl::values(clEnumVal(Default, "At top of block or after label"),<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New""> clEnumVal(Enable, "In all cases"), clEnumVal(Disable, "Never")),<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New""> cl::init(Default));<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">... ...
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New""> // If user said Don't Do That, don't do that.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New""> if (UnknownLocations == Disable)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New""> return;<u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">This issue blocks the LLVM toolchain debugging capability for UEFI firmware. Please help to add the support. Thank you in advance!<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText">Thanks<u></u><u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText">Steven Shi<b><span style="font-size:12pt;font-family:Arial,sans-serif"><u></u><u></u></span></b></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div style="border-top:none;border-right:none;border-bottom:none;border-left:1.5pt solid blue;padding:0cm 0cm 0cm 4pt">
<div>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0cm 0cm">
<p class="MsoNormal"><a name="m_5445184315315831376______replyseparator"></a><b>From:</b> Shi, Steven <br>
<b>Sent:</b> Friday, January 10, 2020 9:43 AM<br>
<b>To:</b> Martin Storsjö <<a href="mailto:martin@martin.st" target="_blank">martin@martin.st</a>>; David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>><br>
<b>Cc:</b> Reid Kleckner <<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>>; llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>>; Rui Ueyama <<a href="mailto:ruiu@google.com" target="_blank">ruiu@google.com</a>><br>
<b>Subject:</b> RE: [llvm-dev] LLD PDB Lines zero number issue<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText">Hi Martin,<u></u><u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText">I tried your suggestion of adding "-mllvm -use-unknown-locations=Disable" in the clang CC flag to build test case in my previous email, but it looks still not work in my side with llvm 9.0.0. Could you give me some more advices? Do
I need to use the master LLVM instead of the 9.0.0?<u></u><u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText"><u></u> <u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText">$ make -f makefile_clanglto_Oz
<u></u><u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText">"/home/jshi19/llvm/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/clang" -g -m64 -mcmodel=small -target x86_64-unknown-windows -gcodeview
<span style="color:red">-mllvm -use-unknown-locations=Disable </span>-flto -Oz -c -o main.obj main.c<u></u><u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText">"nasm" -f win64 -o assembly.obj assembly.nasm<u></u><u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText">"/home/jshi19/llvm/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/llvm-lib" /OUT:main.lib main.obj<u></u><u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText">"/home/jshi19/llvm/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/llvm-lib" /OUT:assembly.lib assembly.obj<u></u><u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText">"/home/jshi19/llvm/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/lld-link" /OUT:main.dll /Machine:X64 /DLL /ENTRY:main /DEBUG:GHASH /lldmap main.lib assembly.lib<u></u><u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText"><u></u> <u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText">$ /home/jshi19/llvm/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/llvm-pdbutil dump -l main.pdb<u></u><u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText"> Lines<u></u><u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText">============================================================<u></u><u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText">Mod 0000 | `assembly.obj`:<u></u><u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText">Mod 0001 | `/home/jshi19/llvm/wrongcode/lld-link5/lto.tmp`:<u></u><u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText">/home/jshi19/llvm/wrongcode/lld-link5/main.c (MD5: 5F82BB79FE2DA0B0549B784CFDC37D05)<u></u><u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText"> 0001:00000004-0000001E, line/addr entries = 5<u></u><u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText"> 3 00000004 ! <span style="color:red">0 00000008 !
</span> 5 0000000D ! <span style="color:red">0 00000012 ! </span>9 00000017 !<u></u><u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText"><u></u> <u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText"><u></u> <u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText">Thanks<u></u><u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText">Steven Shi<u></u><u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText"><u></u> <u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText"><u></u> <u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText">> -----Original Message-----<u></u><u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText">> From: Martin Storsjö <<a href="mailto:martin@martin.st" target="_blank">martin@martin.st</a>><u></u><u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText">> Sent: Friday, January 10, 2020 5:00 AM<u></u><u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText">> To: David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>><u></u><u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText">> Cc: Shi, Steven <<a href="mailto:steven.shi@intel.com" target="_blank">steven.shi@intel.com</a>>; Reid Kleckner <<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>>;<u></u><u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText">> llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>><u></u><u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText">> Subject: Re: [llvm-dev] LLD PDB Lines zero number issue<u></u><u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText">> <u></u><u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText">> On Thu, 9 Jan 2020, David Blaikie via llvm-dev wrote:<u></u><u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText">> <u></u><u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText">> > +rnk who works on COFF debugging things.<u></u><u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText">> ><u></u><u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText">> > My understanding is that this has nothing to do with the linker - but is a<u></u><u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText">> > function of LLVM optimizations creating line zero debug locations. I believe<u></u><u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText">> > rnk & folks have disabled line zero emission for CodeView debug info in<u></u><u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText">> some<u></u><u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText">> > manner - perhaps that needs a flag? or Steven hasn't got a release with<u></u><u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText">> that<u></u><u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText">> > change in it?<u></u><u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText">> <u></u><u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText">> I think I've run into that with dwarf as well, and there AFAIK it can be<u></u><u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText">> gotten rid of by adding "-mllvm -use-unknown-locations=Disable".<u></u><u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText">> <u></u><u></u></p>
<p class="gmail-m_5445184315315831376MsoPlainText">> // Martin<u></u><u></u></p>
</div>
</div>
</div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>