summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-readobj
Commit message (Collapse)AuthorAgeFilesLines
...
* [llvm-readobj] - Implement LLVM-style dumping for .stack_sizes sections.George Rimar2019-09-232-6/+9
| | | | | | | | | 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
* [Support] Add a DataExtractor constructor that takes ArrayRef<uint8_t>Fangrui Song2019-09-212-21/+11
| | | | | | | | | | The new constructor can simplify some llvm-readobj call sites. Reviewed By: grimar, dblaikie Differential Revision: https://reviews.llvm.org/D67797 llvm-svn: 372473
* [llvm-readobj] flush output before crashYuanfang Chen2019-09-201-1/+3
| | | | | | Otherwise the output could be lost. llvm-svn: 372372
* [llvm-readobj/llvm-objdump] - Improve how tool locate the dynamic table and ↵George Rimar2019-09-171-34/+96
| | | | | | | | | | | | | | | | | | | | | report warnings about that. Before this patch we gave a priority to a dynamic table found from the section header. It was discussed (here: https://reviews.llvm.org/D67078?id=218356#inline-602082) that probably preferring the table from PT_DYNAMIC is better, because it is what runtime loader sees. This patch makes the table from PT_DYNAMIC be chosen at first place if it is available. But also it adds logic to fall back to SHT_DYNAMIC if the table from the dynamic segment is broken or fall back to use no table if both are broken. It adds a few more diagnostic warnings for the logic above. Differential revision: https://reviews.llvm.org/D67547 llvm-svn: 372122
* [llvm-readobj] - Refactor the code.George Rimar2019-09-171-39/+22
| | | | | | | | It's a straightforward refactoring that allows to simplify and encapsulate the code. Differential revision: https://reviews.llvm.org/D67624 llvm-svn: 372083
* [llvm-readelf] - Print unknown st_other value if present in GNU output.George Rimar2019-09-061-15/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a fix for https://bugs.llvm.org/show_bug.cgi?id=40785. llvm-readelf does not print the st_value of the symbol when st_value has any non-visibility bits set. This patch: * Aligns "Ndx" row for the default and a new cases. (it was 1 space character off for the case when "PROTECTED" visibility was printed) * Prints "[<other>: 0x??]" for symbols which has an additional st_other bits set. In compare with GNU, this logic is a bit simpler and seems to be more consistent. For MIPS GNU can print named flags, though can't print a mix of them: 0: 00000000 0 NOTYPE LOCAL DEFAULT UND 1: 00000000 0 NOTYPE GLOBAL DEFAULT [OPTIONAL] UND a1 2: 00000000 0 NOTYPE GLOBAL DEFAULT [MIPS PLT] UND a2 3: 00000000 0 NOTYPE GLOBAL DEFAULT [MIPS PIC] UND a3 4: 00000000 0 NOTYPE GLOBAL DEFAULT [MICROMIPS] UND a4 5: 00000000 0 NOTYPE GLOBAL DEFAULT [MIPS16] UND a5 6: 00000000 0 NOTYPE GLOBAL DEFAULT [<other>: c] UND b1 7: 00000000 0 NOTYPE GLOBAL DEFAULT [<other>: 28] UND b2 On PPC64 it can print a localentry value that is encoded in the high bits of st_other 63: 0000000000000850 208 FUNC GLOBAL DEFAULT [<localentry>: 8] 12 We chose to print the raw st_other field, prefixed with '0x'. Differential revision: https://reviews.llvm.org/D67094 llvm-svn: 371201
* [llvm-readobj][yaml2obj] Support SHT_LLVM_SYMPART, SHT_LLVM_PART_EHDR and ↵Fangrui Song2019-09-061-0/+6
| | | | | | | | | | | | | | | | | | | | | SHT_LLVM_PART_PHDR See http://lists.llvm.org/pipermail/llvm-dev/2019-February/130583.html and D60242 for the lld partition feature. This patch: * Teaches yaml2obj to parse the 3 section types. * Teaches llvm-readobj/llvm-readelf to dump the 3 section types. There is no test for SHT_LLVM_DEPENDENT_LIBRARIES in llvm-readobj. Add it as well. Reviewed By: thakis Differential Revision: https://reviews.llvm.org/D67228 llvm-svn: 371157
* [llvm-readelf] - Allow dumping dynamic symbols when there is no program headers.George Rimar2019-09-051-3/+22
| | | | | | | | | | | | | | | | | | | | | | | | | D62179 introduced a regression. llvm-readelf lose the ability to dump the dynamic symbols when there is .dynamic section with a DT_SYMTAB, but there are no program headers: https://reviews.llvm.org/D62179#1652778 Below is a program flow before the D62179 change: 1) Find SHT_DYNSYM. 2) Find there is no PT_DYNAMIC => don't try to parse it. 3) Print dynamic symbols using information about them found on step (1). And after the change it became: 1) Find SHT_DYNSYM. 2) Find there is no PT_DYNAMIC => find SHT_DYNAMIC. 3) Parse dynamic table, but fail to handle the DT_SYMTAB because of the absence of the PT_LOAD. Report the "Virtual address is not in any segment" error. This patch fixes the issue. For doing this it checks that the value of DT_SYMTAB was mapped to a segment. If not - it ignores it. Differential revision: https://reviews.llvm.org/D67078 llvm-svn: 371071
* [COFF] Add a ResourceSectionRef method for getting resource contentsMartin Storsjo2019-08-301-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows llvm-readobj to print the contents of each resource when printing resources from an object file or executable, like it already does for plain .res files. This requires providing the whole COFFObjectFile to ResourceSectionRef. This supports both object files and executables. For executables, the DataRVA field is used as is to look up the right section. For object files, ideally we would need to complete linking of them and fix up all relocations to know what the DataRVA field would end up being. In practice, the only thing that makes sense for an RVA field is an ADDR32NB relocation. Thus, find a relocation pointing at this field, verify that it has the expected type, locate the symbol it points at, look up the section the symbol points at, and read from the right offset in that section. This works both for GNU windres object files (which use one single .rsrc section, with all relocations against the base of the .rsrc section, with the original value of the DataRVA field being the offset of the data from the beginning of the .rsrc section) and cvtres object files (with two separate .rsrc$01 and .rsrc$02 sections, and one symbol per data entry, with the original pre-relocated DataRVA field being set to zero). Differential Revision: https://reviews.llvm.org/D66820 llvm-svn: 370433
* [WebAssembly] Make __attribute__((used)) not imply export.Dan Gohman2019-08-291-0/+1
| | | | | | | | | | Add an WASM_SYMBOL_NO_STRIP flag, so that __attribute__((used)) doesn't need to imply exporting. When targeting Emscripten, have WASM_SYMBOL_NO_STRIP imply exporting. Differential Revision: https://reviews.llvm.org/D62542 llvm-svn: 370415
* [llvm-readobj/llvm-readelf] - Report a proper warning when dumping a broken ↵George Rimar2019-08-291-10/+34
| | | | | | | | | | | | | dynamic relocation. When we have a dynamic relocation with a broken symbol's st_name, tools report a useless error: "Invalid data was encountered while parsing the file". After this change we report a warning + "<corrupt>" as a symbol name. Differential revision: https://reviews.llvm.org/D66734 llvm-svn: 370330
* [COFF] Add a ResourceSectionRef method for getting the data entry, print it ↵Martin Storsjo2019-08-291-0/+7
| | | | | | | | in llvm-readobj Differential Revision: https://reviews.llvm.org/D66819 llvm-svn: 370311
* [COFF] Add a bounds checking helper for iterating a coff_resource_dir_tableMartin Storsjo2019-08-291-16/+2
| | | | | | | | | | Instead of blindly incrementing pointers in llvm-readobj, use this helper, which does bounds checking against the available section data. Differential Revision: https://reviews.llvm.org/D66818 llvm-svn: 370310
* [llvm-readobj] Print the resource type textually for .res filesMartin Storsjo2019-08-291-2/+6
| | | | | | | | This already is done when dumping resources from coff objects. Differential Revision: https://reviews.llvm.org/D66816 llvm-svn: 370308
* [llvm-readobj] Remove a leftover string trim operation. NFC.Martin Storsjo2019-08-291-1/+0
| | | | | | | | This became unnecessary in SVN r359153. Differential Revision: https://reviews.llvm.org/D66815 llvm-svn: 370307
* [llvm-readobj][XCOFF][NFC] Add return statement to avoid ↵Jason Liu2019-08-281-0/+1
| | | | | | | | -Wimplicit-fallthrough warning This is to fix the commit in r370097. llvm-svn: 370260
* [XCOFF][AIX] Generate symbol table entries with llvm-readobjJason Liu2019-08-271-3/+264
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch implements main entry and auxiliary entries of symbol table generation for llvm-readobj on AIX. The source code of aix_xcoff_xlc_test8.o (compile with xlc) is: -bash-4.2$ cat test8.c extern int i; extern int TestforXcoff; extern int fun(int i); static int static_i; char* p="abcd"; int fun1(int j) { static_i++; j++; j=j+*p; return j; } int main() { i++; fun(i); return fun1(i); } Patch provided by DiggerLin Differential Revision: https://reviews.llvm.org/D65240 llvm-svn: 370097
* [llvm-readobj] - Remove `reportError(std::error_code EC, StringRef Input)` ↵George Rimar2019-08-224-64/+72
| | | | | | | | | | | | | | | 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
* [llvm-readobj] Prepend argv[0] to error/warning messagesFangrui Song2019-08-201-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
* [Object/COFF.h] - Stop returning std::error_code in a few methods. NFCI.George Rimar2019-08-192-12/+3
| | | | | | | | | | There are 4 methods that return std::error_code now, though they do not have to because they are always succeed. I refactored them. This allows to simplify the code in tools a bit. llvm-svn: 369263
* [llvm-readobj] unwrapOrError: remove unnecessary llvm_unreachable after r369194Fangrui Song2019-08-191-1/+0
| | | | llvm-svn: 369254
* Recommit r369190 "[llvm-readobj/llvm-readelf] - Improve/cleanup the error ↵George Rimar2019-08-177-164/+234
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Revert r369190, r369192 ([llvm-readobj/llvm-readelf] - Improve/cleanup the ↵George Rimar2019-08-177-233/+164
| | | | | | | | | | | 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
* [llvm-readobj] - An attemp to fix BB after r369191.George Rimar2019-08-171-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
* [llvm-readobj/llvm-readelf] - Improve/cleanup the error reporting API.George Rimar2019-08-177-165/+234
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [llvm-readobj] Unwrap the value first to avoid the errorPetr Hosek2019-08-171-21/+22
| | | | | | | | | This addresses the issue introduced in r369169, we need to unwrap the value first before we can check whether it's empty. This also swaps the two branches to put the common path first which should be NFC. llvm-svn: 369177
* [llvm-readobj] Fallback to PT_NOTE if file doesn't have sectionsPetr Hosek2019-08-161-2/+2
| | | | | | | | | This is useful when trying to read notes from stripped files and matches the behavior of GNU readelf and eu-readelf. Differential Revision: https://reviews.llvm.org/D66358 llvm-svn: 369169
* [llvm] Migrate llvm::make_unique to std::make_uniqueJonas Devlieghere2019-08-151-1/+1
| | | | | | | | Now that we've moved to C++14, we no longer need the llvm::make_unique implementation from STLExtras.h. This patch is a mechanical replacement of (hopefully) all the llvm::make_unique instances across the monorepo. llvm-svn: 369013
* [llvm-readobj][MachO] Fix section type printingSeiya Nuta2019-08-151-1/+26
| | | | | | | | | | | | | | | | | | | Summary: Currently, llvm-readobj mistakenly decodes section type as section attribute. This patch fixes the bug and affected tests. Reviewers: JDevlieghere, jhenderson, rupprecht, alexshap, echristo Reviewed By: jhenderson, rupprecht, alexshap, echristo Subscribers: javed.absar, rupprecht, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D66075 llvm-svn: 368974
* Recommit r368812 "[llvm/Object] - Convert SectionRef::getName() to return ↵George Rimar2019-08-146-42/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Expected<>" Changes: no changes. A fix for the clang code will be landed right on top. Original commit message: SectionRef::getName() returns std::error_code now. Returning Expected<> instead has multiple benefits. For example, it forces user to check the error returned. Also Expected<> may keep a valuable string error message, what is more useful than having a error code. (Object\invalid.test was updated to show the new messages printed.) This patch makes a change for all users to switch to Expected<> version. Note: in a few places the error returned was ignored before my changes. In such places I left them ignored. My intention was to convert the interface used, and not to improve and/or the existent users in this patch. (Though I think this is good idea for a follow-ups to revisit such places and either remove consumeError calls or comment each of them to clarify why it is OK to have them). Differential revision: https://reviews.llvm.org/D66089 llvm-svn: 368826
* Revert r368812 "[llvm/Object] - Convert SectionRef::getName() to return ↵George Rimar2019-08-146-61/+42
| | | | | | | | Expected<>" It broke clang BB: http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/16455 llvm-svn: 368813
* [llvm/Object] - Convert SectionRef::getName() to return Expected<>George Rimar2019-08-146-42/+61
| | | | | | | | | | | | | | | | | | | | | | | SectionRef::getName() returns std::error_code now. Returning Expected<> instead has multiple benefits. For example, it forces user to check the error returned. Also Expected<> may keep a valuable string error message, what is more useful than having a error code. (Object\invalid.test was updated to show the new messages printed.) This patch makes a change for all users to switch to Expected<> version. Note: in a few places the error returned was ignored before my changes. In such places I left them ignored. My intention was to convert the interface used, and not to improve and/or the existent users in this patch. (Though I think this is good idea for a follow-ups to revisit such places and either remove consumeError calls or comment each of them to clarify why it is OK to have them). Differential revision: https://reviews.llvm.org/D66089 llvm-svn: 368812
* [NFCI] Explicitly provide user-defined constructor for SectionRefAlex Langford2019-08-131-1/+1
| | | | | | | | | I am changing this to work around an issue that is being hit when building with clang 3.8. Specifically, clang 3.8 requires that we have a user defined default constructor for SectionRef for the default initialization of a const SectionRef. llvm-svn: 368758
* [llvm-readelf] Implement note parsing for NT_FILE and unknown descriptorsJordan Rupprecht2019-08-131-18/+146
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch implements two note parsers; one for NT_FILE coredumps, e.g.: ``` CORE 0x00000080 NT_FILE (mapped files) Page size: 4096 Start End Page Offset 0x0000000000001000 0x0000000000002000 0x0000000000003000 /path/to/a.out 0x0000000000004000 0x0000000000005000 0x0000000000006000 /path/to/libc.so 0x0000000000007000 0x0000000000008000 0x0000000000009000 [stack] ``` (A more realistic example can be tested locally by creating a crashing program and running `llvm-readelf -n core`) And also implements a raw hex dump for unknown descriptor data for unhandled descriptor types. Reviewers: MaskRay, jhenderson, grimar, alexshap Reviewed By: MaskRay, grimar Subscribers: emaste, llvm-commits, labath Tags: #llvm Differential Revision: https://reviews.llvm.org/D65832 llvm-svn: 368698
* [llvm-readobj] - Remove 'error(Error EC)' helper.George Rimar2019-08-136-70/+91
| | | | | | | | | We do not need it. I replaced it with reportError(StringRef Input, Error Err). Differential revision: https://reviews.llvm.org/D66011 llvm-svn: 368677
* [llvm-readobj] Downgrade 'PT_DYNAMIC segment offset + size exceeds the size ↵Jordan Rupprecht2019-08-121-2/+4
| | | | | | | | | | | | | | | | | | of the file' from an error to a warning Summary: This allows llvm-readobj to print other useful information for truncated files instead of giving up. Reviewers: jhenderson, grimar, MaskRay Reviewed By: jhenderson, grimar, MaskRay Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D66036 llvm-svn: 368576
* [llvm-readelf]Print filename for multiple inputs and fix formatting regressionJames Henderson2019-08-091-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
* [llvm-readobj] - Remove `error(llvm::Expected<T> &&E)`George Rimar2019-08-093-8/+7
| | | | | | | | | | This is a bit strange method. It works like a unwrapOrError, but named error. It does not report an Input name. I removed it. Differential revision: https://reviews.llvm.org/D66000 llvm-svn: 368430
* [llvm-readobj] - Remove deprecated unwrapOrError(Expected<T> EO).George Rimar2019-08-096-190/+269
| | | | | | | | | This patch changes the code to use a modern unwrapOrError(StringRef Input, Expected<T> EO) version that contains the input source name and removes the deprecated version. Differential revision: https://reviews.llvm.org/D65946 llvm-svn: 368428
* [llvm-readobj] - Remove unwrapOrError(ErrorOr<T> EO) helper.George Rimar2019-08-092-11/+11
| | | | | | | | | | | It is outdated. Using of Expected<> is preferred, also it does not provide a way to report a file name. I updated the code to use the modern version of unwrapOrError instead. Differential revision: https://reviews.llvm.org/D65951 llvm-svn: 368410
* [llvm-readobj/libObject] - Introduce a custom warning handler for ↵George Rimar2019-08-083-23/+36
| | | | | | | | | | | | | | | | | | | | `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
* Remove support for 32-bit offsets in utility classes (5/5)Igor Kudrin2019-08-071-12/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D65641 llvm-svn: 368156
* [llvm-readelf] --notes: move 'Data size' column left by 1Fangrui Song2019-08-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | readelf -n: ``` // "Data size" is not left justified Owner Data size Description GNU 0x00000010 NT_GNU_ABI_TAG (ABI version tag) ``` llvm-readelf -n (before): ``` // "Data size" column shifted by 1 Owner Data size Description GNU 0x00000010 NT_GNU_ABI_TAG (ABI version tag) ``` llvm-readelf -n (after): ``` Owner Data size Description GNU 0x00000010 NT_GNU_ABI_TAG (ABI version tag) ``` This change is made to reduce the diff with readelf -n, so that it is slightly easier to check what features readelf implements but we don't. Reviewed By: grimar, jhenderson Differential Revision: https://reviews.llvm.org/D65847 llvm-svn: 368138
* Switch LLVM to use 64-bit offsets (2/5)Igor Kudrin2019-08-061-1/+1
| | | | | | | | | This updates all libraries and tools in LLVM Core to use 64-bit offsets which directly or indirectly come to DataExtractor. Differential Revision: https://reviews.llvm.org/D65638 llvm-svn: 368014
* [llvm-readelf] Support dumping of stack sizes sections with readelf ↵Wolfgang Pieb2019-08-053-0/+339
| | | | | | | | | | --stack-sizes Reviewers: jhenderson, grimar, rupprecht Differential Revision: https://reviews.llvm.org/D65313 llvm-svn: 367942
* [llvm-readelf] Fix core note descriptionsJordan Rupprecht2019-08-051-2/+86
| | | | | | | | | | | | | | | | | | | | | | | Summary: Core files have different descriptions for note values. llvm-readelf currently prints the generic note type, which is wrong when using it to read a core file. To verify the constants/strings, see: Values: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=include/elf/common.h;h=75c4fb7e9d7c0f780d635ac305f579546b7b071b;hb=HEAD#l571 Strings: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=binutils/readelf.c;h=c31a5c1266b7bb62a485895b01b49e1f832ade35;hb=HEAD#l16881 Note: this does not handle printing the note data for NT_FILE, it just fixes the descriptions. Reviewers: MaskRay Reviewed By: MaskRay Subscribers: labath, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D65608 llvm-svn: 367878
* [llvm-readelf] - A fix for: "--hash-symbols asserts for 64-bit ELFs"George Rimar2019-07-191-1/+1
| | | | | | | | | Fixes https://bugs.llvm.org/show_bug.cgi?id=42622. (--hash-symbols switch is currently broken for 64-bit ELF files, due to r352630.) Differential revision: https://reviews.llvm.org/D64788 llvm-svn: 366558
* [NFC][llvm-readobj] Refactor dynamic string table indexing into a function.Yuanfang Chen2019-07-181-20/+16
| | | | | | | | | | | | | Restore printDynamicString removed in rL363868. It provides better error handling whenever indexing dynamic string table is needed. Reviewers: jhenderson, MaskRay, grimar Reviewed by: jhenderson, MaskRay, grimar Differential Revision: https://reviews.llvm.org/D64674 llvm-svn: 366464
* [Object/llvm-readelf/llvm-readobj] - Improve error reporting when e_shstrndx ↵George Rimar2019-07-163-10/+20
| | | | | | | | | | | | | | | | | | 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
* [llvm-readelf] Print "File: lib.a(file.o)" info when dumping archive files.Yuanfang Chen2019-07-151-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
OpenPOWER on IntegriCloud