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
would be good to brew install clang-format :)