aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-readobj/llvm-readobj.cpp
AgeCommit message (Collapse)AuthorFilesLines
2021-05-12[llvm-readelf] Unhide short options to match the command guidegbreynoo1-10/+11
The readelf command guide shows the short options used as aliases but these are not found in the help text unless --show-hidden is used, other tools show aliases with --help. This change fixes the help output to be consistent with the command guide. Differential Revision: https://reviews.llvm.org/D102173
2021-03-25[NFC] Reordering parameters in getFile and getFileOrSTDINAbhina Sreeskantharajan1-1/+1
In future patches I will be setting the IsText parameter frequently so I will refactor the args to be in the following order. I have removed the FileSize parameter because it is never used. ``` static ErrorOr<std::unique_ptr<MemoryBuffer>> getFile(const Twine &Filename, bool IsText = false, bool RequiresNullTerminator = true, bool IsVolatile = false); static ErrorOr<std::unique_ptr<MemoryBuffer>> getFileOrSTDIN(const Twine &Filename, bool IsText = false, bool RequiresNullTerminator = true); static ErrorOr<std::unique_ptr<MB>> getFileAux(const Twine &Filename, uint64_t MapSize, uint64_t Offset, bool IsText, bool RequiresNullTerminator, bool IsVolatile); static ErrorOr<std::unique_ptr<WritableMemoryBuffer>> getFile(const Twine &Filename, bool IsVolatile = false); ``` Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D99182
2021-03-08[llvm-readelf] Support dumping the BB address map section with --bb-addr-map.Rahman Lavaee1-0/+6
This patch lets llvm-readelf dump the content of the BB address map section in the following format: ``` Function { At: <address> BB entries [ { Offset: <offset> Size: <size> Metadata: <metadata> }, ... ] } ... ``` Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D95511
2021-01-29[llvm-readobj/elf] - Report "bitcode files are not supported" warning for ↵Georgii Rymar1-10/+25
bitcode files. Fixes https://bugs.llvm.org/show_bug.cgi?id=43543 Currently we report "The file was not recognized as a valid object file" for BC files. Also, we terminate dumping. Instead we could report a better warning and try to continue dumping other files. This is what this patch implements. Differential revision: https://reviews.llvm.org/D95605
2020-11-09Recommit: [llvm-readelf/obj] - Allow dumping of ELF header even if some ↵Georgii Rymar1-2/+13
elements are corrupt. This is recommit for D90903 with fixes for BB: 1) Used std::move<> when returning Expected<> (http://lab.llvm.org:8011/#/builders/112/builds/913) 2) Fixed the name of temporarily file in the file-headers.test (http://lab.llvm.org:8011/#/builders/36/builds/1269) (a local old temporarily file was used before) For creating `ELFObjectFile` instances we have the factory method `ELFObjectFile<ELFT>::create(MemoryBufferRef Object)`. The problem of this method is that it scans the section header to locate some sections. When a file is truncated or has broken fields in the ELF header, this approach does not allow us to create the `ELFObjectFile` and dump the ELF header. This is https://bugs.llvm.org/show_bug.cgi?id=40804 This patch suggests a solution - it allows to delay scaning sections in the `ELFObjectFile<ELFT>::create`. It now allows user code to call an object initialization (`initContent()`) later. With that it is possible, for example, for dumpers just to dump the file header and exit. By default initialization is still performed as before, what helps to keep the logic of existent callers untouched. I've experimented with different approaches when worked on this patch. I think this approach is better than doing initialization of sections (i.e. scan of them) on demand, because normally users of `ELFObjectFile` API expect to work with a valid object. In most cases when a section header table can't be read (because of an error), we don't have to continue to work with object. So we probably don't need to implement a more complex API. Differential revision: https://reviews.llvm.org/D90903
2020-11-09Revert "[llvm-readelf/obj] - Allow dumping of ELF header even if some ↵Georgii Rymar1-13/+2
elements are corrupt." This reverts commit ea8a0b8b29eb08d3f0f6ac40942a2d8e98ab57ee. It broke BBots. http://lab.llvm.org:8011/#/builders/14/builds/1439 http://lab.llvm.org:8011/#/builders/112/builds/913
2020-11-09[llvm-readelf/obj] - Allow dumping of ELF header even if some elements are ↵Georgii Rymar1-2/+13
corrupt. For creating `ELFObjectFile` instances we have the factory method `ELFObjectFile<ELFT>::create(MemoryBufferRef Object)`. The problem of this method is that it scans the section header to locate some sections. When a file is truncated or has broken fields in the ELF header, this approach does not allow us to create the `ELFObjectFile` and dump the ELF header. This is https://bugs.llvm.org/show_bug.cgi?id=40804 This patch suggests a solution - it allows to delay scaning sections in the `ELFObjectFile<ELFT>::create`. It now allows user code to call an object initialization (`initContent()`) later. With that it is possible, for example, for dumpers just to dump the file header and exit. By default initialization is still performed as before, what helps to keep the logic of existent callers untouched. I've experimented with different approaches when worked on this patch. I think this approach is better than doing initialization of sections (i.e. scan of them) on demand, because normally users of `ELFObjectFile` API expect to work with a valid object. In most cases when a section header table can't be read (because of an error), we don't have to continue to work with object. So we probably don't need to implement a more complex API. Differential revision: https://reviews.llvm.org/D90903
2020-10-27[llvm-readelf] - Implement --section-details option.Georgii Rymar1-4/+19
--section-details/-t is a GNU readelf option that produce an output that is an alternative to --sections. Differential revision: https://reviews.llvm.org/D89304
2020-10-08[llvm-readobj] Add --coff-tls-directory flag to print TLS Directory & test.Luqman Aden1-0/+6
Akin to dumpbin's /TLS option, this will print out the TLS directory, if present, in the image. Example output: ``` > llvm-readobj --coff-tls-directory test.exe File: test.exe Format: COFF-x86-64 Arch: x86_64 AddressSize: 64bit TLSDirectory { StartAddressOfRawData: 0x140004000 EndAddressOfRawData: 0x140004040 AddressOfIndex: 0x140002000 AddressOfCallBacks: 0x0 SizeOfZeroFill: 0x0 Characteristics [ (0x0) ] } ``` Reviewed By: jhenderson, grimar Differential Revision: https://reviews.llvm.org/D88635
2020-09-23[llvm-readelf/obj] - Cleanup the code. NFCI.Georgii Rymar1-3/+3
This: 1) Replaces pointers with references in many places. 2) Adds few TODOs about fixing possible unhandled errors (in ARMEHABIPrinter.h). 3) Replaces `auto`s with actual types. 4) Removes excessive arguments. 5) Adds `const ELFFile<ELFT> &Obj;` member to `ELFDumper` to simplify the code. Differential revision: https://reviews.llvm.org/D88097
2020-09-01[llvm-readobj] - Remove Error.cpp,.h and drop dependencies in the code.Georgii Rymar1-6/+8
We have Error.cpp/.h which contains some code for working with error codes. In fact we use Error/Expected<> almost everywhere already and we can get rid of these files. Note: a few places in the code used readobj specific error codes, e.g. `return readobj_error::unknown_symbol`. But these codes are never really used, i.e. the code checks the fact of a success/error call only. So I've changes them to `return inconvertibleErrorCode()` for now. It seems that these places probably should be converted to use `Error`/`Expected<>`. Differential revision: https://reviews.llvm.org/D86772
2020-08-31[llvm-readobj/elf] - Don't fail when dumping an archive with a member that ↵Georgii Rymar1-2/+2
can't be recognized. Imagine we have an archive that has 3 objects in the following order: <valid known object>,<unknown object> and <valid known object>. Currently llvm-readelf/obj report an error and stops dumping in the middle. This patch changes the error reported to warning. Differential revision: https://reviews.llvm.org/D86771
2020-08-28[llvm-readobj] - Simplify the code that creates dumpers. NFCI.Georgii Rymar1-37/+43
We have a few helper functions like the following: ``` std::error_code create*Dumper(...) ``` In fact we do not need or want to use `std::error_code` and the code can be simpler if we just return `std::unique_ptr<ObjDumper>`. This patch does this change and refines the signature of `createDumper` as well. Differential revision: https://reviews.llvm.org/D86718
2020-08-13[llvm-readobj/elf][test] - Refine --headers testing and the related code ↵Georgii Rymar1-1/+1
comment. Specifying --headers is equivalent to setting --file-headers, --program-headers and --section-headers at the same time. The existent test case uses a precompiled object and doesn't test the output properly. This patch fixes it. Differential revision: https://reviews.llvm.org/D85832
2020-07-29[llvm-readobj] NFC. Add -help description of --hex-dump andYuanfang Chen1-4/+8
--string-dump
2020-07-20[llvm-readobj] Print error when executed with no input filesElvina Yakubova1-4/+5
This patch changes llvm-readelf (and llvm-readobj for consistency) behavior to print an error when executed with no input files. Reading from stdin can be achieved via a '-' for the input object. Fixes https://bugs.llvm.org/show_bug.cgi?id=46400 Differential Revision: https://reviews.llvm.org/D83704 Reviewed by: jhenderson, MaskRay, sbc, jyknight
2020-06-25[llvm-readobj][COFF] add .llvm.call-graph-profile section dumpZequan Wu1-0/+2
Summary: Dumping contents of `.llvm.call-graph-profile` section of COFF in the same format as ELF. Reviewers: jhenderson, MaskRay, hans Reviewed By: jhenderson Subscribers: grimar, rupprecht, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D81894
2020-06-17[llvm-readobj] set --elf-cg-profile as alias of --cg-profileZequan Wu1-2/+5
Summary: Rename --elf-cg-profile to --cg-profile and keep --elf-cg-profile as an alias of --cg-profile. Reviewers: jhenderson, MaskRay, espindola, hans Reviewed By: jhenderson, MaskRay Subscribers: emaste, rupprecht, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D81855
2020-05-27[llvm-readelf] - Split GNUStyle<ELFT>::printHashHistogram. NFC.Georgii Rymar1-1/+1
As was mentioned in review comments for D80204, `printHashHistogram` has 2 lambdas that are probably too large and deserves splitting into member functions. This patch does it. Differential revision: https://reviews.llvm.org/D80546
2020-05-15[llvm-readobj] - --gnu-hash-table: do not crash when the GNU hash table goes ↵Georgii Rymar1-1/+1
past the EOF. We might have a scenario where a the `GbuHashTable` variable correctly points to a place inside the file (we validate this fact early in `parseDynamicTable`), but nbuckets/maskwords fields are broken in the way the code tries to read the data past the EOF. This patch fixes the issue. Differential revision: https://reviews.llvm.org/D79853
2020-03-04[llvm-readelf] Make --all output order closer to GNU readelfFangrui Song1-10/+10
https://bugs.llvm.org/show_bug.cgi?id=43403 The new order makes it easy to compare the two tools' --all. Reviewed By: grimar, rupprecht Differential Revision: https://reviews.llvm.org/D75592
2020-01-28Make llvm::StringRef to std::string conversions explicit.Benjamin Kramer1-2/+3
This is how it should've been and brings it more in line with std::string_view. There should be no functional change here. This is mostly mechanical from a custom clang-tidy check, with a lot of manual fixups. It uncovers a lot of minor inefficiencies. This doesn't actually modify StringRef yet, I'll do that in a follow-up.
2019-12-11[llvm-readobj][llvm-readelf] - Remove excessive empty lines when reporting ↵Georgii Rymar1-2/+0
errors and warnings. After recent changes it is now seems possible to get rid of printing '\n' before each error and warning. This makes the output cleaner. Differential revision: https://reviews.llvm.org/D71246
2019-12-06[llvm-readobj] - Implement --dependent-libraries flag.Georgii Rymar1-0/+7
There is no way to dump SHT_LLVM_DEPENDENT_LIBRARIES sections currently. This patch implements this. The section is described here: https://llvm.org/docs/Extensions.html#sht-llvm-dependent-libraries-section-dependent-libraries Differential revision: https://reviews.llvm.org/D70665
2019-10-07[llvm-readelf/llvm-objdump] - Improve/refactor the implementation of ↵George Rimar1-1/+3
SHT_LLVM_ADDRSIG section dumping. This patch: * Adds a llvm-readobj/llvm-readelf test file for SHT_LLVM_ADDRSIG sections. (we do not have any) * Enables dumping of SHT_LLVM_ADDRSIG with --all. * Changes the logic to report a warning instead of an error when something goes wrong during dumping (allows to continue dumping SHT_LLVM_ADDRSIG and other sections on error). * Refactors a piece of logic to a new toULEB128Array helper which might be used for GNU-style dumping implementation. Differential revision: https://reviews.llvm.org/D68383 llvm-svn: 373890
2019-10-04[llvm-readobj] Replace arch-specific ObjDumper methods by the single ↵Simon Atanasyan1-21/+2
`printArchSpecificInfo` Initially llvm-readobj supports multiple command line options like `--arm-attributes` and `--mips-plt-got` for display ELF arch-specific information. Now all these options are superseded by the `--arch-specific` one. It makes sense to have a single `printArchSpecificInfo` method in the base `ObjDumper`, and hide all ELF/target specific details in the `ELFDumper::printArchSpecificInfo` override. Differential Revision: https://reviews.llvm.org/D68385 llvm-svn: 373731
2019-10-03[llvm-readobj][mips] Remove non-standard --misp-xxx flagsSimon Atanasyan1-27/+0
llvm-readobj "non-standard" flags `--mips-plt-got`, `--mips-abi-flags`, `--mips-reginfo`, and `--mips-options` are superseded by the `--arch-specific` flag and can be removed now. llvm-svn: 373590
2019-10-03[llvm-readobj][mips] Display MIPS specific info under --arch-specific flagSimon Atanasyan1-1/+8
Old options `--mips-plt-got`, `--mips-abi-flags`, '--mips-reginfo`, and `--mips-options` wiil be deleted in a separate patch. llvm-svn: 373588
2019-10-01[llvm-readobj/llvm-readelf] Delete --arm-attributes (alias for --arch-specific)Fangrui Song1-2/+0
D68110 added --arch-specific (supported by GNU readelf) and made --arm-attributes an alias for it. The tests were later migrated to use --arch-specific. Note, llvm-readelf --arch-specific currently just uses llvm-readobj style output for ARM attributes. The readelf-style output is not implemented. Reviewed By: compnerd, kongyi, rupprecht Differential Revision: https://reviews.llvm.org/D68196 llvm-svn: 373291
2019-09-27[llvm-readobj] Rename --arm-attributes to --arch-specificYi Kong1-5/+9
This is for compatibility with GNU readobj. --arm-attributes option is left as a hidden alias due to large number of tests using it. Differential Revision: https://reviews.llvm.org/D68110 llvm-svn: 373125
2019-09-23[llvm-readobj] - Implement LLVM-style dumping for .stack_sizes sections.George Rimar1-3/+1
D65313 implemented GNU-style dumping (llvm-readelf). This one implements LLVM-style dumping (llvm-readobj). Differential revision: https://reviews.llvm.org/D67834 llvm-svn: 372576
2019-08-22[llvm-readobj] - Remove `reportError(std::error_code EC, StringRef Input)` ↵George Rimar1-8/+5
helper. We do not need it, std::error_code is used mostly for COFF and this patch rewrites the calls to use a different overload. Having reportError(std::error_code EC, ... is excessive by itself, because API that use error codes actually needs refactoring to use Error/Expected<> instead. DIfferential revision: https://reviews.llvm.org/D66521 llvm-svn: 369630
2019-08-20[llvm-readobj] Prepend argv[0] to error/warning messagesFangrui Song1-6/+9
Summary: Currently, we report: error: ... Prepend argv[0] (tool name): llvm-readobj: error: ... This is consistent with most GNU binutils/clang/lld, and gives a bit more context in a long build log. Reviewed By: grimar, jhenderson, rupprecht Differential Revision: https://reviews.llvm.org/D66425 llvm-svn: 369377
2019-08-17Recommit r369190 "[llvm-readobj/llvm-readelf] - Improve/cleanup the error ↵George Rimar1-25/+19
reporting API." Fix: Add a `consumeError` call removed by mistake to 'printStackSize', this should fix the "Expected<T> must be checked before access or destruction." reported by following bot: http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/9743/steps/stage%201%20check/logs/stdio Original commit message: Currently we have the following functions for error reporting: LLVM_ATTRIBUTE_NORETURN void reportError(Twine Msg); void reportError(Error Err, StringRef Input); void reportWarning(Twine Msg); void reportWarning(StringRef Input, Error Err); void warn(llvm::Error Err); void error(std::error_code EC); Problems are: naming is inconsistent, arguments order is inconsistent, some of the functions looks excessive. After applying this patch we have: void reportError(Error Err, StringRef Input); void reportError(std::error_code EC, StringRef Input); void reportWarning(Error Err, StringRef Input); I'd be happy to remove reportError(std::error_code EC, StringRef Input) too, but it is used by COFF heavily. Test cases were updated, they show an improvement introduced. Differential revision: https://reviews.llvm.org/D66286 llvm-svn: 369194
2019-08-17Revert r369190, r369192 ([llvm-readobj/llvm-readelf] - Improve/cleanup the ↵George Rimar1-18/+24
error reporting API.) It caused multiple BB failtures: http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/9743/steps/stage%201%20check/logs/stdio http://lab.llvm.org:8011/builders/clang-cmake-x86_64-sde-avx512-linux/builds/26042/steps/ninja%20check%201/logs/FAIL%3A%20LLVM%3A%3Astack-sizes.test llvm-svn: 369193
2019-08-17[llvm-readobj] - An attemp to fix BB after r369191.George Rimar1-3/+3
Few BB failed with the following error: Command Output (stderr): -- /home/buildbots/ppc64be-clang-lnt-test/clang-ppc64be-lnt/llvm/test/tools/llvm-readobj/stack-sizes.test:263:19: error: BADSECTION-OUT: expected string not found in input # BADSECTION-OUT: 8 ? ^ <stdin>:4:1: note: scanning from here ^ It doesn't reproduce on ubuntu/windows I have. Also, seems many of the bots are happy too. This slightly reorders the code to make fouts().flush() call earlier, like it was before the r369191. llvm-svn: 369192
2019-08-17[llvm-readobj/llvm-readelf] - Improve/cleanup the error reporting API.George Rimar1-25/+19
urrently we have the following functions for error reporting: -- LLVM_ATTRIBUTE_NORETURN void reportError(Twine Msg); void reportError(Error Err, StringRef Input); void reportWarning(Twine Msg); void reportWarning(StringRef Input, Error Err); void warn(llvm::Error Err); void error(std::error_code EC); --- Problems are: naming is inconsistent, arguments order is inconsistent, some of the functions looks excessive. After applying this patch we have: --- LLVM_ATTRIBUTE_NORETURN void reportError(Error Err, StringRef Input); LLVM_ATTRIBUTE_NORETURN void reportError(std::error_code EC, StringRef Input); void reportWarning(Error Err, StringRef Input); --- I'd be happy to remove reportError(std::error_code EC, StringRef Input) too, but it is used by COFF heavily. Test cases were updated, they show an improvement introduced. Differential revision: https://reviews.llvm.org/D66286 llvm-svn: 369190
2019-08-13[llvm-readobj] - Remove 'error(Error EC)' helper.George Rimar1-23/+17
We do not need it. I replaced it with reportError(StringRef Input, Error Err). Differential revision: https://reviews.llvm.org/D66011 llvm-svn: 368677
2019-08-09[llvm-readelf]Print filename for multiple inputs and fix formatting regressionJames Henderson1-4/+4
This patch addresses two closely related bugs: https://bugs.llvm.org/show_bug.cgi?id=42930 and https://bugs.llvm.org/show_bug.cgi?id=42931. GNU readelf prints the file name for every input unless there is only one input and that input is not an archive. This patch adds the printing for multiple inputs. A previous change did it for archives, but introduced a regression with GNU compatibility for single-output formatting, resulting in a spurious initial blank line. This is fixed in this patch too. Reviewed by: grimar, MaskRay Differential Revision: https://reviews.llvm.org/D65953 llvm-svn: 368435
2019-08-08[llvm-readobj/libObject] - Introduce a custom warning handler for ↵George Rimar1-0/+6
`ELFFile<ELFT>` methods. Currently, we have a code duplication in llvm-readobj which was introduced in D63266. The duplication was introduced to allow llvm-readobj to dump the partially broken object. Methods in ELFFile<ELFT> perform a strict validation of the inputs, what is itself good, but not for dumper tools, that might want to dump the information, even if some pieces are broken/unexpected. This patch introduces a warning handler which can be passed to ELFFile<ELFT> methods and can allow skipping the non-critical errors when needed/possible. For demonstration, I removed the duplication from llvm-readobj and implemented a warning using the new custom warning handler. It also deduplicates the strings printed, making the output less verbose. Differential revision: https://reviews.llvm.org/D65515 llvm-svn: 368260
2019-08-05[llvm-readelf] Support dumping of stack sizes sections with readelf ↵Wolfgang Pieb1-0/+11
--stack-sizes Reviewers: jhenderson, grimar, rupprecht Differential Revision: https://reviews.llvm.org/D65313 llvm-svn: 367942
2019-07-16[Object/llvm-readelf/llvm-readobj] - Improve error reporting when e_shstrndx ↵George Rimar1-6/+7
is broken. When e_shstrndx is broken, it is impossible to get a section name. In this patch I improved the error message we show and added tests for Object and for llvm-readelf/llvm-readobj Message was changed in two places: 1) llvm-readelf/llvm-readobj previously used a code from Object/ELF.h, now they have a modified version of it (it has less checks and allows dumping broken things). 2) Code in Object/ELF.h is still used for generic cases. Differential revision: https://reviews.llvm.org/D64714 llvm-svn: 366203
2019-07-15[llvm-readelf] Print "File: lib.a(file.o)" info when dumping archive files.Yuanfang Chen1-5/+12
Match GNU readelf. https://bugs.llvm.org/show_bug.cgi?id=35351 Reviewers: jhenderson, grimar, MaskRay, rupprecht Reviewed by: jhenderson, MaskRay, grimar Differential Revision: https://reviews.llvm.org/D64361 llvm-svn: 366147
2019-07-11[llvm-readobj/llvm-readelf] - Report a warning instead of a error when ↵George Rimar1-0/+1
dumping a broken dynamic section. It does not make sence to stop dumping the object if the broken dynamic section was found. In this patch I changed the behavior from "report an error" to "report a warning". This matches GNU. Differential revision: https://reviews.llvm.org/D64472 llvm-svn: 365762
2019-06-21[binutils] Add response file option to help and docsJames Henderson1-0/+3
Many LLVM-based tools already support response files (i.e. files containing a list of options, specified with '@'). This change simply updates the documentation and help text for some of these tools to include it. I haven't attempted to fix all tools, just a selection that I am interested in. I've taken the opportunity to add some tests for --help behaviour, where they were missing. We could expand these tests, but I don't think that's within scope of this patch. This fixes https://bugs.llvm.org/show_bug.cgi?id=42233 and https://bugs.llvm.org/show_bug.cgi?id=42236. Reviewed by: grimar, MaskRay, jkorous Differential Revision: https://reviews.llvm.org/D63597 llvm-svn: 364036
2019-06-18[llvm-readobj] Allow --hex-dump/--string-dump to dump multiple sectionsFangrui Song1-6/+2
1) `-x foo` currently dumps one `foo`. This change makes it dump all `foo`. 2) `-x foo -x foo` currently dumps `foo` twice. This change makes it dump `foo` once. In addition, if foo has section index 9, `-x foo -x 9` dumps `foo` once. 3) Give a warning instead of an error if `foo` does not exist. The new behaviors match GNU readelf. Also, print a new line as a separator between two section dumps. GNU readelf uses two lines, but one seems good enough. Reviewed By: grimar, jhenderson Differential Revision: https://reviews.llvm.org/D63475 llvm-svn: 363683
2019-06-12[llvm-readobj] Fix output interleaving issue caused by using multiple ↵Jordan Rupprecht1-10/+9
streams at the same time. Summary: Use llvm::fouts() as the default stream for outputing. No new stream should be constructed to output at the same time. https://bugs.llvm.org/show_bug.cgi?id=42140 Reviewers: jhenderson, grimar, MaskRay, phosek, rupprecht Reviewed By: rupprecht Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D63115 Patch by Yuanfang Chen! llvm-svn: 363198
2019-06-10[llvm-readobj/llvm-readelf] - Don't fail to dump the object if .dynsym has ↵George Rimar1-0/+6
broken sh_link field. This is https://bugs.llvm.org/show_bug.cgi?id=42215. GNU readelf allows to dump the objects in that case, but llvm-readobj/llvm-readelf reports an error and stops. The patch fixes that. Differential revision: https://reviews.llvm.org/D63074 llvm-svn: 362938
2019-05-20[llvm-readelf] - Rework how we parse the .dynamic section.George Rimar1-0/+5
This is a result of what I found during my work on https://bugs.llvm.org/show_bug.cgi?id=41679. Previously LLVM readelf took the information about .dynamic section from its PT_DYNAMIC segment only. GNU tools have a bit different logic. They also use the information from the .dynamic section header if it is available. This patch changes the code to improve the compatibility with the GNU Binutils. Differential revision: https://reviews.llvm.org/D61937 llvm-svn: 361165
2019-05-03[Object][XCOFF] Add an XCOFF dumper for llvm-readobj.Sean Fertile1-0/+2
Patch adds support for dumping of file headers with llvm-readobj. XCOFF object files are added to test dumping a well formed file, and dumping both negative timestamps and negative symbol counts, both of which are allowed in the XCOFF definition. Differential Revision: https://reviews.llvm.org/D60878 llvm-svn: 359878