<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 - Finish / clean up MapFile implementation"
   href="https://bugs.llvm.org/show_bug.cgi?id=50689">50689</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Finish / clean up MapFile implementation
          </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>All
          </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>MachO
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>jezreel@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>gkm@fb.com, jezreel@gmail.com, llvm-bugs@lists.llvm.org, smeenai@fb.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>These are probably good tasks for someone looking to get familiarized with the
LLD codebase, since the mapfile isn't critical to what we are working on at the
moment. (Please ping me first before starting on these.)

1. Dump dead-stripped symbols, as per this TODO:
<a href="https://github.com/llvm/llvm-project/blob/main/lld/MachO/MapFile.cpp#L153">https://github.com/llvm/llvm-project/blob/main/lld/MachO/MapFile.cpp#L153</a>.
Essentially, symbols for which `isLive()` returns false.

2. getSectionSyms() puts all the symbols into a map of section -> symbols, but
this seems unnecessary. This was likely copied from the ELF port, which prints
a section header before the list of symbols it contains. But the Mach-O map
file doesn't print these headers.

3. Parallelize the symbol sort. We can use LLVM's `parallel_sort` for this. If
two symbols have the same address, we can use their symbol name to tie-break;
the end result should be deterministic.

4. Dump the cstring / fixed-width literals (from CStringInputSection and
WordLiteralInputSection respectively) into the map file.

To see the expected map file output, download the tar attachment from
<a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - ld64.lld.darwinnew-linked Chromium Framework is somewhat crashy"
   href="show_bug.cgi?id=48657">https://bugs.llvm.org/show_bug.cgi?id=48657</a>. Unpack and link it like so: `ld
-map mapfile @response.txt`. This will generate a "mapfile" file in the CWD.
This mapfile will contain examples dead symbols and literals (grep for "literal
string" in the file).

That said, this file is pretty large (since Chromium is pretty large), so you
may want to construct smaller test programs for a better understanding.</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>