summaryrefslogtreecommitdiffstats
path: root/llvm/tools
Commit message (Collapse)AuthorAgeFilesLines
* Update compiler extension integration into the build systemserge-sans-paille2020-06-173-4/+25
| | | | | | | | | | | | The approach here is to create a new (empty) component, `Extensions', where all statically compiled extensions dynamically register their dependencies. That way we're more natively compatible with LLVMBuild and llvm-config. Fixes: https://bugs.llvm.org/show_bug.cgi?id=44870 Differential Revision: https://reviews.llvm.org/D78192 (cherry picked from commit 8f766e382b77eef3102798b49e087d1e4804b984)
* [llvm-objcopy] Avoid invalid Sec.Offset after D79229Fangrui Song2020-05-031-4/+4
| | | | | | | | | | | | To avoid undefined behavior caught by -fsanitize=undefined on binary-paddr.test void SectionWriter::visit(const Section &Sec) { if (Sec.Type != SHT_NOBITS) // Sec.Contents is empty while Sec.Offset may be out of bound llvm::copy(Sec.Contents, Out.getBufferStart() + Sec.Offset); } (cherry picked from commit 762fb1c40eea6878c2d6a1f0f1fc7915c8747981)
* [llvm-objcopy] -O binary: skip empty sectionsFangrui Song2020-05-011-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | After SHF_ALLOC sections are ordered by LMA: * If initial sections are empty, GNU objcopy skips their contents while we emit leading zeros. (binary-paddr.test %t4) * If trailing sections are empty, GNU objcopy skips their contents while we emit trailing zeros. (binary-paddr.test %t5) This patch matches GNU objcopy's behavior. Linkers don't keep p_memsz PT_LOAD segments. Such empty sections would not have a containing PT_LOAD and `Section::ParentSegment` might be null if linkers fail to optimize the file offsets (lld D79254). In particular, without D79254, the arm Linux kernel's multi_v5_defconfig depends on this behavior: in `vmlinux`, an empty .text_itcm is mapped at a very high address (0xfffe0000) but the kernel does not expect `objcopy -O binary` to create a very large `arch/arm/boot/Image` (0xfffe0000-0xc0000000 ~= 1GiB). See https://bugs.llvm.org/show_bug.cgi?id=45632 Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D79229 (cherry picked from commit ec786906f5feb4dceba1b5338927079e63e78095)
* [llvm-objcopy] Improve tool selection logic to recognize llvm-strip-$major ↵Fangrui Song2020-04-111-5/+19
| | | | | | | | | | | | | | | | | as strip Debian and some other distributions install llvm-strip as llvm-strip-$major (e.g. `/usr/bin/llvm-strip-9`) D54193 made it work with llvm-strip-$major but did not add a test. The behavior was regressed by D69146. Fixes https://github.com/ClangBuiltLinux/linux/issues/940 Reviewed By: alexshap Differential Revision: https://reviews.llvm.org/D76562 (cherry picked from commit f2f96eb605bc770e4da400dbcc7a6d2526ec1fd4)
* llvm-ar: Fix MinGW compilationHans Wennborg2020-02-281-2/+1
| | | | | | | | | | | | | | | | llvm-ar is using CompareStringOrdinal which is available only starting with Windows Vista (WINVER 0x600). Fix this by hoising WindowsSupport.h, which sets _WIN32_WINNT to 0x0601, up to llvm/include/llvm/Support and use it in llvm-ar. Patch by Cristian Adam! Differential revision: https://reviews.llvm.org/D74599 (cherry picked from commit 01f9abbb50b11dd26b9ccb7cb565cc955d2b9c74) This is for https://bugs.llvm.org/show_bug.cgi?id=44907
* [ORC] Add support for emulated TLS to ORCv2.Lang Hames2020-01-291-6/+15
| | | | | | | | | | | | | | | | | | | | | | | This commit adds a ManglingOptions struct to IRMaterializationUnit, and replaces IRCompileLayer::CompileFunction with a new IRCompileLayer::IRCompiler class. The ManglingOptions struct defines the emulated-TLS state (via a bool member, EmulatedTLS, which is true if emulated-TLS is enabled and false otherwise). The IRCompileLayer::IRCompiler class wraps an IRCompiler (the same way that the CompileFunction typedef used to), but adds a method to return the IRCompileLayer::ManglingOptions that the compiler will use. These changes allow us to correctly determine the symbols that will be produced when a thread local global variable defined at the IR level is compiled with or without emulated TLS. This is required for ORCv2, where MaterializationUnits must declare their interface up-front. Most ORCv2 clients should not require any changes. Clients writing custom IR compilers will need to wrap their compiler in an IRCompileLayer::IRCompiler, rather than an IRCompileLayer::CompileFunction, however this should be a straightforward change (see modifications to CompileUtils.* in this patch for an example). (cherry picked from commit ce2207abaf9a925b35f15ef92aaff6b301ba6d22)
* [yaml2obj/obj2yaml] - Add support for SHT_RELR sections.Georgii Rymar2020-01-151-0/+33
| | | | | | | | | | | | | | | | | | | Note: this is a reland with a trivial 2 lines fix in ELFState<ELFT>::writeSectionContent. It adds a check similar to ones we already have for other sections to fix the case revealed by bots, like http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/60744. The encoded sequence of Elf*_Relr entries in a SHT_RELR section looks like [ AAAAAAAA BBBBBBB1 BBBBBBB1 ... AAAAAAAA BBBBBB1 ... ] i.e. start with an address, followed by any number of bitmaps. The address entry encodes 1 relocation. The subsequent bitmap entries encode up to 63(31) relocations each, at subsequent offsets following the last address entry. More information is here: https://github.com/llvm-mirror/llvm/blob/master/lib/Object/ELF.cpp#L272 This patch adds a support for these sections. Differential revision: https://reviews.llvm.org/D71872
* Revert "[yaml2obj/obj2yaml] - Add support for SHT_RELR sections."Georgii Rymar2020-01-151-33/+0
| | | | | | This reverts commit 46d11e30ee807accefd14e0b7f306647963a39b5. It broke bots. E.g. http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/60744
* [yaml2obj/obj2yaml] - Add support for SHT_RELR sections.Georgii Rymar2020-01-151-0/+33
| | | | | | | | | | | | | | | The encoded sequence of Elf*_Relr entries in a SHT_RELR section looks like [ AAAAAAAA BBBBBBB1 BBBBBBB1 ... AAAAAAAA BBBBBB1 ... ] i.e. start with an address, followed by any number of bitmaps. The address entry encodes 1 relocation. The subsequent bitmap entries encode up to 63(31) relocations each, at subsequent offsets following the last address entry. More information is here: https://github.com/llvm-mirror/llvm/blob/master/lib/Object/ELF.cpp#L272 This patch adds a support for these sections. Differential revision: https://reviews.llvm.org/D71872
* Removed PointerUnion3 and PointerUnion4 aliases in favor of the variadic ↵Dmitri Gribenko2020-01-141-1/+1
| | | | template
* [llvm-exegesis] Initialize const bitvector memberJonas Devlieghere2020-01-131-1/+1
| | | | | | This causes an error with older versions of clang: constructor for 'llvm::exegesis::InstructionsCache' must explicitly initialize the const member 'BVC'
* [Dsymutil][Debuginfo][NFC] #3 Refactor dsymutil to separate DWARF optimizing ↵Alexey Lapshin2020-01-134-54/+101
| | | | | | | | | | | | | | | | | | | | | | | | part. Summary: This is the next portion of patches for dsymutil. Create DwarfEmitter interface to generate all debug info tables. Put DwarfEmitter into DwarfLinker library and make tools/dsymutil/DwarfStreamer to be child of DwarfEmitter. It passes check-all testing. MD5 checksum for clang .dSYM bundle matches for the dsymutil with/without that patch. Reviewers: JDevlieghere, friss, dblaikie, aprantl Reviewed By: JDevlieghere Subscribers: merge_guards_bot, hiraditya, thegameg, probinson, llvm-commits Tags: #llvm, #debug-info Differential Revision: https://reviews.llvm.org/D72476
* [llvm-exegesis] Remove unneeded std::move()Miloš Stojanović2020-01-131-1/+1
| | | | | | | | | | | Caught by buildbot breakage: /home/docker/worker_env/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm/llvm/tools/llvm-exegesis/lib/Mips/Target.cpp:89:12: error: moving a local object in a return statement prevents copy elision [-Werror,-Wpessimizing-move] return std::move(Instructions); ^ /home/docker/worker_env/ppc64le-clang-rhel-test/clang-ppc64le-rhel/llvm/llvm/tools/llvm-exegesis/lib/Mips/Target.cpp:89:12: note: remove std::move call here return std::move(Instructions); ^~~~~~~~~~ ~
* [llvm-exegesis][mips] Expand loadImmediate()Miloš Stojanović2020-01-131-13/+62
| | | | | | | Add support for loading 32-bit immediates and enable the use of GPR64 registers. Differential Revision: https://reviews.llvm.org/D71873
* [Disassembler] Delete the VStream parameter of MCDisassembler::getInstruction()Fangrui Song2020-01-116-23/+9
| | | | | | | | | | The argument is llvm::null() everywhere except llvm::errs() in llvm-objdump in -DLLVM_ENABLE_ASSERTIONS=On builds. It is used by no target but X86 in -DLLVM_ENABLE_ASSERTIONS=On builds. If we ever have the needs to add verbose log to disassemblers, we can record log with a member function, instead of passing it around as an argument.
* [ORC] Fix argv handling in runAsMain / lli.Lang Hames2020-01-111-8/+2
| | | | | | | | This fixes an off-by-one error in the argc value computed by runAsMain, and switches lli back to using the input bitcode (rather than the string "lli") as the effective program name. Thanks to Stefan Graenitz for spotting the bug.
* [xray] Remove cl::sub from alias optionsShoaib Meenai2020-01-096-78/+41
| | | | | | | | | | | | | | | | | | | Currently running the xray tools generates a number of errors: $ ./bin/llvm-xray : for the -k option: cl::alias must not have cl::sub(), aliased option's cl::sub() will be used! : for the -d option: cl::alias must not have cl::sub(), aliased option's cl::sub() will be used! : for the -o option: cl::alias must not have cl::sub(), aliased option's cl::sub() will be used! : for the -f option: cl::alias must not have cl::sub(), aliased option's cl::sub() will be used! : for the -s option: cl::alias must not have cl::sub(), aliased option's cl::sub() will be used! : for the -r option: cl::alias must not have cl::sub(), aliased option's cl::sub() will be used! : for the -p option: cl::alias must not have cl::sub(), aliased option's cl::sub() will be used! : for the -m option: cl::alias must not have cl::sub(), aliased option's cl::sub() will be used! <snip> Patch by Ryan Mansfield. Differential Revision: https://reviews.llvm.org/D69386
* [ThinLTO] Pass CodeGenOpts like UnrollLoops/VectorizeLoop/VectorizeSLPWei Mi2020-01-093-0/+6
| | | | | | | | | | | | | down to pass builder in ltobackend. Currently CodeGenOpts like UnrollLoops/VectorizeLoop/VectorizeSLP in clang are not passed down to pass builder in ltobackend when new pass manager is used. This is inconsistent with the behavior when new pass manager is used and thinlto is not used. Such inconsistency causes slp vectorization pass not being enabled in ltobackend for O3 + thinlto right now. This patch fixes that. Differential Revision: https://reviews.llvm.org/D72386
* [Dsymutil][Debuginfo][NFC] Reland: Refactor dsymutil to separate DWARF ↵Alexey Lapshin2020-01-0810-1048/+193
| | | | | | | | | | | | | | | | | | | | | | optimizing part. #2. Summary: This patch relands D71271. The problem with D71271 is that it has cyclic dependency: CodeGen->AsmPrinter->DebugInfoDWARF->CodeGen. To avoid cyclic dependency this patch puts implementation for DWARFOptimizer into separate library: lib/DWARFLinker. Thus the difference between this patch and D71271 is in that DWARFOptimizer renamed into DWARFLinker and it`s files are put into lib/DWARFLinker. Reviewers: JDevlieghere, friss, dblaikie, aprantl Reviewed By: JDevlieghere Subscribers: thegameg, merge_guards_bot, probinson, mgorny, hiraditya, llvm-commits Tags: #llvm, #debug-info Differential Revision: https://reviews.llvm.org/D71839
* [llvm-symbolizer]Fix printing of malformed address values not passed via stdinXuanda Yang2020-01-081-2/+9
| | | | | | | | | | | | | | | | | | | Summary: relates https://bugs.llvm.org/show_bug.cgi?id=44443 Adding missing newline when printing bad input values. Fix testcase Reviewers: jhenderson Reviewed By: jhenderson Subscribers: rupprecht, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D72313
* [NFC] Use isX86() instead of getArch()Jim Lin2020-01-071-4/+2
| | | | | | | | | | | | | | Summary: This is a clean up for https://reviews.llvm.org/D72247. Reviewers: MaskRay, craig.topper, jhenderson Reviewed By: MaskRay Subscribers: hiraditya, rupprecht, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D72320
* [MC] Add parameter `Address` to MCInstPrinter::printInstFangrui Song2020-01-069-15/+16
| | | | | | | | | | | | | | | | | | | | | | | | printInst prints a branch/call instruction as `b offset` (there are many variants on various targets) instead of `b address`. It is a convention to use address instead of offset in most external symbolizers/disassemblers. This difference makes `llvm-objdump -d` output unsatisfactory. Add `uint64_t Address` to printInst(), so that it can pass the argument to printInstruction(). `raw_ostream &OS` is moved to the last to be consistent with other print* methods. The next step is to pass `Address` to printInstruction() (generated by tablegen from the instruction set description). We can gradually migrate targets to print addresses instead of offsets. In any case, downstream projects which don't know `Address` can pass 0 as the argument. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D72172
* llc/MIR: Fix setFunctionAttributes for MIR functionsMatt Arsenault2020-01-061-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | A random set of attributes are implemented by llc/opt forcing the string attributes on the IR functions before processing anything. This would not happen for MIR functions, which have not yet been created at this point. Use a callback in the MIR parser, purely to avoid dealing with the ugliness that the command line flags are in a .inc file, and would require allowing access to these flags from multiple places (either from the MIR parser directly, or a new utility pass to implement these flags). It would probably be better to cleanup the flag handling into a separate library. This is in preparation for treating more command line flags with a corresponding function attribute in a more uniform way. The fast math flags in particular have a messy system where the command line flag sets the behavior from a function attribute if present, and otherwise the command line flag. This means if any other pass tries to inspect the function attributes directly, it will be inconsistent with the intended behavior. This is also inconsistent with the current behavior of -mcpu and -mattr, which overwrites any pre-existing function attributes. I would like to move this to consistenly have the command line flags not overwrite any pre-existing attributes, and to always ensure the command line flags are consistent with the function attributes.
* [llvm-readelf] Print EI_ABIVERSION as decimal instead of hexadecimalFangrui Song2020-01-061-2/+2
| | | | | | | | This matches GNU readelf and llvm-readobj. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D72234
* [NFC] Fix trivial typos in commentsJames Henderson2020-01-062-3/+3
| | | | | | | | Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D72143 Patch by Kazuaki Ishizaki.
* Re-apply "[Examples] Add IRTransformations directory to examples."Florian Hahn2020-01-042-0/+12
| | | | | | This reverts commit 19fd8925a4afe6efd248688cce06aceff50efe0c. Should include a fix for PR44197.
* [Remarks] Warn if a remark file is not found when processing static archivesFrancis Visoiu Mistrih2020-01-031-3/+33
| | | | | | | | | | | Static archives contain object files which contain sections pointing to external remark files. When static archives are shipped without the remark files, dsymutil shouldn't generate an error. Instead, generate a warning to inform the user that remarks for that library won't be available in the .dSYM.
* [llvm-size] print a blank line between archieve members when using sysv formatTH3CHARLie2020-01-031-4/+2
| | | | | | | | | | | | | | Summary: This patch is related to https://bugs.llvm.org/show_bug.cgi?id=42967 and it fixes llvm-size's sysv format output by adding a blank line between archieve members Reviewers: jhenderson, Jim, MaskRay Reviewed By: jhenderson, Jim, MaskRay Subscribers: MaskRay, Jim, rupprecht, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D71957
* [lli] Add a filter to avoid importing the process's main symbol.Lang Hames2020-01-021-2/+6
| | | | | | | | If JIT'd code fails to define a main function and we import the process's definition then we will end up recursively calling lli's main until we overflow the stack and crash. This filter fixes the issue by ensuring that the process's main function is never imported. This results in lli producing a much friendlier "symbol not found" error when JIT'd code fails to define main.
* Generalize the pass registration mechanism used by Polly to any third-party toolserge_sans_paille2020-01-026-44/+23
| | | | | | | | | | | | | | | | | | | | | | | | There's quite a lot of references to Polly in the LLVM CMake codebase. However the registration pattern used by Polly could be useful to other external projects: thanks to that mechanism it would be possible to develop LLVM extension without touching the LLVM code base. This patch has two effects: 1. Remove all code specific to Polly in the llvm/clang codebase, replaicing it with a generic mechanism 2. Provide a generic mechanism to register compiler extensions. A compiler extension is similar to a pass plugin, with the notable difference that the compiler extension can be configured to be built dynamically (like plugins) or statically (like regular passes). As a result, people willing to add extra passes to clang/opt can do it using a separate code repo, but still have their pass be linked in clang/opt as built-in passes. Differential Revision: https://reviews.llvm.org/D61446
* [llvm-ranlib] Handle -D and -U command line flagAlex Richardson2020-01-021-4/+26
| | | | | | | | | | | | | | I have been trying to build CheriBSD (a fork for FreeBSD for the CHERI CPU) with LLVM binutils instead of the default elftoolchain utilities. I noticed that building static archives was failing because ranlib is invoked with the -D flag. This failed with llvm-ranlib since it parses the -D flag as the archive path and reports an error that more than one archive has been passed. This fixes https://llvm.org/PR41707 Reviewed By: rupprecht Differential Revision: https://reviews.llvm.org/D71554
* [llvm-exegesis] Check counters before runningMiloš Stojanović2019-12-313-8/+18
| | | | | | | Check if the appropriate counters for the specified mode are defined on the target. This is checked before any other work is done. Differential Revision: https://reviews.llvm.org/D71927
* [opt] Fix run-twice crash and detection problemPeter Kokai2019-12-301-4/+9
| | | | | | | | | | | | | 1. Execute `opt -run-twice a.ll` with in a terminal will crash. https://bugs.llvm.org/show_bug.cgi?id=44382 2. `-run-twice` saves output into two buffers and compares them. When outputing the result is disabled, that produces two empty string thus they are going to be equal all the time resulting false-positive results. The proposed solution is to generate the results even if the output will not be emitted, as that is required for the comparision. Differential Revision: https://reviews.llvm.org/D71967
* [llvm-nm] Display STT_GNU_IFUNC as 'i'Fangrui Song2019-12-251-5/+8
| | | | | | Reviewed By: grimar Differential Revision: https://reviews.llvm.org/D71803
* [llvm-readobj] - Remove an excessive helper for printing dynamic tags.Georgii Rymar2019-12-241-81/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This removes the `getTypeString` from readeobj source because it almost duplicates the existent method: `ELFFile<ELFT>::getDynamicTagAsString`. Side effect: now it prints "<unknown:>0xHEXVALUE" instead of "(unknown)" for unknown values. llvm-readelf before this patch printed: ``` 0x0000000012345678 (unknown) 0x8765432187654321 0x000000006abcdef0 (unknown) 0x9988776655443322 0x0000000076543210 (unknown) 0x5555666677778888 ``` and now it prints: ``` 0x0000000012345678 (<unknown:>0x12345678) 0x8765432187654321 0x000000006abcdef0 (<unknown:>0x6abcdef0) 0x9988776655443322 0x0000000076543210 (<unknown:>0x76543210) 0x5555666677778888 ``` GNU reaedlf prints different thing: ``` 0x0000000012345678 (<unknown>: 12345678) 0x8765432187654321 0x000000006abcdef0 (Operating System specific: 6abcdef0) 0x9988776655443322 0x0000000076543210 (Processor Specific: 76543210) 0x5555666677778888 ``` I am not sure we want to follow GNU here. Even if we do, it should be separate patch probably. The new output looks better and closer to GNU anyways, and the code is a bit simpler. Differential revision: https://reviews.llvm.org/D71835
* Add `mlir` to -DLLVM_ALL_PROJECTS CMake optionMehdi Amini2019-12-241-0/+1
|
* [Tools] Fixes -Wrange-loop-analysis warningsMark de Wever2019-12-2211-16/+17
| | | | | | This avoids new warnings due to D68912 adds -Wrange-loop-analysis to -Wall. Differential Revision: https://reviews.llvm.org/D71808
* llvm-objdump should ignore Mach-O stab symbols for disassembly.Michael Trent2019-12-201-2/+31
| | | | | | | | | | | | | | | | | | | | | | | | Summary: llvm-objdump will commonly error out when disassembling a Mach-O binary with stab symbols, or when printing a Mach-O symbol table that includesstab symbols. That is because the Mach-O N_OSO symbol has been modified to include the bottom 8-bit value of the Mach-O's cpusubtype value in the section field. In general, one cannot blindly assume a stab symbol's section field is valid unless one has actually consulted the specification for the specific stab. Since objdump mostly just walks the symbol table to get mnemonics for code disassembly it's best for objdump to just ignore stab symbols. llvm-nm will do a more complete and correct job of displaying Mach-O symbol table contents. Reviewers: pete, lhames, ab, thegameg, jhenderson, MaskRay Reviewed By: thegameg, MaskRay Subscribers: MaskRay, rupprecht, seiya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D71394
* [llvm-symbolizer] Support reading options from environmentPetr Hosek2019-12-201-2/+4
| | | | | | | | | | | | | llvm-symbolizer is used by sanitizers to symbolize errors discovered by sanitizer, but there's no way to pass options to llvm-symbolizer since the tool is invoked directly by the sanitizer runtime. Therefore, we don't have a way to pass options needed to find debug symbols such as -dsym-hint or -debug-file-directory. This change enables reading options from the LLVM_SYMBOLIZER_OPTS in addition to command line which can be used to pass those additional options to llvm-symbolizer invocations made by sanitizer runtime. Differential Revision: https://reviews.llvm.org/D71668
* Temporarily Revert "[Dsymutil][Debuginfo][NFC] Refactor dsymutil to separate ↵Eric Christopher2019-12-199-82/+933
| | | | | | | | | | | DWARF optimizing part 2." as it causes a layering violation/dependency cycle: llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp -> llvm/DebugInfo/DWARF/DWARFExpression.h llvm/include/llvm/DebugInfo/DWARF/DWARFOptimizer.h -> llvm/CodeGen/NonRelocatableStringpool.h This reverts commit abc7f6800df8a1f40e1e2c9ccce826abb0208284.
* [Dsymutil][Debuginfo][NFC] Refactor dsymutil to separate DWARF optimizing ↵Alexey Lapshin2019-12-199-933/+82
| | | | | | | | | | | part 2. That patch is extracted from the D70709. It moves CompileUnit, DeclContext into llvm/DebugInfo/DWARF. It also adds new file DWARFOptimizer with AddressesMap class. AddressesMap generalizes functionality from RelocationManager. Differential Revision: https://reviews.llvm.org/D71271
* [llvm-exegesis][NFC] internal changesGuillaume Chatelet2019-12-189-94/+148
| | | | | | | | | | | | | | Summary: BitVectors are now cached to lower memory utilization. Instructions have reference semantics. Reviewers: courbet Subscribers: sdardis, tschuett, jrtc27, atanasyan, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D71653
* [llvm-readob] - Refactor printing of sections flags. NFCI.Georgii Rymar2019-12-181-50/+54
| | | | | | | | This is a natural clean-up after D71462/D71464. It allows to define known section letters used for GNU style in one place. Differential revision: https://reviews.llvm.org/D71591
* [llvm-readelf] - Change letters used for SHF_ARM_PURECODE and ↵Georgii Rymar2019-12-181-10/+27
| | | | | | | | | | | | SHF_X86_64_LARGE flags. GNU uses `l` for SHF_X86_64_LARGE and `y` for SHF_ARM_PURECODE. Lets follow. To do this I had to refactor and refine how we print the help flags description. It was too generic and inconsistent with GNU readelf. Differential revision: https://reviews.llvm.org/D71464
* [llvm-readelf][llvm-readobj] - Reimplement the logic of section flags dumping.Georgii Rymar2019-12-181-27/+42
| | | | | | | | | | | | | | | | | Our logic that dumped the flags was buggy. For LLVM style it dumped SHF_MASKPROC/SHF_MASKOS named constants, though they are not flags, but masks. For GNU style it was just very inconsistent with GNU which has logic that is not straightforward. Imagine we have sh_flags == 0x90000000. SHF_EXCLUDE ("E") has a value of 0x80000000 and SHF_MASKPROC is 0xf0000000. GNU readelf will not print "E" or "Ep" in this case, but will print just "p". It only will print "E" when no other processor flag is set. I had to investigate the GNU source to find the algorithm and now our logic should match it. Differential revision: https://reviews.llvm.org/D71462
* llvm-diff: Perform structural comparison on GlobalVariables, if possibleDominic Chen2019-12-171-0/+9
| | | | | | | | | | Summary: Names of GlobalVariables may not be preserved depending on compilation options, so prefer a structural diff Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D71582
* [llvm-cxxfilt] Correctly demangle COFF import thunkSteven Wu2019-12-161-5/+6
| | | | | | | | | | | | | | | | | | | | Summary: llvm-cxxfilt wasn't correctly demangle COFF import thunk in those two cases before: * demangle in split mode (multiple words from commandline) * the import thunk prefix was added no matter the later part of the string can be demangled or not Now llvm-cxxfilt should handle both case correctly. Reviewers: compnerd, erik.pilkington, jhenderson Reviewed By: jhenderson Subscribers: jkorous, dexonsmith, ributzka, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D71425
* [Bugpoint] Do not create illegal function attribute combosDavid Greene2019-12-161-0/+5
| | | | | | | If a function requires optnone to trigger a crash, it must also have noline, otherwise it will fail a verifier check. Differential revision: https://reviews.llvm.org/D69522
* [llvm-exegesis] Set up AsmTargetStreamer in readSnippetsGuillaume Chatelet2019-12-161-0/+16
| | | | | | | | | | | | Summary: This is a follow up on D71137 properly setting up the AsmTargetStreamer prior to AsmParser::Run call. Reviewers: courbet, mstojanovic Subscribers: tschuett, mikhail.ramalho, llvm-commits, petarj, atanasyan Tags: #llvm Differential Revision: https://reviews.llvm.org/D71468
* [llvm-objcopy][ELF] -O binary: use LMA instead of sh_offset to decide where ↵Fangrui Song2019-12-151-23/+13
| | | | | | | | | | | | | | | | | | | | | | | to write section contents .text sh_address=0x1000 sh_offset=0x1000 .data sh_address=0x3000 sh_offset=0x2000 In an objcopy -O binary output, the distance between two sections equal their LMA differences (0x3000-0x1000), instead of their sh_offset differences (0x2000-0x1000). This patch changes our behavior to match GNU. This rule gets more complex when the containing PT_LOAD has p_vaddr!=p_paddr. GNU objcopy essentially computes sh_offset-p_offset+p_paddr for each candidate section, and removes the gap before the first address. Added tests to binary-paddr.test to catch the compatibility problem. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D71035
OpenPOWER on IntegriCloud