summaryrefslogtreecommitdiffstats
path: root/llvm/tools
Commit message (Collapse)AuthorAgeFilesLines
* [llvm-readobj] Change -long-option to --long-option in tests. NFCFangrui Song2019-05-011-57/+57
| | | | | | | | | | We use both -long-option and --long-option in tests. Switch to --long-option for consistency. In the "llvm-readelf" mode, -long-option is discouraged as it conflicts with grouped short options and it is not accepted by GNU readelf. While updating the tests, change llvm-readobj -s to llvm-readobj -S to reduce confusion ("s" is --section-headers in llvm-readobj but --symbols in llvm-readelf). llvm-svn: 359649
* [llvm-objcopy] Simplify SHT_NOBITS -> SHT_PROGBITS promotionFangrui Song2019-05-011-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GNU objcopy uses bfd_elf_get_default_section_type to decide the candidate section type, which roughly translates to our [a] (I assume SEC_COMMON implies SHF_ALLOC): (!(Sec.Flags & ELF::SHF_ALLOC) || Flags & (SectionFlag::SecContents | SectionFlag::SecLoad))) Then, it updates the section type in bfd/elf.c:elf_fake_sections if: if (this_hdr->sh_type == SHT_NULL) this_hdr->sh_type = sh_type; // common case else if (this_hdr->sh_type == SHT_NOBITS && sh_type == SHT_PROGBITS && (asect->flags & SEC_ALLOC) != 0) // uncommon case ... this_hdr->sh_type = sh_type; If the following condition is met the uncommon branch is executed: if (elf_section_type (osec) == SHT_NULL && (osec->flags == isec->flags || (final_link && ((osec->flags ^ isec->flags) & ~(SEC_LINK_ONCE | SEC_LINK_DUPLICATES | SEC_RELOC)) == 0))) I suggest we just ignore this clause and follow the common case behavior, which is done in this patch. Rationales to do so: If --set-section-flags is a no-op (osec->flags == isec->flags) (corresponds to the "readonly" test in set-section-flags.test), GNU objcopy will require (Sec.Flags & ELF::SHF_ALLOC). [a] is essentially: Flags & (SectionFlag::SecContents | SectionFlag::SecLoad) This special case is not really useful. Non-SHF_ALLOC SHT_NOBITS sections do not make much sense and it doesn't matter if they are SHT_NOBITS or SHT_PROGBITS. For all other RUN lines in set-section-flags.test, the new behavior matches GNU objcopy, i.e. this patch improves compatibility. Differential Revision: https://reviews.llvm.org/D60189 llvm-svn: 359639
* [llvm-profdata] Add overlap command to compute similarity b/w two profile filesRong Xu2019-04-301-2/+89
| | | | | | | | | Add overlap functionality to llvm-profdata tool to compute the similarity between two profile files. Differential Revision: https://reviews.llvm.org/D60977 llvm-svn: 359612
* [WebAssembly] Support EXPLICIT_NAME symbols in llvm-readobjDan Gohman2019-04-301-0/+1
| | | | | | | | | Teach llvm-readobj about WASM_SYMBOL_EXPLICIT_NAME. Differential Revision: https://reviews.llvm.org/D61323 Reviewer: sbc100 llvm-svn: 359602
* [llvm-objcopy] Add RISC-V support for -B/-OJordan Rupprecht2019-04-301-4/+15
| | | | | | | | | | | | Reviewers: jorgbrown, espindola, alexshap, jhenderson Subscribers: emaste, arichardson, fedor.sergeev, jakehehrlich, kito-cheng, shiva0217, MaskRay, rogfer01, rkruppe, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D61272 llvm-svn: 359568
* [llvm-nm] Add --special-syms no-op flagEugene Leviant2019-04-301-0/+3
| | | | | | Differential revision: https://reviews.llvm.org/D60502 llvm-svn: 359563
* vs integration: vs2019 supportHans Wennborg2019-04-301-7/+7
| | | | llvm-svn: 359557
* [llvm-objcopy] - Check dynamic relocation sections for broken references.George Rimar2019-04-302-12/+36
| | | | | | | | | | | | | | This is a fix for https://bugs.llvm.org/show_bug.cgi?id=41371. Currently, it is possible to break the sh_link field of the dynamic relocation section by removing the section it refers to. The patch fixes an issue and adds 2 test cases. One of them shows that it does not seem possible to break the sh_info field. I added an assert to verify this. Differential revision: https://reviews.llvm.org/D60825 llvm-svn: 359552
* Revert r359520David Bolvansky2019-04-301-1/+1
| | | | llvm-svn: 359544
* [PDB] Fixed null pointer dereferenceDavid Bolvansky2019-04-291-1/+1
| | | | | | | | | | | | | | Reviewers: zturner, rnk Reviewed By: rnk Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D61279 llvm-svn: 359520
* [ORC] Replace the LLJIT/LLLazyJIT Create methods with Builder utilities.Lang Hames2019-04-291-13/+13
| | | | | | | | | | | LLJITBuilder and LLLazyJITBuilder construct LLJIT and LLLazyJIT instances respectively. Over time these will allow more configurable options to be added while remaining easy to use in the default case, which for default in-process JITing is now: auto J = ExitOnErr(LLJITBuilder.create()); llvm-svn: 359511
* [llvm-pdbutil] FunctionDumper::dump(PDBSymbolTypeFunctionArg) - fix null ↵Simon Pilgrim2019-04-291-2/+2
| | | | | | | | dereference warning Reported in https://www.viva64.com/en/b/0629/ llvm-svn: 359488
* [llvm-extract] Expose the group extraction feature of the BlockExtractorQuentin Colombet2019-04-291-12/+19
| | | | | | | | | | | | This patch extends the `-bb` option to be able to use the group extraction feature from the BlockExtractor. In particular, `-bb=func:bb` is modified to support a list of basic blocks per function: `-bb=func:bb1[;bb2...]` that will be extracted together if at all possible (region must be single entry.) Differential Revision: https://reviews.llvm.org/D60973 llvm-svn: 359464
* [yaml2obj] - Simplify and reduce the code. NFC.George Rimar2019-04-291-17/+8
| | | | | | | | | | | This inlines 2 single line static methods and simplifies the code. It is also possible to remove the `Is64Bit` variable since it is used only once, but I am not sure it will be better for readability. llvm-svn: 359445
* [yaml2obj] - Replace a loop with write_zeros(). NFCI.George Rimar2019-04-291-2/+1
| | | | | | This looks better. llvm-svn: 359444
* [yaml2obj] - Cleanup and simplify the code. NFCI.George Rimar2019-04-291-12/+15
| | | | | | | | | | | | | | The current code has the following problems: `initSymtabSectionHeader` and `initStrtabSectionHeader` method names saying us they are going to initialize the section headers. Though for a few cases sh_flags field is initialized outside of them. It does not look clean. This patch moves initialization of the sh_flags inside these methods. Also, it removes an excessive variable, what together with the above change hopefully makes the code a bit more readable. llvm-svn: 359443
* vs integration: Use llvm-lib for librarianRussell Gallop2019-04-293-0/+24
| | | | | | | | | | | | | | This uses llvm-lib.exe for the librarian instead of Visual Studio provided lib.exe. Without this it is not possible to create static libraries with -flto using the plugin. Original patch by Steven Noonan This fixes: PR41147 Differential Revision: https://reviews.llvm.org/D61193 llvm-svn: 359430
* [llvm-nm] Simplify and fix a buffer overflowFangrui Song2019-04-291-149/+107
| | | | | | | | | | | | | * char SymbolAddrStr[18] can't hold "%" PRIo64 which may need 22 characters. * Use range-based for * Delete unnecessary typedef * format(...).print(Str, sizeof(Str)) + outs() << Str => outs() << format(...) * Use cascading outs() << .. << .. * Use iterator_range(Container &&c) * (A & B) == B => A & B if B is a power of 2 * replace null sentinel in constants with makeArrayRef llvm-svn: 359416
* [lli] Fix a typo in a cl::opt description.Lang Hames2019-04-271-1/+1
| | | | | | | | Patch by Wasiher. Thanks Wasiher! Differential Revision: https://reviews.llvm.org/D61135 llvm-svn: 359384
* [llvm-nm][llvm-readelf] Avoid single-dash -long-option in testsFangrui Song2019-04-271-4/+0
| | | | llvm-svn: 359383
* [llvm-nm] Support section type 'u': STB_GNU_UNIQUEFangrui Song2019-04-271-0/+4
| | | | llvm-svn: 359380
* [ORC] Add a 'plugin' interface to ObjectLinkingLayer for events/configuration.Lang Hames2019-04-261-7/+21
| | | | | | | | | | | | | ObjectLinkingLayer::Plugin provides event notifications when objects are loaded, emitted, and removed. It also provides a modifyPassConfig callback that allows plugins to modify the JITLink pass configuration. This patch moves eh-frame registration into its own plugin, and teaches llvm-jitlink to only add that plugin when performing execution runs on non-Windows platforms. This should allow us to re-enable the test case that was removed in r359198. llvm-svn: 359357
* [llvm-nm] Revert inadvertently committed 'i' change in r359314Fangrui Song2019-04-261-3/+0
| | | | llvm-svn: 359315
* [ThinLTO] Fix X86/strong_non_prevailing.ll after llvm-nm 'r' changeFangrui Song2019-04-261-0/+3
| | | | llvm-svn: 359314
* [llvm-nm] Generalize symbol types 'N', 'n' and '?'Fangrui Song2019-04-261-9/+5
| | | | llvm-svn: 359312
* [llvm-nm] Fix handling of symbol types 't' 'd' 'r'Fangrui Song2019-04-261-19/+6
| | | | | | | | | | | | | | | In addition, fix and convert the two tests to yaml2obj based. This allows us to delete two executables. X86/weak.test: 'v' was not tested X86/init-fini.test: symbol types of __bss_start _edata _end were wrong GNU nm reports __init_array_start as 't', and __preinit_array_start as 'd'. __init_array_start is 't' just because its section ".init_array" starts with ".init" 'd' makes more sense and allows us to drop the weird SHT_INIT_ARRAY rule. So, change __init_array_start to 'd' instead. llvm-svn: 359311
* [yaml2obj] - Make implicitSectionNames() return std::vector<StringRef>. NFCI.George Rimar2019-04-261-4/+4
| | | | | | | No need to use SmallVector of char* here. This simplifies the code. llvm-svn: 359301
* [yaml2obj] - Remove excessive variable. NFC.George Rimar2019-04-261-3/+3
| | | | | | `auto &Strtab` was used only once. llvm-svn: 359300
* [yaml2obj] - Make the code to match the LLVM style. NFCI.George Rimar2019-04-261-7/+7
| | | | | | | This renames the variables to uppercase and removes use of `auto` for unobvious type. llvm-svn: 359298
* [yaml2elf] - Cleanup the initSectionHeaders(). NFCI.George Rimar2019-04-261-67/+74
| | | | | | | | This encapsulates the section specific code inside the corresponding writeSectionContent methods. Making the code a bit more consistent. llvm-svn: 359297
* Minor formatting tweak, no behavior changeNico Weber2019-04-261-4/+7
| | | | llvm-svn: 359295
* Fix typos: (re)?sor?uce -> (re)?sourceFangrui Song2019-04-261-1/+1
| | | | | | | | | | | Closes: https://github.com/llvm/llvm-project/pull/10 In-collaboration-with: Olivier Cochard-Labbé <olivier@FreeBSD.org> Signed-off-by: Enji Cooper <yaneurabeya@gmail.com> Differential Revision: https://reviews.llvm.org/D61021 llvm-svn: 359277
* [llvm-objcopy] Accept --long-option but not -long-optionFangrui Song2019-04-262-45/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: llvm-{objcopy,strip} (and many other LLVM binary utilities) accept cl::opt style -long-option as well as many short options (e.g. -p -S -x). People who use them as replacement of GNU binutils often use the grouped option syntax (POSIX Utility Conventions), e.g. -Sx => -S -x, -Wd => -W -d, -sj.text => -s -j.text There is ambiguity if a long option starts with the character used by a short option. Drop the support for -long-option to resolve the ambiguity. This divergence from other utilities is accepted (other utilities continue supporting -long-option). https://lists.llvm.org/pipermail/llvm-dev/2019-April/131786.html Reviewers: alexshap, jakehehrlich, jhenderson, rupprecht, espindola Reviewed By: jakehehrlich, jhenderson, rupprecht Subscribers: grimar, emaste, arichardson, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D60439 llvm-svn: 359265
* [yaml2obj] - Don't crash on invalid inputs.George Rimar2019-04-251-5/+1
| | | | | | | | | | | | | | yaml2obj might crash on invalid input when unable to parse the YAML. Recently a crash with a very similar nature was fixed for an empty files. This patch revisits the fix and does it in yaml::Input instead. It seems to be more correct way to handle such situation. With that crash for invalid inputs is also fixed now. Differential revision: https://reviews.llvm.org/D61059 llvm-svn: 359178
* [llvm-rtdyld] Add support for passing command line arguments to rtdyld-run code.Lang Hames2019-04-251-5/+19
| | | | | | | | | | | | | | | | | The --args option can now be used to pass arguments to code linked with llvm-rtdyld. E.g. $ llvm-rtdyld file1.o file2.o --args a b c is equivalent to: $ ld -o program file1.o file2.o $ ./program a b c This is the rtdyld counterpart to the jitlink change in r359115, and makes benchmarking and comparison between the tools easier. llvm-svn: 359168
* Enable LoopVectorization by default.Alina Sbirlea2019-04-251-9/+7
| | | | | | | | | | | | | | | | | Summary: When refactoring vectorization flags, vectorization was disabled by default in the new pass manager. This patch re-enables is for both managers, and changes the assumptions opt makes, based on the new defaults. Comments in opt.cpp should clarify the intended use of all flags to enable/disable vectorization. Reviewers: chandlerc, jgorbe Subscribers: jlebar, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D61091 llvm-svn: 359167
* [llvm-objdump] errorToErrorCode+message -> toStringFangrui Song2019-04-251-4/+3
| | | | | | For test/Object/elf-invalid-phdr.test, the intended error message got lost due to errorToErrorCode(). llvm-svn: 359166
* llvm-cvtres: Make new dupe resource error a bit friendlierNico Weber2019-04-242-26/+4
| | | | | | | | | | | | 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
* llvm-cvtres: Remove a default argument. No behavior change.Nico Weber2019-04-241-1/+1
| | | | llvm-svn: 359128
* [JITLink] Add support for passing arguments to jit-linked code.Lang Hames2019-04-241-2/+13
| | | | | | | | | | | | | | The --args option can now be used to pass arguments to code linked with llvm-jitlink. E.g. $ llvm-jitlink file1.o file2.o --args a b c is equivalent to: $ ld -o program file1.o file2.o $ ./program a b c llvm-svn: 359115
* [AMDGPU] Add gfx1010 target definitionsStanislav Mekhanoshin2019-04-241-0/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D61041 llvm-svn: 359113
* Revert "[llvm-objdump] errorToErrorCode+message -> toString"JF Bastien2019-04-241-3/+4
| | | | | | | | Revert r359100 It breaks llvm/test/Object/elf-invalid-phdr.test llvm-svn: 359110
* [JITLink] Refer to FDE's CIE (not the most recent CIE) when parsing eh-frame.Lang Hames2019-04-241-21/+27
| | | | | | | | | | | | | | | Frame Descriptor Entries (FDEs) have a pointer back to a Common Information Entry (CIE) that describes how the rest FDE should be parsed. JITLink had been assuming that FDEs always referred to the most recent CIE encountered, but the spec allows them to point back to any previously encountered CIE. This patch fixes JITLink to look up the correct CIE for the FDE. The testcase is a MachO binary with an FDE that refers to a CIE that is not the one immediately proceeding it (the layout can be viewed wit 'dwarfdump --eh-frame <testcase>'. This test case had to be a binary as llvm-mc now sorts FDEs (as of r356216) to ensure FDEs *do* point to the most recent CIE. llvm-svn: 359105
* [llvm-objdump] Delete redundant checkFangrui Song2019-04-241-4/+1
| | | | llvm-svn: 359102
* [obj2yamp] - Simplify and cleanup the code in ELFDumper<ELFT>::dumpGroup a ↵George Rimar2019-04-241-27/+25
| | | | | | | | | | bit. NFC. This makes the variables naming to match LLVM style, simplifies the code used to extract the group members, simplifies the loop and reorders the code around a bit. llvm-svn: 359101
* [llvm-objdump] errorToErrorCode+message -> toStringFangrui Song2019-04-241-4/+3
| | | | llvm-svn: 359100
* [yaml2obj] Replace num_zeros with write_zerosFangrui Song2019-04-241-35/+24
| | | | llvm-svn: 359091
* [yaml2elf] - Replace a loop with write_zeros(). NFC.George Rimar2019-04-241-6/+5
| | | | | | And apply clang-format to the method changed. llvm-svn: 359090
* [CommandLine] Provide parser<unsigned long> instantiation to allow ↵Fangrui Song2019-04-247-44/+39
| | | | | | | | | | | | | cl::opt<uint64_t> on LP64 platforms Summary: And migrate opt<unsigned long long> to opt<uint64_t> Fixes PR19665 Differential Revision: https://reviews.llvm.org/D60933 llvm-svn: 359068
* llvm-cvtres: Accept /? as help flag, like cvtres.exeNico Weber2019-04-241-0/+1
| | | | llvm-svn: 359064
OpenPOWER on IntegriCloud