[all-commits] [llvm/llvm-project] 422084: [lld][Macho] Include dead-stripped symbols in mapfile
Jez Ng via All-commits
all-commits at lists.llvm.org
Fri Jan 28 10:57:35 PST 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 422084332a783e9a496160908235ed71b1af9364
https://github.com/llvm/llvm-project/commit/422084332a783e9a496160908235ed71b1af9364
Author: Roger Kim <rgr at fb.com>
Date: 2022-01-28 (Fri, 28 Jan 2022)
Changed paths:
M lld/MachO/MapFile.cpp
M lld/test/MachO/dead-strip.s
Log Message:
-----------
[lld][Macho] Include dead-stripped symbols in mapfile
ld64 outputs dead stripped symbols when using the -dead-strip flag. This change mimics that behavior for lld.
ld64's -dead_strip flag outputs:
```
$ ld -map map basics.o -o out -dead_strip -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib -lSystem
$ cat map
# Path: out
# Arch: x86_64
# Object files:
[ 0] linker synthesized
[ 1] basics.o
# Sections:
# Address Size Segment Section
0x100003F97 0x00000021 __TEXT __text
0x100003FB8 0x00000048 __TEXT __unwind_info
0x100004000 0x00000008 __DATA_CONST __got
0x100008000 0x00000010 __DATA __ref_section
0x100008010 0x00000001 __DATA __common
# Symbols:
# Address Size File Name
0x100003F97 0x00000006 [ 1] _ref_local
0x100003F9D 0x00000001 [ 1] _ref_private_extern
0x100003F9E 0x0000000C [ 1] _main
0x100003FAA 0x00000006 [ 1] _no_dead_strip_globl
0x100003FB0 0x00000001 [ 1] _ref_from_no_dead_strip_globl
0x100003FB1 0x00000006 [ 1] _no_dead_strip_local
0x100003FB7 0x00000001 [ 1] _ref_from_no_dead_strip_local
0x100003FB8 0x00000048 [ 0] compact unwind info
0x100004000 0x00000008 [ 0] non-lazy-pointer-to-local: _ref_com
0x100008000 0x00000008 [ 1] _ref_data
0x100008008 0x00000008 [ 1] l_ref_data
0x100008010 0x00000001 [ 1] _ref_com
# Dead Stripped Symbols:
# Size File Name
<<dead>> 0x00000006 [ 1] _unref_extern
<<dead>> 0x00000001 [ 1] _unref_local
<<dead>> 0x00000007 [ 1] _unref_private_extern
<<dead>> 0x00000001 [ 1] _ref_private_extern_u
<<dead>> 0x00000008 [ 1] _unref_data
<<dead>> 0x00000008 [ 1] l_unref_data
<<dead>> 0x00000001 [ 1] _unref_com
```
Reviewed By: int3, #lld-macho, thevinster
Differential Revision: https://reviews.llvm.org/D114737
More information about the All-commits
mailing list