- Oct 03, 2019
-
-
Simon Atanasyan authored
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
-
Simon Atanasyan authored
Old options `--mips-plt-got`, `--mips-abi-flags`, '--mips-reginfo`, and `--mips-options` wiil be deleted in a separate patch. llvm-svn: 373588
-
Simon Atanasyan authored
It is not an error if a file does not contain GOT. llvm-svn: 373587
-
- Oct 02, 2019
-
-
George Rimar authored
It is possible to craft a .hash section that triggers an infinite loop in llvm-readelf code. This patch fixes the issue and introduces a warning. Differential revision: https://reviews.llvm.org/D68086 llvm-svn: 373476
-
- Oct 01, 2019
-
-
Fangrui Song authored
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
-
- Sep 27, 2019
-
-
Yi Kong authored
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
-
- Sep 25, 2019
-
-
George Rimar authored
I started this patch as a refactoring, tried to make a helper for getting symbol names, similar to how we get section names used in warning messages. So this patch cleanups the code and fixes an issue: symbol names in warning messages were not demangled. Differential revision: https://reviews.llvm.org/D68012 llvm-svn: 372867
-
George Rimar authored
The crash might happen when we have either a broken or unsupported object and trying to resolve relocations when dumping the .stack_sizes section. For the test case I used a 32-bits ELF header and a 64-bit relocation. In this case a null pointer is returned by the code instead of the relocation resolver function and then we crash. Differential revision: https://reviews.llvm.org/D67962 llvm-svn: 372838
-
- Sep 23, 2019
-
-
George Rimar authored
llvm-readobj currently handles .stack_sizes.* (e.g. .stack_sizes.foo) as a normal stack sizes section. Though MC does not produce sections with such names. Also, linkers do not combine .stack_sizes.* into .stack_sizes. A mini discussion about this correctness issue is here: https://reviews.llvm.org/D67757#inline-609274 This patch changes implementation so that only now only '.stack_sizes' name is accepted as a real stack sizes section. Differential revision: https://reviews.llvm.org/D67824 llvm-svn: 372578
-
George Rimar authored
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
-
- Sep 21, 2019
-
-
Fangrui Song authored
The new constructor can simplify some llvm-readobj call sites. Reviewed By: grimar, dblaikie Differential Revision: https://reviews.llvm.org/D67797 llvm-svn: 372473
-
- Sep 20, 2019
-
-
Yuanfang Chen authored
Otherwise the output could be lost. llvm-svn: 372372
-
- Sep 17, 2019
-
-
George Rimar authored
[llvm-readobj/llvm-objdump] - Improve how tool locate the dynamic table and 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
-
George Rimar authored
It's a straightforward refactoring that allows to simplify and encapsulate the code. Differential revision: https://reviews.llvm.org/D67624 llvm-svn: 372083
-
- Sep 06, 2019
-
-
George Rimar authored
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
-
Fangrui Song authored
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
-
- Sep 05, 2019
-
-
George Rimar authored
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
-
- Aug 30, 2019
-
-
Martin Storsjö authored
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
-
Dan Gohman authored
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
-
- Aug 29, 2019
-
-
George Rimar authored
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
-
Martin Storsjö authored
Differential Revision: https://reviews.llvm.org/D66819 llvm-svn: 370311
-
Martin Storsjö authored
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
-
Martin Storsjö authored
This already is done when dumping resources from coff objects. Differential Revision: https://reviews.llvm.org/D66816 llvm-svn: 370308
-
Martin Storsjö authored
This became unnecessary in SVN r359153. Differential Revision: https://reviews.llvm.org/D66815 llvm-svn: 370307
-
- Aug 28, 2019
-
-
Jason Liu authored
This is to fix the commit in r370097. llvm-svn: 370260
-
- Aug 27, 2019
-
-
Jason Liu authored
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
-
- Aug 22, 2019
-
-
George Rimar authored
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
-
- Aug 20, 2019
-
-
Fangrui Song authored
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
-
- Aug 19, 2019
-
-
George Rimar authored
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
-
Fangrui Song authored
llvm-svn: 369254
-
- Aug 17, 2019
-
-
George Rimar authored
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
-
George Rimar authored
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
-
George Rimar authored
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
-
George Rimar authored
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
-
Petr Hosek authored
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
-
Petr Hosek authored
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
-
- Aug 15, 2019
-
-
Jonas Devlieghere authored
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
-
Seiya Nuta authored
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
-
- Aug 14, 2019
-
-
George Rimar authored
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
-
George Rimar authored
It broke clang BB: http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/16455 llvm-svn: 368813
-