<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - lld creates redundant debug entries for enums"
   href="https://bugs.llvm.org/show_bug.cgi?id=37933">37933</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>lld creates redundant debug entries for enums
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lld
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>brucedawson@chromium.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>While running Chrome's ShowGlobals.exe on Chrome's canary PDBs I noticed
hundreds of reports of redundant global variables that were in fact enums.

<a href="https://cs.chromium.org/chromium/src/tools/win/ShowGlobals/ShowGlobals.cc?q=showglobals.cc&sq=package:chromium&g=0&l=1">https://cs.chromium.org/chromium/src/tools/win/ShowGlobals/ShowGlobals.cc?q=showglobals.cc&sq=package:chromium&g=0&l=1</a>

The tool has since been fixed to avoid these reports:

<a href="https://chromium-review.googlesource.com/c/chromium/src/+/1114291">https://chromium-review.googlesource.com/c/chromium/src/+/1114291</a>

However, the issue remains that redundant enum symbols are being emitted by
lld. I created a more minimal repro that is fairly convenient for anyone with
access to the Chrome source code. Using the pre-fix version of ShowGlobals.exe:

<span class="quote">> gn gen out\default</span >
Done. Made 8629 targets from 1585 files in 3328ms
<span class="quote">> ninja -C out\default base && showglobals_old.exe out\default\base.dll.pdb | head</span >
ninja: Entering directory `out\default'
[1 processes, 354/354 @ 15.1/s : 23.374s ] LINK(DLL) base.dll base.dll.lib
base.dll.pdb
#Dups   DupSize   Size  Section Symbol name     PDB name
92      736          0  0       num_bound_args  out\default\base.dll.pdb
17      136          0  0       atomic_histogram_pointer       
out\default\base.dll.pdb
30      120          0  0       TP_CALLBACK_PRIORITY_INVALID   
out\default\base.dll.pdb
30      120          0  0       PowerUserMaximum       
out\default\base.dll.pdb
30      120          0  0       JOB_OBJECT_NET_RATE_CONTROL_VALID_FLAGS
out\default\base.dll.pdb
30      120          0  0       JOB_OBJECT_NET_RATE_CONTROL_MAX_BANDWIDTH      
out\default\base.dll.pdb
30      120          0  0       JOB_OBJECT_NET_RATE_CONTROL_ENABLE     
out\default\base.dll.pdb
30      120          0  0       JOB_OBJECT_NET_RATE_CONTROL_DSCP_TAG   
out\default\base.dll.pdb
30      120          0  0       JOB_OBJECT_IO_RATE_CONTROL_STANDALONE_VOLUME   
out\default\base.dll.pdb

However if I change from the default settings (empty args.gn) to having a
single line which is "use_lld=false" then I get the following results:

#Dups   DupSize   Size  Section Symbol name     PDB name
92      736          0  0       num_bound_args  out\default\base.dll.pdb
17      136          0  0       atomic_histogram_pointer       
out\default\base.dll.pdb
11      88           0  0       instance_       out\default\base.dll.pdb
85      85           0  0       is_weak_call    out\default\base.dll.pdb
85      85           0  0       is_method       out\default\base.dll.pdb
1       64           0  0       kEnvironmentParams     
out\default\base.dll.pdb
4       64           0  0       kCookieValue    out\default\base.dll.pdb
7       56           0  0       kCircularBufferInitialCapacity 
out\default\base.dll.pdb
1       56           0  0       buffer_ out\default\base.dll.pdb

This clearly indicates that lld is creating redundant enum entries in the debug
information. These are not necessarily a problem (the new version of
ShowGlobals.exe filters out all enums) but it seemed worth reporting.

I'm not sure if this is related to the (old, fixed) bug at
<a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - duplicated debug info for enums"
   href="show_bug.cgi?id=14108">https://bugs.llvm.org/show_bug.cgi?id=14108</a></pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>