倉庫指標
- Star
- (26,378 star)
- PR 合併指標
- (平均合併 1天 2小時) (30 天內合併 1,000 個 PR)
描述
| Bugzilla Link | 50689 |
| Version | unspecified |
| OS | All |
| CC | @gkmhub,@int3,@thevinster,@nico,@carbon-steel,@smeenai,@TH3CHARLie |
Extended Description
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.)
-
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. -
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.
-
Parallelize the symbol sort. We can use LLVM's
parallel_sortfor this. If two symbols have the same address, we can use their symbol name to tie-break; the end result should be deterministic. -
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 llvm/llvm-project#48001 . 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.