summaryrefslogtreecommitdiffstats
path: root/llvm/test/tools/llvm-nm/X86
Commit message (Collapse)AuthorAgeFilesLines
* [llvm-nm] Additional lit tests for command line optionsChris Jackson2019-06-136-18/+38
| | | | | | Differential Revision: https://reviews.llvm.org/D62955 llvm-svn: 363248
* [llvm-nm] Fix Bug 41353 - unique symbols printed as D instead of uJordan Rupprecht2019-05-241-0/+50
| | | | | | | | | | | | | | | | | | | | | Summary: https://bugs.llvm.org/show_bug.cgi?id=41353 I'm new to LLVM and C++ so please do not hesitate to iterate with me on this fix. Patch by Mike Pozulp! Reviewers: rupprecht, zbrid, grimar, jhenderson Reviewed By: rupprecht, jhenderson Subscribers: jhenderson, chrisjackson, MaskRay, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D61117 llvm-svn: 361595
* [llvm-nm] Fix handling of symbol types 't' 'd' 'r'Fangrui Song2019-05-092-8/+0
| | | | | | | | | | | | | | | | | | | This restores part of r359311 that was reverted by r359830. Rewrite the symbol types to fix several issues. Notable difference is that the type of __init_array_start changes from 't' to 'd'. GNU nm used to mark ELF symbols relative to .init_array as 't' https://sourceware.org/bugzilla/show_bug.cgi?id=24505 (before 2.33) because ".init" is the prefix. The bug was copied by r287803. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D61551 llvm-svn: 360339
* [llvm-nm] Convert weak.test to use yaml2obj and fix unntested 'v'Fangrui Song2019-05-042-6/+35
| | | | | | This restores part of the good change reverted by r359830. llvm-svn: 359965
* Revert [llvm-nm] Fix handling of symbol types + [llvm-nm] Generalize symbol ↵Jordan Rupprecht2019-05-024-84/+13
| | | | | | | | types This reverts r359311 and r359312 (git commit 0bf06a8f59b0074a60871865e828d92db8930c59 and 5f184f17800ea2ac27be5e4ab540cb94a46e80c7) llvm-svn: 359830
* [llvm-ar][llvm-nm][llvm-size] Change -long-option to --long-option in tests. NFCFangrui Song2019-05-012-2/+2
| | | | llvm-svn: 359688
* [llvm-nm][llvm-readelf] Avoid single-dash -long-option in testsFangrui Song2019-04-273-8/+8
| | | | llvm-svn: 359383
* [llvm-nm] Fix handling of symbol types 't' 'd' 'r'Fangrui Song2019-04-264-13/+84
| | | | | | | | | | | | | | | In addition, fix and convert the two tests to yaml2obj based. This allows us to delete two executables. X86/weak.test: 'v' was not tested X86/init-fini.test: symbol types of __bss_start _edata _end were wrong GNU nm reports __init_array_start as 't', and __preinit_array_start as 'd'. __init_array_start is 't' just because its section ".init_array" starts with ".init" 'd' makes more sense and allows us to drop the weird SHT_INIT_ARRAY rule. So, change __init_array_start to 'd' instead. llvm-svn: 359311
* [llvm-nm][llvm-size] Use --double-dash options in testsFangrui Song2019-04-261-1/+1
| | | | llvm-svn: 359308
* [llvm-nm]Add support for --no-demangleJames Henderson2019-04-031-0/+7
| | | | | | | | | | | | | GNU nm has --no-demangle, so llvm-nm should too. It disables the --demangle switch. The patch also allows --demangle to be specified multiple times (the last of all --no-demangle/--demangle switches takes precedence). Reviewed by: grimar, rupprecht, mattd Differential Revision: https://reviews.llvm.org/D60134 llvm-svn: 357575
* Improve "llvm-nm -f sysv" output for Elf filesSunil Srivastava2019-03-082-5/+6
| | | | | | | | | | Specifically, compute and Print Type and Section columns. This is a re-commit of rL354833, after fixing the Asan problem found a a buildbot. Differential Revision: https://reviews.llvm.org/D59060 llvm-svn: 355742
* Revert "Improve "llvm-nm -f sysv" output for Elf files"Vlad Tsyrklevich2019-02-262-5/+5
| | | | | | | This reverts commit r354833, it was causing ASan test failures on sanitizer-x86_64-linux-fast. llvm-svn: 354849
* Improve "llvm-nm -f sysv" output for Elf filesSunil Srivastava2019-02-262-5/+5
| | | | | | | | Specifically, compute and Print Type and Section columns. Differential Revision: https://reviews.llvm.org/D58263 llvm-svn: 354833
* llvm-nm: Observe -no-llvm-bc for archive membersDave Lee2019-02-161-0/+15
| | | | | | | | | | | | | | | | | | | | | Summary: This change fixes the `-no-llvm-bc` flag to work with object files within archives. Currently the `-no-llvm-bc` flag works for regular object files, but not static libraries, where it continues to show bitcode symbol info. Original support was added in D4371. Reviewers: compnerd, smeenai, pcc Reviewed By: compnerd Subscribers: rupprecht, keith, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D48798 llvm-svn: 354196
* Compute the correct symbol size in llvm-nm even without --print-sizeSunil Srivastava2019-02-032-2/+2
| | | | | | | | | | | | | | In llvm-nm, the symbol size was being computed only with --print-size option, even though it was being printed in other cases, such as with --format=posix. This patch simply removes the guard, so that the size is computed independently of the later decision to print it or not. Fixes PR39997. Differential Revision: https://reviews.llvm.org/D57599 llvm-svn: 353011
* [llvm-nm] Allow --size-sort to print symbols with only Symbol sizeSaurabh Badhwar2019-01-161-0/+12
| | | | | | | | | | | | | | | | | | | Summary: When llvm-nm is passed only the --size-sort option for an object file, there is no output generated. The commit modifies the behavior to print the symbols sorted and their size which is also inline with the output of the GNU nm tool. Signed-off-by: Saurabh Badhwar <sbsaurabhbadhwar9@gmail.com> Reviewers: enderby, rupprecht Reviewed By: rupprecht Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D56063 llvm-svn: 351347
* [llvm-nm] Add --portability as alias for --format=posixJames Henderson2019-01-071-0/+5
| | | | | | | | | | | | | GNU nm supports this alias, so supporting it in llvm-nm makes it easier to transition between the two. Fixes https://bugs.llvm.org/show_bug.cgi?id=40002 Reviewed by: mstorsjo, rupprecht Differential Revision: https://reviews.llvm.org/D56312 llvm-svn: 350522
* [llvm-nm] Include the text "@FILE" in the output of --helpMartin Storsjo2018-10-111-0/+5
| | | | | | | | | | libtool requires this text to be present, in order to conclude that the tool supports response files. Also add an explicit test of using response files with llvm-nm. Differential Revision: https://reviews.llvm.org/D53064 llvm-svn: 344222
* [llvm-nm] Write "no symbol" output to stderrPetr Hosek2018-10-051-2/+2
| | | | | | | | | | This matches the output of binutils' nm and ensures that any scripts or tools that use nm and expect empty output in case there no symbols don't break. Differential Revision: https://reviews.llvm.org/D52943 llvm-svn: 343887
* [llvm-nm] Print an explicit "no symbols" message when an object file has no ↵Jordan Rupprecht2018-10-031-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | symbols Summary: GNU nm (and other nm implementations, such as "go tool nm") prints an explicit "no symbols" message when an object file has no symbols. Currently llvm-nm just doesn't print anything. Adding an explicit "no symbols" message will allow llvm-nm to be used in place of nm: some scripts and build processes use `nm <file> | grep "no symbols"` as a test to see if a file has no symbols. It will also be more familiar to anyone used to nm. That said, the format implemented here is slightly different, in that it doesn't print the tool name in the message (which IMHO is not useful to include). Demo: ``` $ for nm in nm bin/llvm-nm ; do echo "nm implementation: $nm"; $nm /tmp/foo{1,2}.o; echo; done nm implementation: nm /tmp/foo1.o: nm: /tmp/foo1.o: no symbols /tmp/foo2.o: 0000000000000000 T foo2 nm implementation: bin/llvm-nm /tmp/foo1.o: no symbols /tmp/foo2.o: 0000000000000000 T foo2 ``` Reviewers: MaskRay Reviewed By: MaskRay Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D52810 llvm-svn: 343742
* nm: Add -no-weak flag for hiding weak symbolsDave Lee2018-07-021-0/+1
| | | | | | | | | | | | | | | | | | Summary: This adds a new -no-weak flag to nm to hide weak symbols in its output. This also adds a -W alias for this which is analogous to -U. Patch by Keith Smiley Reviewers: kastiglione, enderby, compnerd Reviewed By: kastiglione Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D48751 llvm-svn: 336126
* For llvm-nm and Mach-O files that are fully stripped, special case a ↵Kevin Enderby2018-03-292-0/+6
| | | | | | | | | | | | | | redacted LC_MAIN As a further refinement on: r328274 - For llvm-nm and Mach-O files also use function starts info in some cases when printing symbols we want to special case a redacted LC_MAIN so it is easier to find. rdar://38978929 llvm-svn: 328820
* For llvm-nm and Mach-O files also use function starts info in someKevin Enderby2018-03-222-0/+8
| | | | | | | | | | | | | | cases when printing symbols. As an improvement to: r305733 - Change llvm-nm for Mach-O files to use dyld info in some cases when printing symbols it could be made a bit better if it also read the function starts and faked up nlist entries to those address not already faked up by the other dyld info. This would help with stripped static functions. rdar://38761029 llvm-svn: 328274
* Do not look up symbol names when n_strx == 0Michael Trent2018-01-032-0/+15
| | | | | | | | | | | | | | | | | | | | | | Summary: Historical tools for working with mach-o binaries verify the nlist field n_strx has a non-zero value before using that value to retrieve symbol names. Under some cirumstances, llvm-nm will attempt to display the symbol name at position 0, even though symbol names at that position are not well defined. This change addresses this problem by returning an empty string when n_strx is zero. rdar://problem/35750548 Reviewers: enderby, davide Reviewed By: enderby, davide Subscribers: davide, llvm-commits, JDevlieghere Differential Revision: https://reviews.llvm.org/D41657 llvm-svn: 321773
* [llvm-nm] Don't error out on multiple occurrances of the -g/--external-only flagMartin Storsjo2017-11-031-0/+1
| | | | | | | | | | | GNU binutils nm doesn't error out on this, and some projects' build systems can end up doing that in some cases. Allowing that seems like a better target than trying to avoid user projects passing multiple -g parameters to $NM. Differential Revision: https://reviews.llvm.org/D39539 llvm-svn: 317301
* [llvm-nm] Print 'I' for import table data in COFFMartin Storsjo2017-11-031-0/+2
| | | | | | | | | | | | | | | | | | | | | | The character gets uppercased into 'I' when it's a global symbol. In GNU binutils, nm prints 'I' for symbols classified by bfd_is_ind_section - which probably isn't exactly/only import tables. When building for win32, (some incarnations of?) libtool has got rules that try to inspect linked libraries, and in order to be sure that it is linking to a DLL import library as opposed to a static library, it expects to find the string " I " in the output of $NM when run on such an import library. GNU binutils nm also flags all of the .idata$X chunks as 'i' (while this patch only makes it set on .idata$2 and .idata$6) and also flags __imp__function as 'I'. Differential Revision: https://reviews.llvm.org/D39540 llvm-svn: 317300
* Fix a crash in llvm-nm for a bad Mach-O file that has an N_SECT type symbol ↵Kevin Enderby2017-09-132-0/+8
| | | | | | | | | | | | | | and a zero n_sect value. The code in llvm-nm for Mach-O files to determine the section type for an N_SECT type symbol it will call getSymbolSection() and check for the error, but in the case the n_sect value is zero it will return section_end() (aka nullptr). And the code was using that and crashing instead of just returning a ’s’ for a section or printing (?,?) as it would if getSymbolSection() returned an error. rdar://33136604 llvm-svn: 313193
* [llvm-nm] Fix output formatting of -f sysv for 64bit targetsSam Clegg2017-08-313-0/+19
| | | | | | Differential Revision: https://reviews.llvm.org/D37347 llvm-svn: 312284
* llvm-nm: Add support for symbol demangling (-C/--demangle)Sam Clegg2017-06-291-0/+37
| | | | | | Differential Revision: https://reviews.llvm.org/D34668 llvm-svn: 306718
* Change llvm-nm for Mach-O files to use dyld info in some cases when printing ↵Kevin Enderby2017-06-192-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Print symbols from COFF import libraries.Rafael Espindola2017-05-242-0/+7
| | | | | | | | | This change allows llvm-nm to print symbols found in import libraries, in part by allowing COFFImportFiles to be casted to SymbolicFiles. Patch by Dave Lee! llvm-svn: 303821
* llvm-nm: Print correct symbol types for init and fini sectionsMeador Inge2016-11-232-0/+8
| | | | | | | | | This patch fixes a small bug where symbols defined in the INIT and FINI sections were incorrectly getting a type of 'n'. Differential Revision: https://reviews.llvm.org/D26937 llvm-svn: 287803
* llvm-nm: Don't print value or size for undefined or weak symbolsMeador Inge2016-11-232-0/+6
| | | | | | | | | | | | | | | | | Undefined and weak symbols don't have a meaningful size or value. As such, nothing should be printed for those attributes (this is already done for the address with 'U') with the BSD format. This matches what GNU nm does. Note that for the POSIX.2 format [1] zero values are still printed for the size and value. This seems in spirit with the format strings in that specification, but is debatable. [1] http://pubs.opengroup.org/onlinepubs/9699919799/ Differential Revision: https://reviews.llvm.org/D26936 llvm-svn: 287802
* Fix some bugs in the posix output of llvm-nm. Which is documented onKevin Enderby2016-03-294-5/+10
| | | | | | | | | | | | | | http://pubs.opengroup.org/onlinepubs/9699919799/utilities/nm.html . 1) For Mach-O files the code was not printing the values in hex as is the default. 2) The values printed had leading zeros which they should not have. 3) The address for undefined symbols was printed as spaces instead of 0. 4) With the -A option with posix output for an archive did not use square brackets around the archive member name. rdar://25311883 and rdar://25299678 llvm-svn: 264778
* [llvm-nm] Correct -P ELF outputJames Molloy2016-03-242-0/+4
| | | | | | Correctly add a space between the address and size when outputting in posix mode (-P). llvm-svn: 264247
* Make llvm-nm test consistent with other testsHemant Kulkarni2016-02-103-85/+84
| | | | llvm-svn: 260464
* [llvm-nm] Add -radix optionHemant Kulkarni2016-02-103-0/+267
| | | | | | Differential Revision: http://reviews.llvm.org/D16822 llvm-svn: 260392
* Fix llvm-nm(1) printing of llvm-bitcode files for -format darwin to match ↵Kevin Enderby2015-11-103-0/+18
| | | | | | | | darwin’s nm(1). Also a small fix to match printing of Mach-O objects with -format posix. llvm-svn: 252567
* Allow llvm-nm’s single letter command line flags to be grouped.Kevin Enderby2015-11-021-0/+5
| | | | | | | | | | Which is needed if we want to replace darwin’s nm(1) with llvm-nm as there are many uses of grouped flags. The added test case is one specific case that is in real use. rdar://23337419 llvm-svn: 251864
* Implemented the code to make llvm-nm’s -g option work.Kevin Enderby2015-10-302-0/+4
While llvm-nm parses the -g option and has help that describes it as: -extern-only - Show only external symbols There is no code in the program to use the boolean valve it sets from the command line. rdar://23261095 llvm-svn: 251718
OpenPOWER on IntegriCloud