summaryrefslogtreecommitdiffstats
path: root/llvm/tools
Commit message (Collapse)AuthorAgeFilesLines
...
* [llvm-jitlink] Add optional slab allocator for testing locality optimizations.Lang Hames2019-09-062-2/+178
| | | | | | | | | | | | The llvm-jitlink utility now accepts a '-slab-allocate <size>' option. If given, llvm-jitlink will use a slab-based memory manager rather than the default InProcessMemoryManager. Using a slab allocator will allow reliable testing of future locality based optimizations (e.g. PLT and GOT elimination) in JITLink. The <size> argument is a number, optionally followed by a units specifier (Kb, Mb, or Gb). If the units are not given then the number is assumed to be in Kb. llvm-svn: 371244
* [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
* [yaml2obj] Rename SHOffset (e_shoff) field to SHOff. NFCFangrui Song2019-09-061-1/+1
| | | | | | | | | | | `struct Elf*_Shdr` has a field `sh_offset`, named `ShOffset` in llvm::ELFYAML::Section. Rename SHOffset (e_shoff) to SHOff to prevent confusion. Reviewed By: grimar Differential Revision: https://reviews.llvm.org/D67254 llvm-svn: 371185
* [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
* [llvm-rtdyld][llvm-jitlink] Rename struct member to remove ambiguity.Lang Hames2019-09-042-11/+8
| | | | | | | This ambiguity (struct member name matching struct name) was causing errors on a few of the MSVC bots. Hopefully this should fix it. llvm-svn: 370969
* [llvm-rtdyld] Add timers to match llvm-jitlink.Lang Hames2019-09-042-33/+71
| | | | | | | | When using llvm-rtdyld to execute code, -show-times will now show the time taken to load the object files, apply relocations, and execute the rtdyld-linked code. llvm-svn: 370968
* [JITLink] Fix the show-timers option on llvm-jitlink.Lang Hames2019-09-041-15/+16
| | | | | | | No longer constantly shows times (even when -show-times=false). When shown, times are now correctly grouped. llvm-svn: 370951
* Fix "enumeral and non-enumeral type in conditional expression" warnings. NFCI.Simon Pilgrim2019-09-042-2/+2
| | | | llvm-svn: 370892
* [llvm-dwarfdump] Fix spelling in the comments. NFCDjordje Todorovic2019-09-041-2/+2
| | | | llvm-svn: 370861
* [llvm-objcopy] Add objcopy::elf::Object::allocSections to simplify loops on ↵Fangrui Song2019-09-042-22/+21
| | | | | | | | | | SHF_ALLOC sections Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D67142 llvm-svn: 370860
* [llvm-objcopy] Rename variable names "Section" to "Sec". NFCFangrui Song2019-09-042-71/+65
| | | | | | | | | | | | | | "Section" can refer to the type llvm::objcopy::elf::Section or the variable name. Rename it to "Sec" for clarity. "Sec" is already used a lot, so this change improves consistency as well. Also change `auto` to `const SectionBase` for readability. Reviewed By: grimar Differential Revision: https://reviews.llvm.org/D67143 llvm-svn: 370852
* [llvm-objcopy] Fix some identifier names in comments. NFCFangrui Song2019-09-041-5/+5
| | | | llvm-svn: 370838
* [llvm-profdata] Add mode to recover from profile read failuresVedant Kumar2019-09-031-71/+65
| | | | | | | | | | Add a mode in which profile read errors are not immediately treated as fatal. In this mode, merging makes forward progress and reports failure only if no inputs can be read. Differential Revision: https://reviews.llvm.org/D66985 llvm-svn: 370827
* [llvm-objcopy] Simplify alignToAddr with llvm::alignToFangrui Song2019-08-311-15/+2
| | | | llvm-svn: 370577
* Fix some errors introduced by rL370563 which were not exposed on my local ↵Wei Mi2019-08-311-1/+1
| | | | | | | | | machine. 1. zlib::compress accept &size_t but the param is an uint64_t. 2. Some systems don't have zlib installed. Don't use compression by default. llvm-svn: 370564
* [SampleFDO] Add profile symbol list section to discriminate function beingWei Mi2019-08-311-20/+67
| | | | | | | | | | | | | | | | | | | cold versus function being newly added. This is the second half of https://reviews.llvm.org/D66374. Profile symbol list is the collection of function symbols showing up in the binary which generates the current profile. It is used to discriminate function being cold versus function being newly added. Profile symbol list is only added for profile with ExtBinary format. During profile use compilation, when profile-sample-accurate is enabled, a function without profile will be regarded as cold only when it is contained in that list. Differential Revision: https://reviews.llvm.org/D66766 llvm-svn: 370563
* llvm-dwarfdump: Cache CU low_pc when computing statistics.David Blaikie2019-08-311-6/+6
| | | | llvm-svn: 370559
* [IFS][NFC] llvm-ifs: Fixing build bot build break: revert r370517 and r370510.Puyan Lotfi2019-08-301-5/+13
| | | | llvm-svn: 370522
* [IFS][NFC] llvm-ifs: Fixing build bot error due to commit conflicts.Puyan Lotfi2019-08-301-8/+0
| | | | | | | | r370510 and r370504 Again only on gcc. llvm-svn: 370517
* [IFS][NFC] llvm-ifs: Fixing build errors for bots using GCC.Puyan Lotfi2019-08-301-5/+5
| | | | | | | | | | | | | gcc produces the error: error: specialization of ‘template<class T, class Enable> struct llvm::yaml::ScalarTraits’ in different namespace For all specializations outside of llvm::yaml. So I added llvm::yaml to these specializations to fix the errors on the bots building with gcc (/usr/bin/c++). llvm-svn: 370510
* Fix compilation warnings. NFC.Michael Liao2019-08-301-1/+10
| | | | llvm-svn: 370504
* [llvm-ifs][IFS] llvm Interface Stubs merging + object file generation tool.Puyan Lotfi2019-08-304-0/+552
| | | | | | | | | | | | | | | | | | | | | | This tool merges interface stub files to produce a merged interface stub file or a stub library. Currently it for stub library generation it can produce an ELF .so stub file, or a TBD file (experimental). It will be used by the clang -emit-interface-stubs compilation pipeline to merge and assemble the per-CU stub files into a stub library. The new IFS format is as follows: --- !experimental-ifs-v1 IfsVersion: 1.0 Triple: <llvm triple> ObjectFileFormat: <ELF | TBD> Symbols: _ZSymbolName: { Type: <type>, etc... } ... Differential Revision: https://reviews.llvm.org/D66405 llvm-svn: 370499
* [llvm-nm] Small fix to Exected<StringRef>Sid Manning2019-08-301-1/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D66976 llvm-svn: 370474
* [llvm-objcopy] Allow the visibility of symbols created by --binary andChris Jackson2019-08-308-23/+57
| | | | | | --add-symbol to be specified with --new-symbol-visibility llvm-svn: 370458
* [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
* [ObjectYAML] Fix lifetime issue in dumpDebugLinesVitaly Buka2019-08-291-1/+1
| | | | | | | | | | Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D66901 llvm-svn: 370289
* [LLVM-C] Fix omission of INSTALL_WITH_TOOLCHAIN to llvm_add_library()Tom Stellard2019-08-281-1/+1
| | | | | | | | | Due to a misstake with r365902 that tried to simplify the install with toolchain logic LLVM-C.dll was no longer being installed. Patch By: Jakob Bornecrantz llvm-svn: 370271
* [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
* Revert Autogenerate the shebang lines for tools/opt-viewerReid Kleckner2019-08-275-22/+7
| | | | | | | | | | This reverts r369486 (git commit 8d18384809957cc923752e10a86adab129e3df48) The opt-viewer tests don't pass after this change, and fixing them isn't trivial. opt-viewer.py imports optmap, which requires adjusting pythonpath, which is more work than I'm willing to do to fix forward. llvm-svn: 370095
* [JITLink] Fix bogus TimerGroup constructor call.Lang Hames2019-08-271-3/+2
| | | | llvm-svn: 370088
* [JITLink] Add timers and -show-times option to llvm-jitlink.Lang Hames2019-08-271-3/+35
| | | | | | | The timers track time spent loading objects, linking, and (if applicable) running JIT-link'd code. llvm-svn: 370075
* [llvm-objdump] - Remove one overload of reportError. NFCI.George Rimar2019-08-273-47/+34
| | | | | | | | | | | | | | | | | There is a problem with reportError we have. Declaration says we have ArchiveName that follows the FileName: reportError(Error E, StringRef FileName, StringRef ArchiveName,... Though implementation have them reversed. I cleaned it up and removed an excessive reportError(Error E, StringRef File) version. Rebased on top of D66418. Differential revision: https://reviews.llvm.org/D66517 llvm-svn: 370034
* [NFC][cmake] Build fix in tools/llvm-config/CMakeLists.txtGabor Buella2019-08-261-3/+3
| | | | | | | | | | | | | | | To avoid the following error message (using cmake version 3.13.4) : ``` CMake Error at tools/llvm-config/CMakeLists.txt:37 (string): Syntax error in cmake code when parsing string-std=[^ ]\+Invalid escape sequence \+ ``` Reviewed By: mgorny Differential Revision: https://reviews.llvm.org/D58619 llvm-svn: 369887
* [llvm-reduce] Silence -WdocumentationBenjamin Kramer2019-08-241-1/+0
| | | | | | ReduceGlobalVars.cpp:17:6: warning: '@returns' command used in a comment that is attached to a function returning void llvm-svn: 369848
* [SampleFDO] Add ExtBinary format to support extension of binary profile.Wei Mi2019-08-231-9/+16
| | | | | | | | | | | | This is a patch split from https://reviews.llvm.org/D66374. It tries to add a new format of profile called ExtBinary. The format adds a section header table to the profile and organize the profile in sections, so the future extension like adding a new section or extending an existing section will be easier while keeping backward compatiblity feasible. Differential Revision: https://reviews.llvm.org/D66513 llvm-svn: 369798
* [llvm-objcopy] Strip debug sections when running with --strip-unneeded.Jordan Rupprecht2019-08-231-1/+1
| | | | | | | | | | | | | | | | | | | Summary: GNU --strip-unneeded strips debugging sections as well. Do that for llvm-objcopy as well. Additionally, add a test that verifies we keep the .gnu_debuglink section. This apparently was not always the case, and I'm not sure which commit fixed it, but there doesn't appear to be any test coverage to make sure we continue to do so. This fixes PR41043. Reviewers: jhenderson, jakehehrlich, espindola, alexshap Subscribers: emaste, arichardson, MaskRay, abrachet, seiya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D66623 llvm-svn: 369761
* Fight a bit against global initializers. NFC.Benjamin Kramer2019-08-221-1/+1
| | | | llvm-svn: 369695
* [llvm-objcopy][NFC] Refactor symbol/section matchingJordan Rupprecht2019-08-224-44/+58
| | | | | | | | | | | | | | | | | | | Summary: The matchers for section/symbol related flags (e.g. `--keep-symbol=Name` or `--regex --keep-symbol=foo.*`) are currently just vectors that are matched linearlly. However, adding wildcard support would require negative matching too, e.g. a symbol should be removed if it matches a wildcard *but* doesn't match some other wildcard. To make the next patch simpler, consolidate matching logic to a class defined in CopyConfig that takes care of matching. Reviewers: jhenderson, seiya, MaskRay, espindola, alexshap Reviewed By: jhenderson, MaskRay Subscribers: emaste, arichardson, jakehehrlich, abrachet, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D66432 llvm-svn: 369689
* [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-objdump] - Cleanup the error reporting.George Rimar2019-08-215-166/+182
| | | | | | | | | | | | | | | | | | | The error reporting function are not consistent. Before this change: * They had inconsistent naming (e.g. 'error' vs 'report_error'). * Some of them reported the object name, others - dont. * Some of them accepted the case when there was no error. (i.e. error code or Error had a success value). This patch tries to cleanup it a bit. It also renames report_error -> reportError, report_warning -> reportWarning and removes a full stop from messages. Differential revision: https://reviews.llvm.org/D66418 llvm-svn: 369515
* Autogenerate the shebang lines for tools/opt-viewerChris Bieneman2019-08-215-7/+22
| | | | | | | | | | | | | | | | | | | | | Summary: Since these files depend on the built python modules, they need to use the right python binary to run them. So use configure_file to set the right shebang line. Patch By: cbiesinger (Christian Biesinger) Reviewers: chandlerc, beanz, anemet Reviewed By: anemet Subscribers: compnerd, JDevlieghere, mgorny, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D65983 llvm-svn: 369486
* [llvm-extract] Update the help message for group extraction featureJinsong Ji2019-08-201-2/+12
| | | | | | | | | | | | | | | | | | | | | | | Summary: https://reviews.llvm.org/D60973 exposed the group extraction feature of the BlockExtractor to llvm-extract. However, the help message was not updated, so users might not be able to know how to use this feature without looking into history/commits. This patch just update the help message to show how to use this group extraction feature. Reviewers: qcolombet, volkan Reviewed By: qcolombet Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D66438 llvm-svn: 369438
OpenPOWER on IntegriCloud