summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-objdump/COFFDump.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Remove \brief commands from doxygen comments.Adrian Prantl2018-05-011-1/+1
| | | | | | | | | | | | | | | | We've been running doxygen with the autobrief option for a couple of years now. This makes the \brief markers into our comments redundant. Since they are a visual distraction and we don't want to encourage more \brief markers in new code either, this patch removes them all. Patch produced by for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done Differential Revision: https://reviews.llvm.org/D46290 llvm-svn: 331272
* [tools] Change std::sort to llvm::sort in response to r327219Mandeep Singh Grang2018-04-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | Summary: r327219 added wrappers to std::sort which randomly shuffle the container before sorting. This will help in uncovering non-determinism caused due to undefined sorting order of objects having the same key. To make use of that infrastructure we need to invoke llvm::sort instead of std::sort. Note: This patch is one of a series of patches to replace *all* std::sort to llvm::sort. Refer the comments section in D44363 for a list of all the required patches. Reviewers: JDevlieghere, zturner, echristo, dberris, friss Reviewed By: echristo Subscribers: gbedwell, llvm-commits Differential Revision: https://reviews.llvm.org/D45141 llvm-svn: 328943
* Remove redundant includes from tools.Michael Zolotukhin2017-12-131-4/+0
| | | | llvm-svn: 320631
* Convert a few ErrorOr to Expected.Rafael Espindola2017-10-111-2/+2
| | | | llvm-svn: 315477
* [llvm-objdump] Switch to a range loop. NFCI.Davide Italiano2016-09-301-5/+3
| | | | llvm-svn: 282982
* llvm-objdump: add coff import library symbol listing supportSaleem Abdulrasool2016-08-181-0/+24
| | | | | | | | | | This adds behaviour similar to binutils' objdump which can show symbols in an import library. Differences from that stem around the fact that we do not create section symbols nor the all import import descriptor symbol reference. However, this does mean that the tool can serve as a possible replacement for the existing tool. llvm-svn: 279088
* [COFF] Remove a duplicate import_directory_table_entry definitionDavid Majnemer2016-07-311-1/+1
| | | | | | | | We had import_directory_table_entry and coff_import_directory_table_entry, remove one. Also, factor out the logic which determins if a descriptor is a terminator. llvm-svn: 277296
* [Object, COFF] An import data directory might not consist soley of importsDavid Majnemer2016-06-261-10/+16
| | | | | | | | | | | | | The last import is the penultimate entry, the last entry is nulled out. Data beyond the null entry should not be considered to hold import entries. This fixes PR28302. N.B. I am working on a reduced testcase, the one in PR28302 is too large. llvm-svn: 273790
* Thread Expected<...> up from libObject’s getSymbolAddress() for symbols to ↵Kevin Enderby2016-06-241-3/+3
| | | | | | | | | | | | | | | | | | | | | allow a good error message to be produced. This is nearly the last libObject interface that used ErrorOr and the last one that appears in llvm/include/llvm/Object/MachO.h . For Mach-O objects this is just a clean up because it’s version of getSymbolAddress() can’t return an error. I will leave it to the experts on COFF and ELF to actually add meaning full error messages in their tests if they wish. And also leave it to these experts to change the last two ErrorOr interfaces in llvm/include/llvm/Object/ObjectFile.h for createCOFFObjectFile() and createELFObjectFile() if they wish. Since there are no test cases for COFF and ELF error cases with respect to getSymbolAddress() in the test suite this is no functional change (NFC). llvm-svn: 273701
* llvm-objdump: support dumping AUX records for weak externalsSaleem Abdulrasool2016-05-261-0/+7
| | | | | | | | | | | | This is a support COFF feature. Ensure that we can display the weak externals auxiliary symbol. It contains useful information (such as the default binding and how to resolve the symbol). This reapplies the previous patch with a modification which hopefully should fix the endianness issues. The variadic call would promote the ulittle32_t to a uint32_t which would lose the byte-swapping behaviour desired. llvm-svn: 270813
* Revert "llvm-objdump: support dumping AUX records for weak externals"Saleem Abdulrasool2016-05-251-6/+0
| | | | | | Revert it until we can figure out the endianness issue. llvm-svn: 270667
* llvm-objdump: support dumping AUX records for weak externalsSaleem Abdulrasool2016-05-251-0/+6
| | | | | | | | This is a support COFF feature. Ensure that we can display the weak externals auxiliary symbol. It contains useful information (such as the default binding and how to resolve the symbol). llvm-svn: 270648
* Thread Expected<...> up from libObject’s getType() for symbols to allow ↵Kevin Enderby2016-05-021-3/+3
| | | | | | | | | | | | | | | | | | | | | | llvm-objdump to produce a good error message. Produce another specific error message for a malformed Mach-O file when a symbol’s section index is more than the number of sections. The existing test case in test/Object/macho-invalid.test for macho-invalid-section-index-getSectionRawName now reports the error with the message indicating that a symbol at a specific index has a bad section index and that bad section index value. Again converting interfaces to Expected<> from ErrorOr<> does involve touching a number of places. Where the existing code reported the error with a string message or an error code it was converted to do the same. Also there some were bugs in the existing code that did not deal with the old ErrorOr<> return values.  So now with Expected<> since they must be checked and the error handled, I added a TODO and a comment: "// TODO: Actually report errors helpfully" and a call something like consumeError(NameOrErr.takeError()) so the buggy code will not crash since needed to deal with the Error. llvm-svn: 268298
* Thread Expected<...> up from libObject’s getName() for symbols to allow ↵Kevin Enderby2016-04-201-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | llvm-objdump to produce a good error message. Produce another specific error message for a malformed Mach-O file when a symbol’s string index is past the end of the string table. The existing test case in test/Object/macho-invalid.test for macho-invalid-symbol-name-past-eof now reports the error with the message indicating that a symbol at a specific index has a bad sting index and that bad string index value. Again converting interfaces to Expected<> from ErrorOr<> does involve touching a number of places. Where the existing code reported the error with a string message or an error code it was converted to do the same. There is some code for this that could be factored into a routine but I would like to leave that for the code owners post-commit to do as they want for handling an llvm::Error. An example of how this could be done is shown in the diff in lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h which had a Check() routine already for std::error_code so I added one like it for llvm::Error . Also there some were bugs in the existing code that did not deal with the old ErrorOr<> return values.  So now with Expected<> since they must be checked and the error handled, I added a TODO and a comment: “// TODO: Actually report errors helpfully” and a call something like consumeError(NameOrErr.takeError()) so the buggy code will not crash since needed to deal with the Error. Note there fixes needed to lld that goes along with this that I will commit right after this. So expect lld not to built after this commit and before the next one. llvm-svn: 266919
* [llvm-objdump] Add support for dumping the PE TLS directoryDavid Majnemer2016-03-151-0/+51
| | | | | | | | The PE TLS directory contains information about where the TLS data resides in the image, what functions should be executed when threads are created, etc. llvm-svn: 263537
* COFF: Teach llvm-objdump how to dump DLL forwarder symbols.Rui Ueyama2016-01-121-1/+18
| | | | llvm-svn: 257539
* [llvm-objdump] Move COFF function to where it belongs.Davide Italiano2015-12-201-0/+49
| | | | | | | Ideally much more stuff should be moved out of llvm-objdump.cpp, but that will happen later. llvm-svn: 256118
* Use makeArrayRef or None to avoid unnecessarily mentioning the ArrayRef type ↵Craig Topper2015-09-211-2/+2
| | | | | | extra times. NFC llvm-svn: 248140
* Convert getSymbolSection to return an ErrorOr.Rafael Espindola2015-08-071-3/+3
| | | | | | | This function can actually fail since the symbol contains an index to the section and that can be invalid. llvm-svn: 244375
* [llvm-objdump] Call exit(1) on error, i.e. fail early.Davide Italiano2015-08-051-17/+9
| | | | | | | | | | | | | Previously we kept going on partly corrupted input, which might result in garbage being printed, or even worse, random crashes. Rafael mentioned that this is the GNU behavior as well, but after some discussion we both agreed it's probably better to emit a reasonable error message and exit. As a side-effect of this commit, now we don't rely on global state for error codes anymore. objdump was the last tool in the toolchain which needed to be converted. Hopefully the old behavior won't sneak into the tree again. llvm-svn: 244019
* 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-1/+3
| | | | | | | | | | | | 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
* Don't return error_code from function that never fails.Rafael Espindola2015-06-291-3/+1
| | | | llvm-svn: 241021
* Remove object_error::success and use std::error_code() insteadRui Ueyama2015-06-091-4/+4
| | | | | | | | | | | | make_error_code(object_error) is slow because object::object_category() uses a ManagedStatic variable. But the real problem is that the function is called too frequently. This patch uses std::error_code() instead of object_error::success. In most cases, we return "success", so this patch reduces number of function calls to that function. http://reviews.llvm.org/D10333 llvm-svn: 239409
* Rename data -> DataRui Ueyama2014-10-021-1/+1
| | | | llvm-svn: 218916
* Object: Add support for bigobjDavid Majnemer2014-09-101-9/+2
| | | | | | | | | | | | | | | | | | | | | | 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
* Remove 'using std::error_code' from tools.Rafael Espindola2014-06-131-22/+20
| | | | llvm-svn: 210876
* Remove all uses of 'using std::error_code' from headers.Rafael Espindola2014-06-131-0/+1
| | | | llvm-svn: 210866
* 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
* [C++11] Change the interface of getCOFF{Section,Relocation,Symbol} to make ↵Alexey Samsonov2014-03-181-6/+5
| | | | | | | | | | | | | | 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
* [C++11] Introduce SectionRef::relocations() to use range-based loopsAlexey Samsonov2014-03-141-4/+2
| | | | | | | | | | | | Reviewers: rafael Reviewed By: rafael CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D3077 llvm-svn: 203927
* Attempt to unbreak little-endian buildbots.Rui Ueyama2014-03-051-3/+6
| | | | llvm-svn: 203023
* llvm-objdump: Indent unwind info contents.Rui Ueyama2014-03-041-11/+11
| | | | | | | | | | | Unwind info contents were indented at the same level as function table contents. That's a bit confusing because the unwind info is pointed by function table. In other places we usually increment indentation depth by one when dereferncing a pointer. This patch also removes extraneous newlines between function tables. llvm-svn: 202879
* llvm-objdump: Fix typo in output.Rui Ueyama2014-03-041-1/+1
| | | | llvm-svn: 202875
* Fix typo.Rui Ueyama2014-03-041-3/+3
| | | | llvm-svn: 202787
* Use auto for readability.Rui Ueyama2014-03-041-5/+3
| | | | llvm-svn: 202786
* llvm-objdump: Print x64 unwind info in executable.Rui Ueyama2014-03-041-4/+33
| | | | | | | | | | | | | | | | | | The original code does not work correctly on executable files because the code is written in such a way that only object files are assumed to be given to llvm-objdump. Contents of RuntimeFunction are different between executables and objects. In executables, fields in RuntimeFunction have actual addresses to unwind info structures. On the other hand, in object files, the fields have zero value, but instead there are relocations pointing to the fields, so that Linker will fill them at link-time. So, when we are reading an object file, we need to use relocation info to find the location of unwind info. When executable, we should just look at the values in RuntimeFunction. llvm-svn: 202785
* llvm-objdump: Split printRuntimeFunction to two small functions.Rui Ueyama2014-03-041-39/+41
| | | | | | No functionality change. llvm-svn: 202781
* llvm-objdump: Split printCOFFUnwindInfo into small functions.Rui Ueyama2014-03-041-105/+123
| | | | llvm-svn: 202772
* llvm-objdump: Use range-based-for loop and fix format.Rui Ueyama2014-03-041-14/+18
| | | | | | This is a small cleanup before making a bit larger change to this function. llvm-svn: 202770
* llvm-objdump: Fix crash bug with printing unwind info on stripped file.Rui Ueyama2014-02-281-7/+9
| | | | | | | | | | | The current COFF unwind printer tries to print SEH handler function names, assuming that it can always find function names in string table. It crashes if file being read has no symbol table (i.e. executable). With this patch, llvm-objdump prints SEH handler's RVA if there's no symbol table entry for that RVA. llvm-svn: 202466
* Style fix.Rui Ueyama2014-02-281-1/+2
| | | | llvm-svn: 202465
* Remove unnecessary temporary variable.Rui Ueyama2014-02-281-4/+2
| | | | llvm-svn: 202445
* llvm-objdump/COFF: LoadConfiguration does not exist in object file.Rui Ueyama2014-02-211-0/+7
| | | | llvm-svn: 201883
* llvm-objdump/COFF: Print SEH table addresses.Rui Ueyama2014-02-201-0/+22
| | | | | | | SEH table addresses are VA in COFF file. In this patch we convert VA to RVA before printing it, because dumpbin prints them as RVAs. llvm-svn: 201760
* llvm-objdump/COFF: Print load configuration table.Rui Ueyama2014-02-191-0/+41
| | | | | | | | | | | | Load Configuration Table may contain a pointer to SEH table. This patch is to print the offset to the table. Printing SEH table contents is a TODO. The layout of Layout Configuration Table is described in Microsoft PE/COFF Object File Format Spec, but the table's offset/size descriptions seems to be totally wrong, at least in revision 8.3 of the spec. I believe the table in this patch is the correct one. llvm-svn: 201638
* Change the begin and end methods in ObjectFile to match the style guide.Rafael Espindola2014-02-101-4/+4
| | | | llvm-svn: 201108
* Simplify the handling of iterators in ObjectFile.Rafael Espindola2014-01-301-18/+5
| | | | | | | | | | | | None of the object file formats reported error on iterator increment. In retrospect, that is not too surprising: no object format stores symbols or sections in a linked list or other structure that requires chasing pointers. As a consequence, all error checking can be done on begin() and end(). This reduces the text segment of bin/llvm-readobj in my machine from 521233 to 518526 bytes. llvm-svn: 200442
* Fix known typosAlp Toker2014-01-241-1/+1
| | | | | | | Sweep the codebase for common typos. Includes some changes to visible function names that were misspelt. llvm-svn: 200018
* llvm-objdump/COFF: Print ordinal base number.Rui Ueyama2014-01-171-0/+4
| | | | llvm-svn: 199518
OpenPOWER on IntegriCloud