diff options
| author | Kevin Enderby <enderby@apple.com> | 2017-06-19 19:38:22 +0000 |
|---|---|---|
| committer | Kevin Enderby <enderby@apple.com> | 2017-06-19 19:38:22 +0000 |
| commit | df0d6dabb24d05cd51fe5560ac34d69abe6157b6 (patch) | |
| tree | ad3c0adbdc3b223344f3841c054636b50d1b0da3 /llvm/test | |
| parent | 42175cb0d7c8f329ee184cfa41c0b34ae3447608 (diff) | |
| download | bcm5719-llvm-df0d6dabb24d05cd51fe5560ac34d69abe6157b6.tar.gz bcm5719-llvm-df0d6dabb24d05cd51fe5560ac34d69abe6157b6.zip | |
Change llvm-nm for Mach-O files to use dyld info in some cases when printing symbols.
In order to reduce swift binary sizes, Apple is now stripping swift symbols
from the nlist symbol table. llvm-nm currently only looks at the nlist symbol
table and misses symbols that are present in dyld info. This makes it hard to
know the set of symbols for a binary using just llvm-nm. Unless you know to
run llvm-objdump -exports-trie that can output the exported symbols in the dyld
info from the export trie, which does so but in a different format.
Also moving forward the time may come a when a fully linked Mach-O file that
uses dyld will no longer have an nlist symbol table to avoid duplicating the
symbol information.
This change adds three flags to llvm-nm, -add-dyldinfo, -no-dyldinfo, and
-dyldinfo-only.
The first, -add-dyldinfo, has the same effect as when the new bit in the Mach-O
header, MH_NLIST_OUTOFSYNC_WITH_DYLDINFO, appears in a binary. In that it
looks through the dyld info from the export trie and adds symbols to be printed
that are not already in its internal SymbolList variable. The -no-dyldinfo
option turns this behavior off.
The -dyldinfo-only option only looks at the dyld information and recreates the
symbol table from the dyld info from the export trie and binding information.
As if it the Mach-O file had no nlist symbol table.
Also fixed a few bugs with Mach-O N_INDR symbols not correctly printing the
indirect name, or in the same format as the old nm-classic program.
rdar://32021551
llvm-svn: 305733
Diffstat (limited to 'llvm/test')
| -rwxr-xr-x | llvm/test/tools/llvm-nm/X86/Inputs/Strip-ST.dylib.macho-x86_64 | bin | 0 -> 8344 bytes | |||
| -rw-r--r-- | llvm/test/tools/llvm-nm/X86/dyldinfo.test | 18 |
2 files changed, 18 insertions, 0 deletions
diff --git a/llvm/test/tools/llvm-nm/X86/Inputs/Strip-ST.dylib.macho-x86_64 b/llvm/test/tools/llvm-nm/X86/Inputs/Strip-ST.dylib.macho-x86_64 Binary files differnew file mode 100755 index 00000000000..65eb0ece374 --- /dev/null +++ b/llvm/test/tools/llvm-nm/X86/Inputs/Strip-ST.dylib.macho-x86_64 diff --git a/llvm/test/tools/llvm-nm/X86/dyldinfo.test b/llvm/test/tools/llvm-nm/X86/dyldinfo.test new file mode 100644 index 00000000000..3a632c57737 --- /dev/null +++ b/llvm/test/tools/llvm-nm/X86/dyldinfo.test @@ -0,0 +1,18 @@ +# RUN: llvm-nm %p/Inputs/Strip-ST.dylib.macho-x86_64 | FileCheck --check-prefix=DEFAULT %s +# RUN: llvm-nm -no-dyldinfo %p/Inputs/Strip-ST.dylib.macho-x86_64 | FileCheck --check-prefix=NO-DYLDINFO %s +# RUN: llvm-nm -dyldinfo-only %p/Inputs/Strip-ST.dylib.macho-x86_64 | FileCheck --check-prefix=DYLDINFO-ONLY %s + +# DEFAULT: 0000000000000f90 T __Bob_is_slow +# DEFAULT: 0000000000001008 D __T0ims_data +# DEFAULT: 0000000000000f80 T __T0om_is_not_swift +# DEFAULT: U dyld_stub_binder + +# NO-DYLDINFO: 0000000000000f90 T __Bob_is_slow +# NO-DYLDINFO-NOT: __T0ims_data +# NO-DYLDINFO-NOT: __T0om_is_not_swift +# NO-DYLDINFO: U dyld_stub_binder + +# DYLDINFO-ONLY: 0000000000000f90 T __Bob_is_slow +# DYLDINFO-ONLY: 0000000000001008 D __T0ims_data +# DYLDINFO-ONLY: 0000000000000f80 T __T0om_is_not_swift +# DYLDINFO-ONLY-NOT: U dyld_stub_binder |

