[llvm-bugs] [Bug 50689] New: Finish / clean up MapFile implementation

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jun 11 18:07:02 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=50689

            Bug ID: 50689
           Summary: Finish / clean up MapFile implementation
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: MachO
          Assignee: unassignedbugs at nondot.org
          Reporter: jezreel at gmail.com
                CC: gkm at fb.com, jezreel at gmail.com,
                    llvm-bugs at lists.llvm.org, smeenai at fb.com

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:
https://github.com/llvm/llvm-project/blob/main/lld/MachO/MapFile.cpp#L153.
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
https://bugs.llvm.org/show_bug.cgi?id=48657. 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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210612/7ae4254c/attachment.html>


More information about the llvm-bugs mailing list