<div dir="ltr">Adrian: any thoughts? Has LLDB been fixed to support this yet?<br><br><div class="gmail_quote"><div dir="ltr">On Tue, Aug 8, 2017 at 6:33 AM Robinson, Paul <<a href="mailto:paul.robinson@sony.com">paul.robinson@sony.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="EN-US" link="blue" vlink="purple">
<div class="m_-655672930990255388WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">My inclination would be to use "disable if 32-bit and –ggnu-pubnames" as the default, </span></p></div></div></blockquote><div><br>Unfortunately Nico points out that Chrome doesn't currently use -ggnu-pubnames :/ So to continue to work "out of the box" we'd have to broaden the surface to "disable if 32 bit and targeting gdb".<br><br>-ggnu-pubnames makes gdb-index creation much more efficient by allowing gdb-index generation not to have to parse most of the DWARF DIEs, and just create the index straight from a table. (this is necessary for correctness in -gsplit-dwarf mode (where the DIEs are not available at link time as they're in the .dwo not the .o), and an efficiency gain otherwise)<br><br>If "disable if 32 bit and targeting gdb" is overly broad (I feel it kind of is, but I'm not wedded to it) we could require those working around the gold bug to add -ggnu-pubnames to add a bit more of a specific hint that they're intending to build gdb-index from these objects.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="purple"><div class="m_-655672930990255388WordSection1"><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">and have a flag.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">This would be determined in DwarfDebug, right?</span></p></div></div></blockquote><div><br>Yes<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="purple"><div class="m_-655672930990255388WordSection1"><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> If the check is in CodeGen then I'd think it would be insensitive to LTO.</span></p></div></div></blockquote><div><br>There's some desire that LTO works as-if it was non-LTO. So if you pass flags (eg: debugger tuning flags, in this case) to each separate compile, you get the same behavior if you LTO as when you didn't - so we preserve things in the CU, and then do the specified thing per-CU. (eg: emission kind (gmlt/limited/full), split-debug-inlining, debug-info-for-profiling, etc)<br><br>In this case if, say, you're on an LLDB platform but prefer to use GDB (& happen to use Gold and gdb-index on 32 bit and LTO) - so you pass the debugger tuning=gdb flag to your compiles, it wouldn't disable the feature, because the flag would be consulted at CodeGen time and not at compile time when you passed the tuning flag. (oh, actually the tuning is passed down via TM Options anyway, not on the CU - so I guess you wouldn't be getitng the tuning at all today because that flag already doesn't follow the per-CU model... well I guess that makes it easier)<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="purple"><div class="m_-655672930990255388WordSection1"><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Setting it via IR/metadata is adding a bunch of complexity just to work around a gold bug.  Not worth it IMO.</span></p></div></div></blockquote><div><br>Fair enough. Any thoughts on whether it should be a frontend-visible option or just a cc1 or even backend option? I'll probably just leave it as a backend option at this point, could even implement the defaulting down in LLVM without any changes to Clang, I suppose... <br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="purple"><div class="m_-655672930990255388WordSection1"><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">--paulr<u></u><u></u></span></p>
<p class="MsoNormal"><a name="m_-655672930990255388__MailEndCompose"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></a></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> David Blaikie [mailto:<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>]
<br>
<b>Sent:</b> Monday, August 07, 2017 6:58 PM<br>
<b>To:</b> llvm-dev; Robinson, Paul; Adrian Prantl; Eric Christopher; Nico Weber<br>
<b>Subject:</b> DWARF: Ranges base address specifier entries & Gold's gdb-index 32 bit bug<u></u><u></u></span></p>
</div>
</div></div></div></div><div lang="EN-US" link="blue" vlink="purple"><div class="m_-655672930990255388WordSection1"><div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">Context:<br>
<br>
In r309526 (with a followup fix in r309529) I implemented the use of DWARF's debug_ranges base address specifier entries to reduce the number of object file relocations needed for debug_ranges*.<br>
<br>
* in a particular binary internally, an optimized build had a 70% reduction in debug_ranges.reloc, a 16% decrease in total object size (with compressed debug info and fission)<br>
<br>
Nico noted that this broke the Chromium build ( <a href="https://bugs.llvm.org/show_bug.cgi?id=34007" target="_blank">https://bugs.llvm.org/show_bug.cgi?id=34007</a> ). Turns out GNU Binutils Gold has a bug (I've reported it as: <a href="https://sourceware.org/bugzilla/show_bug.cgi?id=21894" target="_blank">https://sourceware.org/bugzilla/show_bug.cgi?id=21894</a> -
 wouldn't expect much action on it, though) where it fails to parse a base address specifier entry when trying to build gdb-index (-Wl,-gdb-index) for a 32 bit build.<br>
<br>
To address this in the short term, I added a flag that disables this feature by default for now.<br>
<br>
So, two questions:<br>
<br>
1) What does everyone reckon the best solution to this is?<br>
  * Keep the feature disabled by default - with a flag to enable it for those who want it/can use it<br>
  * Enable the feature everywhere - with a flag to disable it<br>
  * Conditionally disable (or conditionally enable) the feature, with a flag to enable/disable it<br>
    * best condition we probably have is "disabled if 32 bit and -ggnu-pubnames" (gnu-pubnames are necessary for efficient building of gdb-index, and isn't the default)<br>
2) How to implement the flag:<br>
  * backend option as it is currently (-mllvm -use-dwarf-ranges-base-address-specifier (maybe drop "-specifier" to make it a bit more terse))<br>
  * clang option that maps to<br>
    * backend option (as currently)<br>
    * MCOption (programmatic/C++ API rather than command line of a backend option)<br>
    * LLVM IR attribute on the CU (this feature could be supported on a per-CU basis easiyl enough, thus survive LTO, etc, exactly as the user requested (but really if the user requested this on at least one CU, they probably might as well have it on all their
 CUs))<br>
    * LLVM IR module metadata<br>
<br>
<br>
Any ideas/thoughts/other aspects?<u></u><u></u></p>
</div>
</div></div></div></blockquote></div></div>