summaryrefslogtreecommitdiffstats
path: root/llvm/test/tools/llvm-nm
Commit message (Collapse)AuthorAgeFilesLines
* [llvm-nm] Display STT_GNU_IFUNC as 'i'Fangrui Song2019-12-251-0/+27
| | | | | | Reviewed By: grimar Differential Revision: https://reviews.llvm.org/D71803
* [test][tools] Add missing and improve testingJames Henderson2019-12-094-4/+111
| | | | | | | | | | | Mostly this adds testing for certain aliases in more explicit ways. There are also a few tidy-ups, and additions of missing testing, where the feature was either not tested at all, or not tested explicitly and sufficiently. Reviewed by: MaskRay, rupprecht, grimar Differential Revision: https://reviews.llvm.org/D71116
* [WebAssembly] Allow multivalue signatures in object filesThomas Lively2019-10-183-3/+6
| | | | | | | | | | | | | | | | | Summary: Also changes the wasm YAML format to reflect the possibility of having multiple return types and to put the returns after the params for consistency with the binary encoding. Reviewers: aheejin, sbc100 Subscribers: dschuff, jgravelle-google, hiraditya, sunfish, arphaman, rupprecht, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D69156 llvm-svn: 375283
* Recommit r370661 "[llvm-nm] - Add a test case for case when we dump a symbol ↵George Rimar2019-09-021-3/+27
| | | | | | | | | | | | | | | | | | | that belongs to a section with a broken sh_name." Fix: add a 'consumeError()' call to ObjectFile.cpp. This error was never checked. Original commit message: It adds a test case for a problem fixed by D66976 <https://reviews.llvm.org/D66976>. It was introduced by me in D66089 <https://reviews.llvm.org/D66089>. The error reported was never consumed because of a wrong variable name used, so it could fail when LLVM_ENABLE_ABI_BREAKING_CHECKS is used. Differential revision: https://reviews.llvm.org/D67002 llvm-svn: 370669
* Revert r370661 "[llvm-nm] - Add a test case for case when we dump a symbol ↵George Rimar2019-09-021-27/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | that belongs to a section with a broken sh_name" It broke BB: http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/16955/steps/test/logs/stdio Expected<T> must be checked before access or destruction. Unchecked Expected<T> contained error: a section [index 1] has an invalid sh_name (0xffff) offset which goes past the end of the section name string tableStack dump: 0. Program arguments: /srv/llvm-buildbot-srcatch/llvm-build-dir/clang-x86_64-debian-fast/llvm.obj/bin/llvm-nm /srv/llvm-buildbot-srcatch/llvm-build-dir/clang-x86_64-debian-fast/llvm.obj/test/tools/llvm-nm/Output/format-sysv-section.test.tmp2.o --format=sysv #0 0x00000000008af7c4 PrintStackTraceSignalHandler(void*) (/srv/llvm-buildbot-srcatch/llvm-build-dir/clang-x86_64-debian-fast/llvm.obj/bin/llvm-nm+0x8af7c4) #1 0x00000000008ad8be llvm::sys::RunSignalHandlers() (/srv/llvm-buildbot-srcatch/llvm-build-dir/clang-x86_64-debian-fast/llvm.obj/bin/llvm-nm+0x8ad8be) #2 0x00000000008afbd8 SignalHandler(int) (/srv/llvm-buildbot-srcatch/llvm-build-dir/clang-x86_64-debian-fast/llvm.obj/bin/llvm-nm+0x8afbd8) #3 0x00007f0a6b989730 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12730) #4 0x00007f0a6b48d7bb raise (/lib/x86_64-linux-gnu/libc.so.6+0x377bb) #5 0x00007f0a6b478535 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22535) #6 0x000000000042004b llvm::Expected<llvm::StringRef>::fatalUncheckedExpected() const (/srv/llvm-buildbot-srcatch/llvm-build-dir/clang-x86_64-debian-fast/llvm.obj/bin/llvm-nm+0x42004b) #7 0x00000000008367f5 (/sv/llvm-buildbot-srcatch/llvm-build-dir/clang-x86_64-debian-fast/llvm.obj/bin/llvm-nm+0x8367f5) #8 0x0000000000817b80 llvm::object::IRObjectFile::findBitcodeInObject(llvm::object::ObjectFile const&) (/srv/llvm-buildbot-srcatch/llvm-build-dir/clang-x86_64-debian-fast/llvm.obj/bin/llvm-nm+0x817b80) #9 0x0000000000838416 llvm::object::SymbolicFile::createSymbolicFile(llvm::MemoryBufferRef, llvm::file_magic, llvm::LLVMContext*) (/srv/llvm-buildbot-srcatch/llvm-build-dir/clang-x86_64-debian-fast/llvm.obj/bin/llvm-nm+0x838416) #10 0x00000000007f36cb llvm::object::createBinary(llvm::MemoryBufferRef, llvm::LLVMContext*) (/srv/llvm-buildbot-srcatch/llvm-build-dir/clang-x86_64-debian-fast/llvm.obj/bin/llvm-nm+0x7f36cb) #11 0x0000000000413123 dumpSymbolNamesFromFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (/srv/llvm-buildbot-srcatch/llvm-build-dir/clang-x86_64-debian-fast/llvm.obj/bin/llvm-nm+0x413123) #12 0x0000000000412e38 main (/srv/llvm-buildbot-srcatch/llvm-build-dir/clang-x86_64-debian-fast/llvm.obj/bin/llvm-nm+0x412e38) #13 0x00007f0a6b47a09b __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409b) #14 0x00000000004120da _start (/srv/llvm-buildbot-srcatch/llvm-build-dir/clang-x86_64-debian-fast/llvm.obj/bin/llvm-nm+0x4120da) FileCheck error: '-' is empty. FileCheck command line: /srv/llvm-buildbot-srcatch/llvm-build-dir/clang-x86_64-debian-fast/llvm.obj/bin/FileCheck /srv/llvm-buildbot-srcatch/llvm-build-dir/clang-x86_64-debian-fast/llvm.src/test/tools/llvm-nm/format-sysv-section.test --check-prefix=ERR -- llvm-svn: 370662
* [llvm-nm] - Add a test case for case when we dump a symbol that belongs to a ↵George Rimar2019-09-021-3/+27
| | | | | | | | | | | | | | section with a broken sh_name. It adds a test case for a problem fixed by D66976. It was introduced by me in D66089. The error reported was never consumed because of a wrong variable name used, so it could fail when LLVM_ENABLE_ABI_BREAKING_CHECKS is used. Differential revision: https://reviews.llvm.org/D67002 llvm-svn: 370661
* Print reasonable representations of type names in llvm-nm, readelf and readobjSunil Srivastava2019-08-091-17/+32
| | | | | | | | | | | For type values that do not have proper names, print reasonable representation in llvm-nm, llvm-readobj and llvm-readelf, matching GNU tools.s Fixes PR41713. Differential Revision: https://reviews.llvm.org/D65537 llvm-svn: 368451
* Revert [tools] [llvm-nm] Default to reading from stdin not a.outAlex Brachet2019-07-161-33/+0
| | | | | | This reverts r365889 (git commit 60c81354b1d3fced1bd284d334f118d2d792ab4b) llvm-svn: 366219
* [tools] [llvm-nm] Default to reading from stdin not a.outAlex Brachet2019-07-121-0/+33
| | | | | | | | | | | | | | | | 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-23/+23
| | | | | | | | | | 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-1/+21
| | | | | | | | Reviewed By: grimar, jhenderson Differential Revision: https://reviews.llvm.org/D63588 llvm-svn: 363918
* [llvm-nm] Additional lit tests for command line optionsChris Jackson2019-06-1316-18/+363
| | | | | | 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-097-8/+195
| | | | | | | | | | | | | | | | | | | 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-013-3/+3
| | | | llvm-svn: 359688
* [llvm-nm] Add --special-syms no-op flagEugene Leviant2019-04-301-0/+32
| | | | | | Differential revision: https://reviews.llvm.org/D60502 llvm-svn: 359563
* [llvm-nm] -print-size => --print-sizeFangrui Song2019-04-291-1/+1
| | | | llvm-svn: 359417
* [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-262-2/+2
| | | | llvm-svn: 359308
* Make llvm-nm -help great againSerge Guelton2019-04-111-0/+3
| | | | | | | | | 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-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
* [WebAssembly] Remove uses of ThreadModelThomas Lively2019-02-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: In the clang UI, replaces -mthread-model posix with -matomics as the source of truth on threading. In the backend, replaces -thread-model=posix with the atomics target feature, which is now collected on the WebAssemblyTargetMachine along with all other used features. These collected features will also be used to emit the target features section in the future. The default configuration for the backend is thread-model=posix and no atomics, which was previously an invalid configuration. This change makes the default valid because the thread model is ignored. A side effect of this change is that objects are never emitted with passive segments. It will instead be up to the linker to decide whether sections should be active or passive based on whether atomics are used in the final link. Reviewers: aheejin, sbc100, dschuff Subscribers: mehdi_amini, jgravelle-google, hiraditya, sunfish, steven_wu, dexonsmith, rupprecht, jfb, jdoerfert, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D58742 llvm-svn: 355112
* 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
* [WebAssembly] Update MC for bulk memoryThomas Lively2019-02-193-3/+3
| | | | | | | | | | | | | | | | | | Summary: Rename MemoryIndex to InitFlags and implement logic for determining data segment layout in ObjectYAML and MC. Also adds a "passive" flag for the .section assembler directive although this cannot be assembled yet because the assembler does not support data sections. Reviewers: sbc100, aardappel, aheejin, dschuff Subscribers: jgravelle-google, hiraditya, sunfish, rupprecht, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D57938 llvm-svn: 354397
* 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
* Add lit config file to skip tests if WebAssembly target is not available.Douglas Yung2019-01-301-0/+2
| | | | llvm-svn: 352614
* [WebAssembly] Ensure BasicSymbolRef.getRawDataRefImpl().p is non-nullSam Clegg2019-01-292-1/+24
| | | | | | | | | | | | Store a non-zero value to ref.d.a and use ref.d.b to store the symbol index. This means that ref.p is never null, which was confusing llvm-nm. Fixes PR40497 Differential Revision: https://reviews.llvm.org/D57373 llvm-svn: 352551
* [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-252-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [WebAssembly] Fixing 2 more symbol offset related tests.Wouter van Oortmerssen2019-01-171-1/+1
| | | | llvm-svn: 351465
* [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
* [WebAssembly] Store section alignment as a power of 2Sam Clegg2019-01-163-3/+3
| | | | | | | | | | | This change bumps for version number of the wasm object file metadata. See https://github.com/WebAssembly/tool-conventions/pull/92 Differential Revision: https://reviews.llvm.org/D56758 llvm-svn: 351285
* [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] Use WithColor for error reportingJonas Devlieghere2018-11-111-1/+1
| | | | | | Use helpers from Support/WithError.h to print errors. llvm-svn: 346624
* [llvm-nm] Include the text "@FILE" in the output of --helpMartin Storsjo2018-10-112-0/+9
| | | | | | | | | | 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
* [WebAsembly] Update default triple in test files to wasm32-unknown-unkown.Sam Clegg2018-05-101-1/+1
| | | | | | | | | | Summary: The final -wasm component has been the default for some time now. Subscribers: jfb, dschuff, jgravelle-google, eraman, aheejin, JDevlieghere, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D46342 llvm-svn: 332007
* [WebAssembly] Add version to object file metadataSam Clegg2018-04-263-0/+3
| | | | | | | | | | Summary: See https://github.com/WebAssembly/tool-conventions/issues/54 Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D46069 llvm-svn: 330969
* 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
* [WebAssembly] Disallow weak undefined globals in the object formatNicholas Wilson2018-03-091-14/+3
| | | | | | | | This implements https://github.com/WebAssembly/tool-conventions/pull/47 Differential Revision: https://reviews.llvm.org/D44201 llvm-svn: 327146
* [WebAssembly] Remove DataSize from linking metadata sectionSam Clegg2018-02-273-3/+0
| | | | | | | | | | | Neither the linker nor the runtime need this information anymore. We were originally using this to model BSS size but the plan is now to use the segment metadata to allow for BSS segments. Differential Revision: https://reviews.llvm.org/D41366 llvm-svn: 326267
OpenPOWER on IntegriCloud