summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-nm
Commit message (Collapse)AuthorAgeFilesLines
* [llvm-nm] Display STT_GNU_IFUNC as 'i'Fangrui Song2019-12-251-5/+8
| | | | | | Reviewed By: grimar Differential Revision: https://reviews.llvm.org/D71803
* Revert [llvm-nm] Add tapi file supportCyndy Ishida2019-09-111-30/+0
| | | | | | This reverts r371576 (git commit f88f46358dbffa20af3b054a9346e5154789d50f) llvm-svn: 371676
* [llvm-nm] Fix -DBUILD_SHARED_LIBS=ON builds after D66160/r371576Fangrui Song2019-09-111-0/+1
| | | | llvm-svn: 371585
* [llvm-nm] Add tapi file supportCyndy Ishida2019-09-111-0/+30
| | | | | | | | | | | | | | | | | | Summary: This commit is the final one for adding tapi support to the llvm-nm implementation. This commit also has accompanying tests the additions to lib/Object Reviewers: ributzka, steven_wu Reviewed By: ributzka Subscribers: hiraditya, plotfi, dexonsmith, rupprecht, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D66160 llvm-svn: 371576
* [llvm-nm] - Fix a bug and unbreak ASan BB.George Rimar2019-09-071-1/+4
| | | | | | | | | | BB: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/13820/steps/check-llvm%20asan/logs/stdio rL371074 revealed a bug in llvm-nm. This patch fixes it. llvm-svn: 371318
* [llvm-nm] Small fix to Exected<StringRef>Sid Manning2019-08-301-1/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D66976 llvm-svn: 370474
* Fix nm on GCC 5.1 after the C++14 moveJF Bastien2019-08-151-6/+10
| | | | | | | | | | | | | | | | | Summary: As in D66306, fix the invocation of std::sort with std::function by not using std::function, since it's easier to read and is broken in libstdc++ from GCC 5.1 (see https://gcc.gnu.org/PR65942). Reviewers: thakis Subscribers: jkorous, mgrang, dexonsmith, rupprecht, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D66310 llvm-svn: 369045
* Recommit r368812 "[llvm/Object] - Convert SectionRef::getName() to return ↵George Rimar2019-08-141-7/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Expected<>" Changes: no changes. A fix for the clang code will be landed right on top. Original commit message: SectionRef::getName() returns std::error_code now. Returning Expected<> instead has multiple benefits. For example, it forces user to check the error returned. Also Expected<> may keep a valuable string error message, what is more useful than having a error code. (Object\invalid.test was updated to show the new messages printed.) This patch makes a change for all users to switch to Expected<> version. Note: in a few places the error returned was ignored before my changes. In such places I left them ignored. My intention was to convert the interface used, and not to improve and/or the existent users in this patch. (Though I think this is good idea for a follow-ups to revisit such places and either remove consumeError calls or comment each of them to clarify why it is OK to have them). Differential revision: https://reviews.llvm.org/D66089 llvm-svn: 368826
* Revert r368812 "[llvm/Object] - Convert SectionRef::getName() to return ↵George Rimar2019-08-141-23/+7
| | | | | | | | Expected<>" It broke clang BB: http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/16455 llvm-svn: 368813
* [llvm/Object] - Convert SectionRef::getName() to return Expected<>George Rimar2019-08-141-7/+23
| | | | | | | | | | | | | | | | | | | | | | | SectionRef::getName() returns std::error_code now. Returning Expected<> instead has multiple benefits. For example, it forces user to check the error returned. Also Expected<> may keep a valuable string error message, what is more useful than having a error code. (Object\invalid.test was updated to show the new messages printed.) This patch makes a change for all users to switch to Expected<> version. Note: in a few places the error returned was ignored before my changes. In such places I left them ignored. My intention was to convert the interface used, and not to improve and/or the existent users in this patch. (Though I think this is good idea for a follow-ups to revisit such places and either remove consumeError calls or comment each of them to clarify why it is OK to have them). Differential revision: https://reviews.llvm.org/D66089 llvm-svn: 368812
* Revert [tools] [llvm-nm] Default to reading from stdin not a.outAlex Brachet2019-07-161-8/+1
| | | | | | This reverts r365889 (git commit 60c81354b1d3fced1bd284d334f118d2d792ab4b) llvm-svn: 366219
* [tools] [llvm-nm] Default to reading from stdin not a.outAlex Brachet2019-07-121-1/+8
| | | | | | | | | | | | | | | | Summary: This moves away from defaulting to a.out and uses stdin only if stdin has a file redirected to it. This has been discussed on the llvm-dev mailing list [[ https://lists.llvm.org/pipermail/llvm-dev/2019-July/133642.html | here ]]. Reviewers: jhenderson, rupprecht, MaskRay, chrisjackson Reviewed By: jhenderson, MaskRay Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D64290 llvm-svn: 365889
* [llvm-nm] Fix for BZ41711 - Class character for a symbol with undefinedChris Jackson2019-06-271-1/+6
| | | | | | | | | | binding does not match class assigned by GNU nm Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=41711 Differential Revision: https://reviews.llvm.org/D63340 llvm-svn: 364559
* [llvm-nm] Generalize ELF symbol types 'N' and 'n'Fangrui Song2019-06-201-12/+7
| | | | | | | | Reviewed By: grimar, jhenderson Differential Revision: https://reviews.llvm.org/D63588 llvm-svn: 363918
* [llvm-nm] Fix docs and help text for --print-sizeJames Henderson2019-06-121-1/+1
| | | | | | | | | | | | The --print-size help text and documentation claimed that the size was printed instead of the address, but this is incorrect. It is printed as well as the address. This patch fixes this issue. Reviewed by: MaskRay, mtrent, ruiu Differential Revision: https://reviews.llvm.org/D63142 llvm-svn: 363136
* [llvm-nm] Fix Bug 41353 - unique symbols printed as D instead of uJordan Rupprecht2019-05-241-3/+9
| | | | | | | | | | | | | | | | | | | | | 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
* Update llvm-nm -s to use a multi-var optionMichael Trent2019-05-181-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Previously llvm-nm relied on a positional parameter to read two values into the SegSect list. This worked, but required the "-s" paramater and its arguments to be the last elements on the command-line. The CommandLine library now supports mutli-var parameters, so it can naturally deal with "-s" expecting two arguments, and now the input file can appear anywhere (within reason) in the command line invocation. E.g. llvm-nm -s __TEXT __text /bin/ls llvm-nm /bin/ls -s __TEXT __text rdar://27284011 Reviewers: lhames, pete Reviewed By: pete Subscribers: rupprecht, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D62070 llvm-svn: 361091
* [Object] Fix macho-invalid.testFangrui Song2019-05-101-2/+3
| | | | llvm-svn: 360420
* [Object] Change SymbolicFile::printSymbolName to use ErrorFangrui Song2019-05-101-5/+6
| | | | llvm-svn: 360414
* [llvm-nm] Fix handling of symbol types 't' 'd' 'r'Fangrui Song2019-05-091-20/+7
| | | | | | | | | | | | | | | | | | | 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
* Remove duplicate assignments. NFCI.Simon Pilgrim2019-05-061-1/+0
| | | | llvm-svn: 360064
* Revert [llvm-nm] Fix handling of symbol types + [llvm-nm] Generalize symbol ↵Jordan Rupprecht2019-05-021-11/+28
| | | | | | | | types This reverts r359311 and r359312 (git commit 0bf06a8f59b0074a60871865e828d92db8930c59 and 5f184f17800ea2ac27be5e4ab540cb94a46e80c7) llvm-svn: 359830
* [Object] Change getSectionName() to return Expected<StringRef>Fangrui Song2019-05-021-7/+9
| | | | | | | | | | Summary: It currently receives an output parameter and returns std::error_code. Expected<StringRef> fits for this purpose perfectly. Differential Revision: https://reviews.llvm.org/D61421 llvm-svn: 359774
* [llvm-nm] Add --special-syms no-op flagEugene Leviant2019-04-301-0/+3
| | | | | | Differential revision: https://reviews.llvm.org/D60502 llvm-svn: 359563
* [llvm-nm] Simplify and fix a buffer overflowFangrui Song2019-04-291-149/+107
| | | | | | | | | | | | | * char SymbolAddrStr[18] can't hold "%" PRIo64 which may need 22 characters. * Use range-based for * Delete unnecessary typedef * format(...).print(Str, sizeof(Str)) + outs() << Str => outs() << format(...) * Use cascading outs() << .. << .. * Use iterator_range(Container &&c) * (A & B) == B => A & B if B is a power of 2 * replace null sentinel in constants with makeArrayRef llvm-svn: 359416
* [llvm-nm][llvm-readelf] Avoid single-dash -long-option in testsFangrui Song2019-04-271-4/+0
| | | | llvm-svn: 359383
* [llvm-nm] Support section type 'u': STB_GNU_UNIQUEFangrui Song2019-04-271-0/+4
| | | | llvm-svn: 359380
* [llvm-nm] Revert inadvertently committed 'i' change in r359314Fangrui Song2019-04-261-3/+0
| | | | llvm-svn: 359315
* [ThinLTO] Fix X86/strong_non_prevailing.ll after llvm-nm 'r' changeFangrui Song2019-04-261-0/+3
| | | | llvm-svn: 359314
* [llvm-nm] Generalize symbol types 'N', 'n' and '?'Fangrui Song2019-04-261-9/+5
| | | | llvm-svn: 359312
* [llvm-nm] Fix handling of symbol types 't' 'd' 'r'Fangrui Song2019-04-261-19/+6
| | | | | | | | | | | | | | | 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
* Make llvm-nm -help great againSerge Guelton2019-04-111-33/+58
| | | | | | | | | Only display help from the llvm-nm category instead of all llvm options, which make it much more usable. There's still an issue with -s, which is probably a bug in llvm::cl and worth another commit. Differential Revision: https://reviews.llvm.org/D60411 llvm-svn: 358185
* [llvm-nm]Add support for --no-demangleJames Henderson2019-04-031-3/+10
| | | | | | | | | | | | | 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-081-3/+42
| | | | | | | | | | 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-261-44/+4
| | | | | | | 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-261-4/+44
| | | | | | | | 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-6/+8
| | | | | | | | | | | | | | | | | | | | | 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-031-4/+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] Report '.comment' ELF sections as 'n' instead of '?'Matt Davis2019-02-011-0/+1
| | | | | | | | | | | | | | | | | | | Summary: The previous implementation reported `.comment` sections as '?' GNU uses 'n' which means "The symbol is a debugging symbol." `.note` sections are represented as 'n' too. The test related to this change was updated to CHECK-NEXT to ensure order and that we did not miss any symbols in the dump. Reviewers: jhenderson Reviewed By: jhenderson Subscribers: rupprecht, llvm-commits Differential Revision: https://reviews.llvm.org/D57544 llvm-svn: 352891
* [llvm-nm] Print out N_COLD_FUNC as "cold func"Vedant Kumar2019-01-261-1/+1
| | | | | | | Per post-commit feedback from Mike, have llvm-nm print out this symbol attribute as "[cold func]". llvm-svn: 352258
* [MC] Teach the MachO object writer about N_FUNC_COLDVedant Kumar2019-01-251-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | N_FUNC_COLD is a new MachO symbol attribute. It's a hint to the linker to order a symbol towards the end of its section, to improve locality. Example: ``` void a1() {} __attribute__((cold)) void a2() {} void a3() {} int main() { a1(); a2(); a3(); return 0; } ``` A linker that supports N_FUNC_COLD will order _a2 to the end of the text section. From `nm -njU` output, we see: ``` _a1 _a3 _main _a2 ``` Differential Revision: https://reviews.llvm.org/D57190 llvm-svn: 352227
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-192-8/+6
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [llvm-nm] Allow --size-sort to print symbols with only Symbol sizeSaurabh Badhwar2019-01-161-2/+1
| | | | | | | | | | | | | | | | | | | 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/+2
| | | | | | | | | | | | | 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
* [binutils] NFC: fix clang-tidy warning: use empty() instead of size() == 0Jordan Rupprecht2018-12-201-4/+4
| | | | llvm-svn: 349710
* [llvm-nm] Fix use-after-free for MachOUniversalBinariesFrancis Visoiu Mistrih2018-11-191-1/+2
| | | | | | | | | MachOObjectFile::getHostArch() returns a temporary, and getArchName returns a StringRef pointing to a temporary std::string. No tests since it doesn't trigger any errors except with the sanitizers. llvm-svn: 347230
* [llvm-nm] Use WithColor for error reportingJonas Devlieghere2018-11-111-7/+8
| | | | | | Use helpers from Support/WithError.h to print errors. llvm-svn: 346624
* [Support] Make error banner optional in logAllUnhandledErrorsJonas Devlieghere2018-11-111-7/+6
| | | | | | | | In a lot of places an empty string was passed as the ErrorBanner to logAllUnhandledErrors. This patch makes that argument optional to simplify the call sites. llvm-svn: 346604
* [llvm-nm] Simplify. NFCFangrui Song2018-10-261-14/+7
| | | | | | | | Change a \t to spaces Change some zero-filling memcpy to aggregate initialization Delete redundant ArchiveName.clear() after declaration llvm-svn: 345367
* [llvm-nm] Fix crash when running with --print-armap on corrupt archives.Jordan Rupprecht2018-10-111-2/+4
| | | | | | | | error() in llvm-nm intentionally does not return so that the callee can move on to future files/slices. When printing the archive map, this is not currently handled (the caller assumes that error() returns), so processing continues despite there being an error. Also, change one return to a break, so that symbols can be printed even if the archive map is corrupt. llvm-svn: 344268
OpenPOWER on IntegriCloud