summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-readobj/COFFDumper.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [llvm-readobj] Delete and inline relocAddressLessFangrui Song2019-05-021-1/+3
| | | | | | | It is used only once in COFFDumper.cpp. Deleting it from the public interface seems better. llvm-svn: 359775
* [Object] Change getSectionName() to return Expected<StringRef>Fangrui Song2019-05-021-22/+14
| | | | | | | | | | 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
* Minor formatting tweak, no behavior changeNico Weber2019-04-261-4/+7
| | | | llvm-svn: 359295
* llvm-cvtres: Make new dupe resource error a bit friendlierNico Weber2019-04-241-26/+3
| | | | | | | | | | | | For well-known type IDs, include the name of the type. To not duplicate the ID->name map, make llvm-readobj call this new function as well. It has slightly different output, so this also requires updating a few tests. Differential Revision: https://reviews.llvm.org/D61086 llvm-svn: 359153
* Use llvm::stable_sort. NFCFangrui Song2019-04-221-1/+1
| | | | llvm-svn: 358897
* [llvm-readobj] Minor style tweak for consistency sake [NFC]Philip Reames2019-04-131-2/+2
| | | | llvm-svn: 358323
* [StackMaps] Remove format version from the class name [NFC]Philip Reames2019-04-131-2/+2
| | | | | | Motivation is to reduce silly diffs when we change the format. For instance, this causes most of D59020 to disappear. llvm-svn: 358322
* Change some StringRef::data() reinterpret_cast to bytes_begin() or ↵Fangrui Song2019-04-071-8/+6
| | | | | | arrayRefFromStringRef() llvm-svn: 357852
* Fix some include order and file headers issues. NFCFangrui Song2019-02-211-1/+1
| | | | llvm-svn: 354550
* [CodeView] Fix cycles in debug info when merging Types with global hashes Alexandre Ganea2019-02-071-18/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | When type streams with forward references were merged using GHashes, cycles were introduced in the debug info. This was caused by GlobalTypeTableBuilder::insertRecordAs() not inserting the record on the second pass, thus yielding an empty ArrayRef at that record slot. Later on, upon PDB emission, TpiStreamBuilder::commit() would skip that empty record, thus offseting all indices that came after in the stream. This solution comes in two steps: 1. Fix the hash calculation, by doing a multiple-step resolution, iff there are forward references in the input stream. 2. Fix merge by resolving with multiple passes, therefore moving records with forward references at the end of the stream. This patch also adds support for llvm-readoj --codeview-ghash. Finally, fix dumpCodeViewMergedTypes() which previously could reference deleted memory. Fixes PR40221 Differential Revision: https://reviews.llvm.org/D57790 llvm-svn: 353412
* [llvm-readelf] Don't suppress static symbol table with --dyn-symbols + --symbolsJames Henderson2019-01-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | In r287786, a bug was introduced into llvm-readelf where it didn't print the static symbol table if both --symbols and --dyn-symbols were specified, even if there was no dynamic symbol table. This is obviously incorrect. This patch fixes this issue, by delegating the decision of which symbol tables should be printed to the final dumper, rather than trying to decide in the command-line option handling layer. The decision was made to follow the approach taken in this patch because the LLVM style dumper uses a different order to the original GNU style behaviour (and GNU readelf) for ELF output. Other approaches resulted in behaviour changes for other dumpers which felt wrong. In particular, I wanted to avoid changing the order of the output for --symbols --dyn-symbols for LLVM style, keep what is emitted by --symbols unchanged for all dumpers, and avoid having different orders of .dynsym and .symtab dumping for GNU "--symbols" and "--symbols --dyn-symbols". Reviewed by: grimar, rupprecht Differential Revision: https://reviews.llvm.org/D57016 llvm-svn: 351960
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | 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
* [CodeView] More appropriate name and type for a Microsoft precompiled ↵Alexandre Ganea2019-01-071-2/+2
| | | | | | headers parameter. NFC llvm-svn: 350520
* [llvm-readobj] [COFF] Print the symbol index for relocationsMartin Storsjo2019-01-031-0/+4
| | | | | | | | | | There can be multiple local symbols with the same name (for e.g. comdat sections), and thus the symbol name itself isn't enough to disambiguate symbols. Differential Revision: https://reviews.llvm.org/D56140 llvm-svn: 350288
* [llvm-readelf] Make llvm-readelf more compatible with GNU readelf.Jordan Rupprecht2018-11-121-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This change adds a bunch of options that GNU readelf supports. There is one breaking change when invoked as `llvm-readobj`, and three breaking changes when invoked as `llvm-readelf`: - Add --all (implies --file-header, --program-headers, etc.) - [Breaking] -a is --all instead of --arm-attributes - Add --file-header as an alias for --file-headers - Replace --sections with --sections-headers, keeping --sections as an alias for it - Add --relocs as an alias for --relocations - Add --dynamic as an alias for --dynamic-table - Add --segments as an alias for --program-headers - Add --section-groups as an alias for --elf-section-groups - Add --dyn-syms as an alias for --dyn-symbols - Add --syms as an alias for --symbols - Add --histogram as an alias for --elf-hash-histogram - [Breaking] When invoked as `llvm-readelf`, -s is --symbols instead of --sections - [Breaking] When invoked as `llvm-readelf`, -t is no longer an alias for --symbols Reviewers: MaskRay, phosek, mcgrathr, jhenderson Reviewed By: MaskRay, jhenderson Subscribers: sbc100, aheejin, edd, jhenderson, silvas, echristo, compnerd, kristina, javed.absar, kristof.beyls, llvm-commits, Bigcheese Differential Revision: https://reviews.llvm.org/D54124 llvm-svn: 346685
* [COFF][LLD] Add link support for Microsoft precompiled headers OBJsAlexandre Ganea2018-11-051-1/+3
| | | | | | | | | | | This change allows for link-time merging of debugging information from Microsoft precompiled types OBJs compiled with cl.exe /Z7 /Yc and /Yu. This fixes llvm.org/PR34278 Differential Revision: https://reviews.llvm.org/D45213 llvm-svn: 346154
* [ARM64][Windows] Add unwind support to llvm-readobjSanjin Sijaric2018-10-241-1/+3
| | | | | | | | | This patch adds support for dumping the unwind info from ARM64 COFF object files. Differential Revision: https://reviews.llvm.org/D53264 llvm-svn: 345108
* llvm::sort(C.begin(), C.end(), ...) -> llvm::sort(C, ...)Fangrui Song2018-09-271-2/+1
| | | | | | | | | | | | Summary: The convenience wrapper in STLExtras is available since rL342102. Reviewers: dblaikie, javed.absar, JDevlieghere, andreadb Subscribers: MatzeB, sanjoy, arsenm, dschuff, mehdi_amini, sdardis, nemanjai, jvesely, nhaehnle, sbc100, jgravelle-google, eraman, aheejin, kbarton, JDevlieghere, javed.absar, gbedwell, jrtc27, mgrang, atanasyan, steven_wu, george.burgess.iv, dexonsmith, kristina, jsji, llvm-commits Differential Revision: https://reviews.llvm.org/D52573 llvm-svn: 343163
* [codeview] Decode and dump FP regs from S_FRAMEPROC recordsReid Kleckner2018-09-111-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: There are two registers encoded in the S_FRAMEPROC flags: one for locals and one for parameters. The encoding is described by the ExpandEncodedBasePointerReg function in cvinfo.h. Two bits are used to indicate one of four possible values: 0: no register - Used when there are no variables. 1: SP / standard - Variables are stored relative to the standard SP for the ISA. 2: FP - Variables are addressed relative to the ISA frame pointer, i.e. EBP on x86. If realignment is required, parameters use this. If a dynamic alloca is used, locals will be EBP relative. 3: Alternative - Variables are stored relative to some alternative third callee-saved register. This is required to address highly aligned locals when there are dynamic stack adjustments. In this case, both the incoming SP saved in the standard FP and the current SP are at some dynamic offset from the locals. LLVM uses ESI in this case, MSVC uses EBX. Most of the changes in this patch are to pass around the CPU so that we can decode these into real, named architectural registers. Subscribers: hiraditya Differential Revision: https://reviews.llvm.org/D51894 llvm-svn: 341999
* [codeview] Improve readobj FPO dumper and pdbutil register namesReid Kleckner2018-09-071-1/+19
| | | | | | The improved dumping helps me investigate PR38857. llvm-svn: 341695
* Handle zero-length debug directory entries.Nico Weber2018-09-051-1/+1
| | | | | | Part of https://reviews.llvm.org/D51652 (tests will be in the lld repo) llvm-svn: 341485
* MC: Teach the COFF object writer to write address-significance tables.Peter Collingbourne2018-08-221-0/+45
| | | | | | | | | The format is the same as in ELF: a sequence of ULEB128-encoded symbol indexes. Differential Revision: https://reviews.llvm.org/D51047 llvm-svn: 340499
* [llvm-readobj] Generic hex-dump optionPaul Semel2018-07-251-23/+0
| | | | | | | | | | Helpers are available to make this option file format independant. This patch adds the feature for Wasm file format. It doesn't change the behavior of the other file format handling. Differential Revision: https://reviews.llvm.org/D49545 llvm-svn: 337896
* [llvm-readobj] Add -hex-dump (-x) optionPaul Semel2018-07-111-0/+23
| | | | | | Differential Revision: https://reviews.llvm.org/D48281 llvm-svn: 336782
* 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
* [llvm-pdbutil] Display types from MSVC precompiled header object files.Zachary Turner2018-04-051-1/+3
| | | | | | | | These appear in a .debug$P section, which is exactly the same in format as a .debug$T section. So we shouldn't ignore these when dumping types. llvm-svn: 329326
* [tools] Change std::sort to llvm::sort in response to r327219Mandeep Singh Grang2018-04-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | 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
* [NFC] fix trivial typos in commentsHiroshi Inoue2018-02-221-1/+1
| | | | | | "a a" -> "a" llvm-svn: 325752
* [LLD] Implement /guard:[no]longjmpReid Kleckner2018-02-131-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This protects calls to longjmp from transferring control to arbitrary program points. Instead, longjmp calls are limited to the set of registered setjmp return addresses. This also implements /guard:nolongjmp to allow users to link in object files that call setjmp that weren't compiled with /guard:cf. In this case, the linker will approximate the set of address taken functions, but it will leave longjmp unprotected. I used the following program to test, compiling it with different -guard flags: $ cl -c t.c -guard:cf $ lld-link t.obj -guard:cf #include <setjmp.h> #include <stdio.h> jmp_buf buf; void g() { printf("before longjmp\n"); fflush(stdout); longjmp(buf, 1); } void f() { if (setjmp(buf)) { printf("setjmp returned non-zero\n"); return; } g(); } int main() { f(); printf("hello world\n"); } In particular, the program aborts when the code is compiled *without* -guard:cf and linked with -guard:cf. That indicates that longjmps are protected. Reviewers: ruiu, inglorion, amccarth Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D43217 llvm-svn: 325047
* [llvm-readobj] Fix double 0x prefix in RVA table printing after r321527Reid Kleckner2018-01-231-1/+1
| | | | llvm-svn: 323280
* [llvm-readobj] Consistent use of ScopedPrinterSam Clegg2018-01-101-3/+2
| | | | | | | | | There were a few places where outs() was being used directly rather than the ScopedPrinter object. Differential Revision: https://reviews.llvm.org/D41370 llvm-svn: 322141
* Fix tests after move to utohexstr.Benjamin Kramer2017-12-281-1/+1
| | | | llvm-svn: 321527
* Avoid int to string conversion in Twine or raw_ostream contexts.Benjamin Kramer2017-12-281-1/+1
| | | | | | Some output changes from uppercase hex to lowercase hex, no other functionality change intended. llvm-svn: 321526
* [llvm-readobj] Support -needed-libs option for COFF filesPetr Hosek2017-12-271-0/+22
| | | | | | | | This implements the -needed-libs option in the COFF dumper. Differential Revision: https://reviews.llvm.org/D41529 llvm-svn: 321498
* Remove redundant includes from tools.Michael Zolotukhin2017-12-131-8/+0
| | | | llvm-svn: 320631
* Teach llvm-pdbutil to dump types from object files.Zachary Turner2017-12-051-0/+1
| | | | llvm-svn: 319859
* Split TypeTableBuilder into two classes.Zachary Turner2017-11-301-8/+9
| | | | llvm-svn: 319456
* Make TypeTableBuilder inherit from TypeCollection.Zachary Turner2017-11-291-2/+2
| | | | | | | | | | | | | | A couple of places in LLD were passing references to TypeTableCollections around, which makes it hard to change the implementation at runtime. However, these cases only needed to iterate over the types in the collection, and TypeCollection already provides a handy abstract interface for this purpose. By implementing this interface, we can get rid of the need to pass TypeTableBuilder references around, which should allow us to swap the implementation at runtime in subsequent patches. llvm-svn: 319345
* Convert a few ErrorOr to Expected.Rafael Espindola2017-10-111-4/+4
| | | | llvm-svn: 315477
* Follow up for r307085: a better fix for a dangling StringRef.Alexander Kornienko2017-07-261-6/+2
| | | | llvm-svn: 309092
* [codeview] Remove TypeServerHandler and PDBTypeServerHandlerReid Kleckner2017-07-171-2/+1
| | | | | | | | | | | | | | | | | Summary: Instead of wiring these through the CVTypeVisitor interface, clients should inspect the CVTypeArray before visiting it and potentially load up the type server's TPI stream if they need it. No tests relied on this functionality because LLD was the only client. Reviewers: ruiu Subscribers: mgorny, hiraditya, zturner, llvm-commits Differential Revision: https://reviews.llvm.org/D35394 llvm-svn: 308212
* Fix dangling StringRefs found by clang-tidy misc-dangling-handle check.Alexander Kornienko2017-07-041-1/+5
| | | | llvm-svn: 307085
* [llvm-readobj] Improve printouts for COFF ARM64 binariesMartin Storsjo2017-06-301-0/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D34835 llvm-svn: 306795
* [llvm-readobj] Include the PE magic value in printoutsMartin Storsjo2017-06-301-0/+1
| | | | | | | | This is useful for a testcase in lld. Differential Revision: https://reviews.llvm.org/D34836 llvm-svn: 306794
* [llvm-readobj] Fix COFF RVA table dumping bugReid Kleckner2017-06-231-1/+5
| | | | | | | | We would return an error in getVaPtr if the RVA table being dumped was the last data in the .rdata section. Avoid the issue by subtracting one from the offset and adding it back to get an open interval again. llvm-svn: 306171
* [llvm-readobj] Dump the COFF image load configReid Kleckner2017-06-221-0/+133
| | | | | | | | This includes the safe SEH tables and the control flow guard function table. LLD will emit the guard table soon, and I need a tool that dumps them for testing. llvm-svn: 305979
* Delete TypeDatabase.Zachary Turner2017-06-181-1/+1
| | | | | | | | Merge the functionality into the random access type collection. This class was only being used in 2 places, so getting rid of it simplifies the code. llvm-svn: 305653
* Remove some dead code / includes.Zachary Turner2017-06-161-1/+0
| | | | | | | I'm trying to get rid of the TypeDatabase class, so the first step is to minimize its footprint. llvm-svn: 305611
* Update the test framework for llvm-cvtres to be more comprehensive.Eric Beckmann2017-06-131-5/+40
| | | | | | | | | | Summary: Added test cases for multiple machine types, file merging, multiple languages, and more resource types. Also fixed new bugs these tests exposed. Subscribers: javed.absar, llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D34047 llvm-svn: 305258
* Revert "Fix alignment bug in COFF emission."Eric Beckmann2017-06-131-40/+5
| | | | | | | | | I accidentally combined this patch with one for adding more tests, they should be separated. This reverts commit 3da218a523be78df32e637d3446ecf97c9ea0465. llvm-svn: 305257
OpenPOWER on IntegriCloud