summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-nm
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Change the output of llvm-nm and llvm-size for Mach-O universal files (akaKevin Enderby2014-06-191-4/+18
| | | | | | | | | | fat files) to print “ (for architecture XYZ)” for fat files with more than one architecture to be like what the darwin tools do for fat files. Also clean up the Mach-O printing of archive membernames in llvm-nm to use the darwin form of "libx.a(foo.o)". llvm-svn: 211316
* Convert the Archive API to use ErrorOr.Rafael Espindola2014-06-161-14/+13
| | | | | | | | | Now that we have c++11, even things like ErrorOr<std::unique_ptr<...>> are easy to use. No intended functionality change. llvm-svn: 211033
* Remove 'using std::error_code' from tools.Rafael Espindola2014-06-131-2/+1
| | | | llvm-svn: 210876
* Don't use 'using std::error_code' in include/llvm.Rafael Espindola2014-06-121-0/+1
| | | | | | This should make sure that most new uses use the std prefix. llvm-svn: 210835
* Remove system_error.h.Rafael Espindola2014-06-121-1/+1
| | | | | | | This is a minimal change to remove the header. I will remove the occurrences of "using std::error_code" in a followup patch. llvm-svn: 210803
* Add "-format darwin" to llvm-nm to be like darwin's nm(1) -m output.Kevin Enderby2014-06-051-4/+176
| | | | | | | | | | | | | | | This is a first step in seeing if it is possible to make llvm-nm produce the same output as darwin's nm(1). Darwin's default format is bsd but its -m output prints the longer Mach-O specific details. For now I added the "-format darwin" to do this (whos name may need to change in the future). As there are other Mach-O specific flags to nm(1) which I'm hoping to add some how in the future. But I wanted to see if I could get the correct output for -m flag using llvm-nm and the libObject interfaces. I got this working but would love to hear what others think about this approach to getting object/format specific details printed with llvm-nm. llvm-svn: 210285
* Allow alias to point to an arbitrary ConstantExpr.Rafael Espindola2014-06-031-6/+2
| | | | | | | | | | | | | | | | | | | | | This patch changes GlobalAlias to point to an arbitrary ConstantExpr and it is up to MC (or the system assembler) to decide if that expression is valid or not. This reduces our ability to diagnose invalid uses and how early we can spot them, but it also lets us do things like @test5 = alias inttoptr(i32 sub (i32 ptrtoint (i32* @test2 to i32), i32 ptrtoint (i32* @bar to i32)) to i32*) An important implication of this patch is that the notion of aliased global doesn't exist any more. The alias has to encode the information needed to access it in its metadata (linkage, visibility, type, etc). Another consequence to notice is that getSection has to return a "const char *". It could return a NullTerminatedStringRef if there was such a thing, but when that was proposed the decision was to just uses "const char*" for that. llvm-svn: 210062
* MachO: support N_INDR aliases in assembly files.Tim Northover2014-05-301-0/+2
| | | | | | | | | This makes LLVM create N_INDR aliases (to be resolved by the linker) when appropriate. rdar://problem/15125513 llvm-svn: 209894
* Delete getAliasedGlobal.Rafael Espindola2014-05-161-1/+1
| | | | llvm-svn: 209040
* Teach llvm-nm to know about fat archives (aka MachOUniversal filesKevin Enderby2014-05-141-0/+14
| | | | | | containing archives). First step as other tools will be updated next. llvm-svn: 208812
* Suggested improvement by Rafael Espindola to use isa<> in a few placesKevin Enderby2014-05-121-6/+6
| | | | | | instead of dyn_cast<>. llvm-svn: 208628
* Fix llvm-nm to print the full 64-bit address for symbols in 64-bit object files.Kevin Enderby2014-05-091-8/+36
| | | | | | | | | | | | | | The implementation might be better to have a method is64Bit() in the class SymbolicFile instead of having the static routine isSymbolList64Bit() in llvm-nm.cpp . But this is very much in the sprit of isObject() and getNMTypeChar() in llvm-nm.cpp that has a series of if else statements based on the specific class of the SymbolicFile. I can update this if folks would like. Also the tests were updated to be explicit about checking the address for 64-bits or 32-bits from object files. llvm-svn: 208463
* Revert "Fix a nomenclature error in llvm-nm."Rafael Espindola2014-04-031-27/+27
| | | | | | | | | | | | | | | | This reverts commit r205479. It turns out that nm does use addresses, it is just that every reasonable relocatable ELF object has sections with address 0. I have no idea if those exist in reality, but it at least it shows that llvm-nm should use the name address. The added test was includes an unusual .o file with non 0 section addresses. I created it by hacking ELFObjectWriter.cpp. Really sorry for the churn. llvm-svn: 205493
* Fix a nomenclature error in llvm-nm.Rafael Espindola2014-04-021-27/+27
| | | | | | | | | | | What llvm-nm prints depends on the file format. On ELF for example, if the file is relocatable, it prints offsets. If it is not, it prints addresses. Since it doesn't really need to care what it is that it is printing, use the generic term value. Fix or implement getSymbolValue to keep llvm-nm working. llvm-svn: 205479
* Object: Provide a richer means of describing auxiliary symbolsDavid Majnemer2014-03-191-2/+1
| | | | | | | | | | | | | | | | The current state of affairs has auxiliary symbols described as a big bag of bytes. This is less than satisfying, it detracts from the YAML file as being human readable. Instead, allow for symbols to optionally contain their auxiliary data. This allows us to have a much higher level way of describing things like weak symbols, function definitions and section definitions. This depends on D3105. Differential Revision: http://llvm-reviews.chandlerc.com/D3092 llvm-svn: 204214
* Object/COFF: Add function to check if section number is reserved one.Rui Ueyama2014-03-181-3/+2
| | | | | | Differential Revision: http://llvm-reviews.chandlerc.com/D3103 llvm-svn: 204199
* [C++11] Change the interface of getCOFF{Section,Relocation,Symbol} to make ↵Alexey Samsonov2014-03-181-2/+2
| | | | | | | | | | | | | | it work with range-based for loops. Reviewers: ruiu Reviewed By: ruiu CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D3097 llvm-svn: 204120
* Object/COFF: change data type of SymbolNumber from int16 to uint16.Rui Ueyama2014-03-151-1/+3
| | | | | | | | | | | | Microsoft PE/COFF Spec clearly states that the field is of signed interger type. However, in reality, it's unsigned. If cl.exe needs to create a large number of sections for COMDAT sections, it will just create more than 32768 sections. Handling large section number as negative number is not correct. I think this is a spec bug. Differential Revision: http://llvm-reviews.chandlerc.com/D3088 llvm-svn: 203986
* Replace OwningPtr<T> with std::unique_ptr<T>.Ahmed Charles2014-03-061-4/+4
| | | | | | | | | | This compiles with no changes to clang/lld/lldb with MSVC and includes overloads to various functions which are used by those projects and llvm which have OwningPtr's as parameters. This should allow out of tree projects some time to move. There are also no changes to libs/Target, which should help out of tree targets have time to move, if necessary. llvm-svn: 203083
* [C++11] Replace OwningPtr::take() with OwningPtr::release().Ahmed Charles2014-03-051-1/+1
| | | | llvm-svn: 202957
* [cleanup] Re-sort all the includes with utils/sort_includes.py.Chandler Carruth2014-03-041-1/+1
| | | | llvm-svn: 202811
* Move getELFDynamicSymbolIterators to a public header.Alexey Samsonov2014-02-261-25/+4
| | | | llvm-svn: 202264
* Add a SymbolicFile interface between Binary and ObjectFile.Rafael Espindola2014-02-212-112/+74
| | | | | | | | | | | This interface allows IRObjectFile to be implemented without having dummy methods for all section and segment related methods. Both llvm-ar and llvm-nm are changed to use it. Unfortunately the mangler is still not plugged in since it requires some refactoring to make a Module hold a DataLayout. llvm-svn: 201881
OpenPOWER on IntegriCloud