summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-nm
Commit message (Collapse)AuthorAgeFilesLines
...
* When sorting by address, undefined symbols go first.Rafael Espindola2015-07-061-0/+4
| | | | | | This matches gnu nm. llvm-svn: 241488
* Reduce code duplication. NFC.Rafael Espindola2015-07-061-41/+17
| | | | llvm-svn: 241484
* Fix printing of common symbols.Rafael Espindola2015-07-061-4/+9
| | | | | | Printing the symbol size matches the behavior or both gnu nm and freebsd nm. llvm-svn: 241480
* Return ErrorOr from getSymbolAddress.Rafael Espindola2015-07-031-1/+3
| | | | | | | It can fail trying to get the section on ELF and COFF. This makes sure the error is handled. llvm-svn: 241366
* Return ErrorOr from SymbolRef::getName.Rafael Espindola2015-07-021-6/+6
| | | | | | | | | | | | This function can really fail since the string table offset can be out of bounds. Using ErrorOr makes sure the error is checked. Hopefully a lot of the boilerplate code in tools/* can go away once we have a diagnostic manager in Object. llvm-svn: 241297
* Simplify isSymbolList64Bit. NFC.Rafael Espindola2015-06-261-9/+1
| | | | llvm-svn: 240784
* Simplify isObject. NFC.Rafael Espindola2015-06-261-19/+5
| | | | llvm-svn: 240783
* Implement elf_section_iterator and getELFType().Rafael Espindola2015-06-261-21/+10
| | | | | | And with those, simplify getSymbolNMTypeChar. llvm-svn: 240780
* Add an ELFSymbolRef type.Rafael Espindola2015-06-251-2/+2
| | | | | | | This allows user code to say Sym.getSize() instead of having to manually fetch the object. llvm-svn: 240708
* llvm-nm: print 'n' instead of '?'Rafael Espindola2015-06-251-1/+1
| | | | | | This matches gnu nm and has the advantage that there is a upper case N. llvm-svn: 240655
* Use range loop. NFC.Rafael Espindola2015-06-251-20/+18
| | | | llvm-svn: 240645
* Modernize getELFDynamicSymbolIterators.Rafael Espindola2015-06-251-5/+5
| | | | | | | | * Have it return a iterator_range. * Remove the global function. * Rename to getDynamicSymbolIterators. llvm-svn: 240644
* Change how symbol sizes are handled in lib/Object.Rafael Espindola2015-06-241-12/+12
| | | | | | | | | | | | | | COFF and MachO only define symbol sizes for common symbols. Reflect that in the class hierarchy by having a method for common symbols only in the base and a general one in ELF. This avoids the need of using a magic value for the size, which had a few problems * Most callers didn't check for it. * The ones that did could not tell the magic value from a file actually having that value. llvm-svn: 240529
* Simplify another function that doesn't fail.Rafael Espindola2015-06-011-2/+1
| | | | llvm-svn: 238703
* Fix llvm-nm -S option.Rafael Espindola2015-05-221-1/+1
| | | | | | | It is explicitly documented to have no effect on object formats where symbols don't have sizes. llvm-svn: 238019
* Cleanup else-after-return and add an early-return to llvm-nmDavid Blaikie2015-03-231-71/+59
| | | | | | | | | | | | The loop and error handling in checkMachOAndArchFlags didn't make sense to me (a loop that only ever executes once? An error path that uses the element the loop stopped at (which must always be a buffer overrun if I'm reading that right?)... I'm confused) but I've made a guess at what was intended. Based on a patch by Richard Thomson to simplify boolean expressions. llvm-svn: 233025
* [cleanup] Re-sort all the #include lines in LLVM usingChandler Carruth2015-01-141-1/+1
| | | | | | | | | | | utils/sort_includes.py. I clearly haven't done this in a while, so more changed than usual. This even uncovered a missing include from the InstrProf library that I've added. No functionality changed here, just mechanical cleanup of the include order. llvm-svn: 225974
* Return ErrorOr<std::unique_ptr<Archive>> form getAsArchive.Rafael Espindola2014-12-091-6/+8
| | | | | | This is the same return type of Archive::create. llvm-svn: 223827
* Object, COFF: Cleanup symbol type code, improve binutils compatibilityDavid Majnemer2014-10-311-9/+5
| | | | | | | Do a better job classifying symbols. This increases the consistency between the COFF handling code and the ELF side of things. llvm-svn: 220952
* LTO: introduce object file-based on-disk module format.Peter Collingbourne2014-09-181-2/+5
| | | | | | | | | | | | | | | | | | This format is simply a regular object file with the bitcode stored in a section named ".llvmbc", plus any number of other (non-allocated) sections. One immediate use case for this is to accommodate compilation processes which expect the object file to contain metadata in non-allocated sections, such as the ".go_export" section used by some Go compilers [1], although I imagine that in the future we could consider compiling parts of the module (such as large non-inlinable functions) directly into the object file to improve LTO efficiency. [1] http://golang.org/doc/install/gccgo#Imports Differential Revision: http://reviews.llvm.org/D4371 llvm-svn: 218078
* Object: Add support for bigobjDavid Majnemer2014-09-101-4/+4
| | | | | | | | | | | | | | | | | | | | | | This adds support for reading the "bigobj" variant of COFF produced by cl's /bigobj and mingw's -mbig-obj. The most significant difference that bigobj brings is more than 2**16 sections to COFF. bigobj brings a few interesting differences with it: - It doesn't have a Characteristics field in the file header. - It doesn't have a SizeOfOptionalHeader field in the file header (it's only used in executable files). - Auxiliary symbol records have the same width as a symbol table entry. Since symbol table entries are bigger, so are auxiliary symbol records. Write support will come soon. Differential Revision: http://reviews.llvm.org/D5259 llvm-svn: 217496
* Don't own the buffer in object::Binary.Rafael Espindola2014-08-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Owning the buffer is somewhat inflexible. Some Binaries have sub Binaries (like Archive) and we had to create dummy buffers just to handle that. It is also a bad fit for IRObjectFile where the Module wants to own the buffer too. Keeping this ownership would make supporting IR inside native objects particularly painful. This patch focuses in lib/Object. If something elsewhere used to own an Binary, now it also owns a MemoryBuffer. This patch introduces a few new types. * MemoryBufferRef. This is just a pair of StringRefs for the data and name. This is to MemoryBuffer as StringRef is to std::string. * OwningBinary. A combination of Binary and a MemoryBuffer. This is needed for convenience functions that take a filename and return both the buffer and the Binary using that buffer. The C api now uses OwningBinary to avoid any change in semantics. I will start a new thread to see if we want to change it and how. llvm-svn: 216002
* Use a simpler predicate. NFC.Rafael Espindola2014-08-081-2/+1
| | | | llvm-svn: 215218
* Remove some calls to std::move.Rafael Espindola2014-08-011-14/+14
| | | | | | | | | Instead of moving out the data in a ErrorOr<std::unique_ptr<Foo>>, get a reference to it. Thanks to David Blaikie for the suggestion. llvm-svn: 214516
* Replaces a few pointers with references in llvm-nm.cpp.Rafael Espindola2014-07-311-40/+39
| | | | | | This opens the way for a few std::uinque_ptr cleanups. llvm-svn: 214439
* Use std::unique_ptr to make the ownership explicit.Rafael Espindola2014-07-311-2/+2
| | | | llvm-svn: 214377
* Tweak llvm-nm’s -undefined-only (aka -u) printing for Mach-O filesKevin Enderby2014-07-281-1/+1
| | | | | | to just print the symbol name. So it matches darwin’s nm(1) -u option. llvm-svn: 214143
* Add an implementation for llvm-nm’s -print-file-name option (aka -o and -A).Kevin Enderby2014-07-241-49/+102
| | | | | | | | The -print-file-name option in llvm-nm is to precede each symbol with the object file it came from. While code for the parsing of this option and its aliases existed there was no code to implement it. llvm-svn: 213906
* Correct the ownership passing semantics of object::createBinary and make ↵David Blaikie2014-07-211-3/+2
| | | | | | | | | | | | | | | | them explicit in the type system. createBinary documented that it destroyed the parameter in error cases, though by observation it does not. By passing the unique_ptr by value rather than lvalue reference, callers are now explicit about passing ownership and the function implements the documented contract. Remove the explicit documentation, since now the behavior cannot be anything other than what was documented, so it's redundant. Also drops a unique_ptr::release in llvm-nm that was always run on a null unique_ptr anyway. llvm-svn: 213557
* Tweak formating to match what clang-format would be for llvm-nm.cpp .Kevin Enderby2014-07-171-3/+2
| | | | | | No functional change. llvm-svn: 213330
* Add printing of Mach-O stabs in llvm-nm.Kevin Enderby2014-07-171-1/+85
| | | | llvm-svn: 213327
* Add the "-x" flag to llvm-nm for Mach-O files that prints the fields of a ↵Kevin Enderby2014-07-161-6/+41
| | | | | | | | | symbol in hex. (generally use for debugging the tools).  This is same functionality as darwin’s nm(1) "-x" flag. llvm-svn: 213176
* [CMake] Update libdeps.NAKAMURA Takumi2014-07-141-0/+1
| | | | llvm-svn: 212920
* Add the "-s" flag to llvm-nm for Mach-O files that prints symbols only inKevin Enderby2014-07-111-0/+70
| | | | | | | | | | | | | the specified section. This is same functionality as darwin’s nm(1) "-s" flag. There is one FIXME in the code and I’m all ears to anyone that can help me with that. This option takes exactly two strings and should be allowed anywhere on the command line. Such that "llvm-nm -s __TEXT __text foo.o" would work. But that does not as the CommandLine Library does not have a way to make this work as far as I can tell. For now the "-s __TEXT __text" has to be last on the command line. llvm-svn: 212842
* Changed the lvm-nm alias "-s" for -print-armap to "-M".Kevin Enderby2014-07-081-1/+1
| | | | | | | | | | This will allow the "-s" flag to implemented in the future as it is in darwin’s nm(1) to list symbols only in the specified section. Given a LGTM by Shankar Easwaran who originally implemented the support for lvm-nm’s -print-armap and archive map symbols. llvm-svn: 212576
* Update the MemoryBuffer API to use ErrorOr.Rafael Espindola2014-07-061-2/+4
| | | | llvm-svn: 212405
* Add the -just-symbol-name (aka -j) flag to llvm-nm to just print theKevin Enderby2014-07-031-0/+9
| | | | | | | | symbol’s name. On darwin the -j flag is used (often in combinations with other flags) to produce a complete list of symbol names which than can then be reorder and used with ld(1)’s -order_file. llvm-svn: 212294
* fix configure+make buildRafael Espindola2014-07-031-1/+1
| | | | llvm-svn: 212283
* Add support for inline asm symbols to IRObjectFile.Rafael Espindola2014-07-032-4/+12
| | | | | | This also enables it in llvm-nm so that it can be tested. llvm-svn: 212282
* Add the -U flag to llvm-nm as an alias to -defined-onlyKevin Enderby2014-07-031-0/+2
| | | | | | as darwin’s nm(1) uses -U for this functionality. llvm-svn: 212280
* Add the -reverse-sort flag (aka -r) to llvm-nmKevin Enderby2014-07-021-24/+61
| | | | | | which exists in other Unix nm(1)’s. llvm-svn: 212235
* Also run clang-format on llvm-nm.cpp to tidy things up. No functional changes.Kevin Enderby2014-07-011-51/+40
| | | | llvm-svn: 212143
* Add the -arch flag support to llvm-nm to select the slice out of a Mach-OKevin Enderby2014-06-301-0/+147
| | | | | | | | universal file. This also includes support for -arch all, selecting the host architecture by default from a universal file and checking if -arch is used with a standard Mach-O it matches that architecture. llvm-svn: 212054
* Pass a std::unique_ptr& to the create??? methods is lib/Object.Rafael Espindola2014-06-231-1/+1
| | | | | | | | This makes the buffer ownership on error conditions very natural. The buffer is only moved out of the argument if an object is constructed that now owns the buffer. llvm-svn: 211546
* Make ObjectFile and BitcodeReader always own the MemoryBuffer.Rafael Espindola2014-06-231-1/+2
| | | | | | | | | | This allows us to just use a std::unique_ptr to store the pointer to the buffer. The flip side is that they have to support releasing the buffer back to the caller. Overall this looks like a more efficient and less brittle api. llvm-svn: 211542
* Convert a few methods to use ErrorOr.Rafael Espindola2014-06-231-2/+3
| | | | | | | It used to be inconvenient to mix ErrorOr and UniquePtr, but with c++11 they work OK together. llvm-svn: 211532
* Change the default input for llvm-nm to be a.out instead of standard inputKevin Enderby2014-06-231-1/+1
| | | | | | | | | to match llvm-size and other UNIX systems for their nm(1). Tweak test cases that used llvm-nm with standard input to add a "-" to indicate that and add a test case to check the default of a.out for llvm-nm. llvm-svn: 211529
* Fix some double printing of filenames for archives in llvm-nm whenKevin Enderby2014-06-201-10/+13
| | | | | | | | the tool is given multiple files. Also fix the same issue with Mach-O universal files. And fix the newline spacing to separate the output in these cases. llvm-svn: 211405
* Added the -m option as an alias for -format=darwin to llvm-nm and llvm-sizeKevin Enderby2014-06-201-0/+3
| | | | | | which is what the darwin tools use for the Mach-O format output. llvm-svn: 211326
* Fix the output of llvm-nm for Mach-O files to use the characters ‘d’ and ↵Kevin Enderby2014-06-191-0/+4
| | | | | | | | ‘b’ for data and bss symbols instead of the generic ’s’ for a symbol in a section. llvm-svn: 211321
OpenPOWER on IntegriCloud