llvm-project/lld/MachO
Roger Kim f84023a812 [lld][macho] Stop grouping symbols by sections in mapfile.
As per [Bug 50689](https://bugs.llvm.org/show_bug.cgi?id=50689),

```
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.
```

This diff removes `getSectionSyms()` and keeps all symbols in a flat vector.

What does ld64's mapfile look like?
```
$ llvm-mc -filetype=obj -triple=x86_64-apple-darwin test.s -o test.o
$ llvm-mc -filetype=obj -triple=x86_64-apple-darwin foo.s -o foo.o
$ ld -map map test.o foo.o -o out -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib -lSystem
```

```
[  0] linker synthesized
[  1] test.o
[  2] foo.o
0x100003FB7     0x00000001      __TEXT  __text
0x100003FB8     0x00000000      __TEXT  obj
0x100003FB8     0x00000048      __TEXT  __unwind_info
0x100004000     0x00000001      __DATA  __common
0x100003FB7     0x00000001      [  1] _main
0x100003FB8     0x00000000      [  2] _foo
0x100003FB8     0x00000048      [  0] compact unwind info
0x100004000     0x00000001      [  1] _number
```

Perf numbers when linking chromium framework on a 16-Core Intel Xeon W Mac Pro:
```
base           diff           difference (95% CI)
sys_time   1.406 ± 0.020  1.388 ± 0.019  [  -1.9% ..   -0.6%]
user_time  5.557 ± 0.023  5.914 ± 0.020  [  +6.2% ..   +6.6%]
wall_time  4.455 ± 0.041  4.436 ± 0.035  [  -0.8% ..   -0.0%]
samples    35             35
```

Reviewed By: #lld-macho, int3

Differential Revision: https://reviews.llvm.org/D114735
2022-01-20 12:16:37 -08:00
..
Arch Use true/false instead of 1/0 (NFC) 2022-01-09 12:21:06 -08:00
CMakeLists.txt [lld-macho] Port CallGraphSort from COFF/ELF 2022-01-12 10:47:04 -05:00
CallGraphSort.cpp [lld-macho] Port CallGraphSort from COFF/ELF 2022-01-12 10:47:04 -05:00
CallGraphSort.h [lld-macho] Port CallGraphSort from COFF/ELF 2022-01-12 10:47:04 -05:00
ConcatOutputSection.cpp Re-land [LLD] Remove global state in lldCommon 2022-01-20 14:53:26 -05:00
ConcatOutputSection.h [lld-macho] Have ICF operate on all sections at once 2021-07-17 13:42:51 -04:00
Config.h Replace PlatformKind with PlatformType. 2022-01-13 09:23:49 -08:00
Driver.cpp Re-land [LLD] Remove global state in lldCommon 2022-01-20 14:53:26 -05:00
Driver.h Replace PlatformKind with PlatformType. 2022-01-13 09:23:49 -08:00
DriverUtils.cpp Re-land [LLD] Remove global state in lldCommon 2022-01-20 14:53:26 -05:00
Dwarf.cpp [lld-macho] Factor out common InputSection members 2021-07-01 21:22:39 -04:00
Dwarf.h [lld-macho] Emit STABS symbols for debugging, and drop debug sections 2020-12-01 15:05:20 -08:00
ExportTrie.cpp [lld-macho][NFC] add const to pointer/reference induction variables of range-based for loops 2021-03-10 12:07:31 -08:00
ExportTrie.h [lld-macho] Export trie addresses should be relative to the image base 2020-09-20 20:43:15 -07:00
ICF.cpp [lld/mac] Crash even less on undefined symbols with --icf=all 2021-11-19 09:23:19 -05:00
ICF.h [lld-macho] Move ICF earlier to avoid emitting redundant binds 2021-07-01 21:22:38 -04:00
InputFiles.cpp Re-land [LLD] Remove global state in lldCommon 2022-01-20 14:53:26 -05:00
InputFiles.h [lld-macho] Add --start-lib --end-lib 2022-01-19 10:14:49 -08:00
InputSection.cpp [MachO] Fix struct size assertion 2021-11-22 15:02:30 -08:00
InputSection.h [lld-macho] Port CallGraphSort from COFF/ELF 2022-01-12 10:47:04 -05:00
LTO.cpp Re-land [LLD] Remove global state in lldCommon 2022-01-20 14:53:26 -05:00
LTO.h [lld-macho] Add LTO cache support 2021-07-15 12:56:13 -04:00
MachOStructs.h [lld-macho] Add support for arm64_32 2021-04-15 21:16:33 -04:00
MapFile.cpp [lld][macho] Stop grouping symbols by sections in mapfile. 2022-01-20 12:16:37 -08:00
MapFile.h [lld-macho] implement options -map 2021-03-18 10:39:19 -04:00
MarkLive.cpp [lld-macho][nfc] Factor-out NFC changes from main __eh_frame diff 2021-11-17 15:16:44 -07:00
MarkLive.h [lld/mac] Implement -dead_strip 2021-06-02 11:09:26 -04:00
ObjC.cpp [lld-macho][nfc] rename parsed-section types & variables 2021-11-16 07:06:41 -07:00
ObjC.h [lld-macho] Implement -ObjC 2020-08-26 19:20:55 -07:00
Options.td [lld-macho] Implement -noall_load 2022-01-19 13:12:18 -08:00
OutputSection.cpp [lld/mac] Implement support for section$start and section$ end symbols 2021-07-23 16:01:09 -04:00
OutputSection.h [lld/mac] Implement support for section$start and section$ end symbols 2021-07-23 16:01:09 -04:00
OutputSegment.cpp [MachO] Properly reset global state 2021-10-31 16:14:29 -07:00
OutputSegment.h [MachO] Properly reset global state 2021-10-31 16:14:29 -07:00
Relocations.cpp [MachO] Move type size asserts to source files. NFC 2021-11-16 17:14:16 -08:00
Relocations.h [MachO] Move type size asserts to source files. NFC 2021-11-16 17:14:16 -08:00
SymbolTable.cpp [lld-macho] Add --start-lib --end-lib 2022-01-19 10:14:49 -08:00
SymbolTable.h [lld-macho] Add --start-lib --end-lib 2022-01-19 10:14:49 -08:00
Symbols.cpp [lld-macho] Rename LazySymbol to LazyArchive. NFC 2022-01-11 16:49:06 -08:00
Symbols.h [lld-macho] Add --start-lib --end-lib 2022-01-19 10:14:49 -08:00
SyntheticSections.cpp Re-land [LLD] Remove global state in lldCommon 2022-01-20 14:53:26 -05:00
SyntheticSections.h [lld-macho] If export_size is zero, export_off must be zero 2021-10-27 14:58:42 -04:00
Target.cpp [lld-macho][nfc] Create Relocations.{h,cpp} for relocation-specific code 2021-03-11 13:28:09 -05:00
Target.h [lld/mac] Set branchRange a bit more carefully 2021-08-30 12:36:06 -04:00
UnwindInfoSection.cpp [lld-macho] Add --start-lib --end-lib 2022-01-19 10:14:49 -08:00
UnwindInfoSection.h [lld-macho] Support renaming of LSDA section 2021-11-10 19:31:54 -05:00
Writer.cpp Re-land [LLD] Remove global state in lldCommon 2022-01-20 14:53:26 -05:00
Writer.h [MachO] Properly reset global state 2021-10-31 16:14:29 -07:00
ld64-vs-lld.rst [lld-macho] Fix grammar in doc 2022-01-19 23:59:35 -08:00