<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<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, and have a flag.<o:p></o:p></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? If the check is in CodeGen then I'd think it would be insensitive to LTO.<o:p></o:p></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.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">--paulr<o:p></o:p></span></p>
<p class="MsoNormal"><a name="_MailEndCompose"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></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:dblaikie@gmail.com]
<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<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></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">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">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?<o:p></o:p></p>
</div>
</div>
</div>
</body>
</html>