summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCWin64EH.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [AArch64][Windows] Compute function length correctly in unwind tables.Eli Friedman2019-05-031-6/+43
| | | | | | | | | | | | | | | | | | | | | | The primary fix here is to WinException.cpp: we need to exclude jump tables when computing the length of a function, or else we fail to correctly compute the length. (We can only compute the number of bytes consumed by certain assembler directives after the entire file is parsed. ".p2align" is one of those directives, and is used by jump table generation.) The secondary fix, to MCWin64EH, is to make sure we don't silently miscompile if we hit a similar situation in the future. It's possible we could extend ARM64EmitUnwindInfo so it allows function bodies that contain assembler directives, but that's a lot more complicated; see the FIXME in MCWin64EH.cpp. Fixes https://bugs.llvm.org/show_bug.cgi?id=41581 . Differential Revision: https://reviews.llvm.org/D61095 llvm-svn: 359849
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Fix the buildbot issue introduced by r351421Sanjin Sijaric2019-01-181-1/+1
| | | | | | | The EXPENSIVE_CHECK x86_64 Windows buildbot is failing due to this change. Fix the map access. llvm-svn: 351577
* [MC] Remove unused variableBenjamin Kramer2019-01-171-1/+0
| | | | llvm-svn: 351426
* [ARM64][Windows] Share unwind codes between epiloguesSanjin Sijaric2019-01-171-2/+51
| | | | | | | | | | | | | | There are cases where we have multiple epilogues that have the exact same unwind code sequence. In that case, the epilogues can share the same unwind codes in the .xdata section. This should get us past the assert "SEH unwind data splitting not yet implemented" in many cases. We still need to add support for generating multiple .pdata/.xdata sections for those functions that need to be split into fragments. Differential Revision: https://reviews.llvm.org/D56813 llvm-svn: 351421
* [AArch64] Avoid crashing on .seh directives in assemblyMartin Storsjo2018-12-181-4/+4
| | | | | | Differential Revision: https://reviews.llvm.org/D55670 llvm-svn: 349549
* [ARM64] [Windows] Improve error reporting for unsupported SEH unwind.Eli Friedman2018-11-081-2/+7
| | | | | | | | Use report_fatal_error instead of crashing or miscompiling. (It's currently easier than it should be to hit this case because we don't reuse codes across epilogs.) llvm-svn: 346440
* [ARM64][Windows] MCLayer support for exception handlingSanjin Sijaric2018-10-271-0/+347
| | | | | | | | | | Add ARM64 unwind codes to MCLayer, as well SEH directives that will be emitted by the frame lowering patch to follow. We only emit unwind codes into object object files for now. Differential Revision: https://reviews.llvm.org/D50166 llvm-svn: 345450
* Remove redundant includes from lib/MC.Michael Zolotukhin2017-12-131-2/+0
| | | | llvm-svn: 320624
* [MC] Use unique_ptr to manage WinFrameInfos, NFCReid Kleckner2017-10-061-4/+4
| | | | | | | | The FrameInfo cannot be stored directly in the vector because chained frames may refer to parent frames, so we need pointers that are stable across a vector resize. llvm-svn: 315080
* [MC] Create unique .pdata sections for every .text sectionReid Kleckner2016-05-021-18/+12
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This adds a unique ID to the COFF section uniquing map, similar to the one we have for ELF. The unique id is not currently exposed via the assembler because we don't have a use case for it yet. Users generally create .pdata with the .seh_* family of directives, and the assembler internally needs to produce .pdata and .xdata sections corresponding to the code section. The association between .text sections and the assembler-created .xdata and .pdata sections is maintained as an ID field of MCSectionCOFF. The CFI-related sections are created with the given unique ID, so if more code is added to the same text section, we can find and reuse the CFI sections that were already created. Reviewers: majnemer, rafael Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D19376 llvm-svn: 268331
* Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC)Alexander Kornienko2015-06-231-1/+1
| | | | | | Apparently, the style needs to be agreed upon first. llvm-svn: 240390
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-191-1/+1
| | | | | | | | | | | | | The patch is generated using this command: tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ llvm/lib/ Thanks to Eugene Kosov for the original patch! llvm-svn: 240137
* MC: Clean up MCExpr naming. NFC.Jim Grosbach2015-05-301-9/+9
| | | | llvm-svn: 238634
* Move alignment from MCSectionData to MCSection.Rafael Espindola2015-05-211-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | This starts merging MCSection and MCSectionData. There are a few issues with the current split between MCSection and MCSectionData. * It optimizes the the not as important case. We want the production of .o files to be really fast, but the split puts the information used for .o emission in a separate data structure. * The ELF/COFF/MachO hierarchy is not represented in MCSectionData, leading to some ad-hoc ways to represent the various flags. * It makes it harder to remember where each item is. The attached patch starts merging the two by moving the alignment from MCSectionData to MCSection. Most of the patch is actually just dropping 'const', since MCSectionData is mutable, but MCSection was not. llvm-svn: 237936
* MC: Clean up method names in MCContext.Jim Grosbach2015-05-181-1/+1
| | | | | | | The naming was a mish-mash of old and new style. Update to be consistent with the new. NFC. llvm-svn: 237594
* MC Win64: Put unwind info for COMDAT code into the same COMDAT groupReid Kleckner2014-09-041-3/+3
| | | | | | | | | | | | | | | | | Summary: This fixes a long standing issue where we would emit many little .text sections and only one .pdata and .xdata section. Now we generate one .pdata / .xdata pair per .text section and associate them correctly. Fixes PR19667. Reviewers: majnemer Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D5181 llvm-svn: 217176
* EmitAbsValue is the same as EmitValue on non-darwin. NFC.Rafael Espindola2014-08-151-1/+1
| | | | llvm-svn: 215688
* MC: split Win64EHUnwindEmitter into a shared streamerSaleem Abdulrasool2014-08-071-55/+16
| | | | | | | | | | This changes Win64EHEmitter into a utility WinEH UnwindEmitter that can be shared across multiple architectures and a target specific bit which is overridden (Win64::UnwindEmitter). This enables sharing the section selection code across X86 and the intended use in ARM for emitting unwind information for Windows on ARM. llvm-svn: 215050
* MC: rename Win64EHFrameInfo to WinEH::FrameInfoSaleem Abdulrasool2014-08-031-7/+10
| | | | | | | | | | | | | | The frame information stored in this structure is driven by the requirements for Windows NT unwinding rather than Windows 64 specifically. As a result, this type can be shared across multiple architectures (ARM, AXP, MIPS, PPC, SH). Rename this class in preparation for adding support for supporting unwinding information for Windows on ARM. Take the opportunity to constify the members as everything except the ChainedParent is read-only. This required some adjustment to the label handling. llvm-svn: 214663
* MC: make WinEH opcode an opaque valueSaleem Abdulrasool2014-07-171-6/+7
| | | | | | | | | | | This makes the opcode an opaque value (unsigned int) rather than the enumeration. This permits the use of target specific operands. Split out the generic type into a MCWinEH header and add a supporting MCWin64EH::Instruction to abstract out the selection of the opcode and construction of the actual instruction. llvm-svn: 213221
* MC: make MCWin64EHInstruction a POD-like structSaleem Abdulrasool2014-07-131-29/+28
| | | | | | | | | | | | | | | | This is the first of a number of changes designed to generalise MCWin64EHInstruction to support different target architectures. An ordered set (vector) of these instructions is saved per frame to permit the emission of information for Windows NT style unwinding. The only bit of information which is actually target specific here is the Opcode for the unwinding bytecode. The remainder of the information is simply generic information that is relevant to the Windows NT unwinding model. Remove the accessors for the fields, making them const and public instead. Sink the knowledge of the alias'ed name into the single source and sink a single-use check method into the use. llvm-svn: 212914
* MC: make helper function be more const-correctSaleem Abdulrasool2014-07-131-10/+7
| | | | | | | Introduce const-ness on parameters, they are used as read-only and should not be modified. NFC. llvm-svn: 212913
* MC: make DWARF and Windows unwinding handling more similarSaleem Abdulrasool2014-07-131-2/+2
| | | | | | | | Rename member variables and functions for the MCStreamer for DWARF-like unwinding management. Rename the Windows ones as well and make the naming and handling similar across the two. No functional change intended. llvm-svn: 212912
* MC: rename MCW64UnwindInfo to MCWinFrameInfoSaleem Abdulrasool2014-07-121-3/+3
| | | | | | | | This structure contains information related to the call frame used to generate unwinding information. Rename this to reflect the future use to represent the shared state between various architectures for WinCFI information. llvm-svn: 212881
* MC: modernise for loopSaleem Abdulrasool2014-07-101-13/+9
| | | | | | Convert a for loop to range bsaed form. NFC. llvm-svn: 212684
* MC: add and use an accessor for WinCFISaleem Abdulrasool2014-07-101-14/+14
| | | | | | | | | | This adds a utility method to access the WinCFI information in bulk and uses that to iterate rather than requesting the count and individually iterating them. This is in preparation for restructuring WinCFI handling to enable more clear sharing across architectures to enable unwind information emission for Windows on ARM. llvm-svn: 212683
* Fix alignment of unwind data.Kai Nacke2013-09-151-7/+12
| | | | | | | | | | | For alignment purposes, the instruction array will always have an even number of entries, with the final entry potentially unused (in which case the array will be one longer than indicated by the count of unwind codes field). Reviewed by Anton Korobeynikov, Charles Davis and Nico Rieck. llvm-svn: 190767
* Generate IMAGE_REL_AMD64_ADDR32NB relocations for SEHKai Nacke2013-09-151-5/+21
| | | | | | | | | | | | | | data structures. The Win64 EH data structures must be of type IMAGE_REL_AMD64_ADDR32NB instead of IMAGE_REL_AMD64_ADDR32. This is easiely achieved by adding the VK_COFF_IMGREL32 modifier to the symbol reference. Change also references to start and end of the SEH range of a function as offsets to start of the function. Reviewed by Jim Grosbach, Charles Davis and Nico Rieck. llvm-svn: 190766
* Fix wrong code offset for unwind code SET_FPREG.Kai Nacke2013-08-271-3/+2
| | | | | | | | | | | | The code offset for unwind code SET_FPREG is wrong because it is set to constant 0. The fix is to do the same as for the other unwind codes: emit a label and later the absolute difference between the label and the begin of the prologue. Also enables the failing test case MC/COFF/seh.s Reviewed by Jim Grosbach, Charles Davis and Nico Rieck. llvm-svn: 189309
* Revert: Fix wrong code offset for unwind code SET_FPREG.Kai Nacke2013-07-081-2/+3
| | | | llvm-svn: 185793
* Revert: Generate IMAGE_REL_AMD64_ADDR32NB relocations for SEH data structures.Kai Nacke2013-07-081-21/+5
| | | | llvm-svn: 185791
* Revert: Fix alignment of unwind data.Kai Nacke2013-07-081-12/+7
| | | | llvm-svn: 185790
* Fix alignment of unwind data.Kai Nacke2013-07-061-7/+12
| | | | | | | | | | | For alignment purposes, the instruction array will always have an even number of entries, with the final entry potentially unused (in which case the array will be one longer than indicated by the count of unwind codes field). Reviewed by Charles Davis and Nico Rieck. llvm-svn: 185760
* Generate IMAGE_REL_AMD64_ADDR32NB relocations for SEHKai Nacke2013-07-061-5/+21
| | | | | | | | | | | | | | data structures. The Win64 EH data structures must be of type IMAGE_REL_AMD64_ADDR32NB instead of IMAGE_REL_AMD64_ADDR32. This is easiely achieved by adding the VK_COFF_IMGREL32 modifier to the symbol reference. Change also references to start and end of the SEH range of a function as offsets to start of the function. Reviewed by Charles Davis and Nico Rieck. llvm-svn: 185759
* Fix wrong code offset for unwind code SET_FPREG.Kai Nacke2013-07-061-3/+2
| | | | | | | | | | | | The code offset for unwind code SET_FPREG is wrong because it is set to constant 0. The fix is to do the same as for the other unwind codes: emit a label and later the absolute difference between the label and the begin of the prologue. Also enables the failing test case MC/COFF/seh.s Reviewed by Charles Davis and Nico Rieck. llvm-svn: 185758
* Use the new script to sort the includes of every file under lib.Chandler Carruth2012-12-031-4/+4
| | | | | | | | | | | | | | | | | Sooooo many of these had incorrect or strange main module includes. I have manually inspected all of these, and fixed the main module include to be the nearest plausible thing I could find. If you own or care about any of these source files, I encourage you to take some time and check that these edits were sensible. I can't have broken anything (I strictly added headers, and reordered them, never removed), but they may not be the headers you'd really like to identify as containing the API being implemented. Many forward declarations and missing includes were added to a header files to allow them to parse cleanly when included first. The main module rule does in fact have its merits. =] llvm-svn: 169131
* Fix for .pdata and .xdata section attributes on COFF.Anton Korobeynikov2012-08-081-4/+2
| | | | | | Patch by kai@redstar.de ! llvm-svn: 161487
* Add MCObjectFileInfo and sink the MCSections initialization code fromEvan Cheng2011-07-201-6/+28
| | | | | | | | TargetLoweringObjectFileImpl down to MCObjectFileInfo. TargetAsmInfo is done to one last method. It's *almost* gone! llvm-svn: 135569
* Move some parts of TargetAsmInfo down to MCAsmInfo. This is not the greatestEvan Cheng2011-07-151-5/+5
| | | | | | | solution but it is a small step towards removing the horror that is TargetAsmInfo. llvm-svn: 135237
* Add a parameter to the Win64 EH section getters to get a section with aCharles Davis2011-05-271-9/+37
| | | | | | | | | | suffix (e.g. .xdata$myfunc). The suffix part isn't implemented yet, but I'll get to it in the next patch. Fix up all callers of the affected functions. Make them pass said suffix to the function. llvm-svn: 132205
* Assorted fixes for Win64 EH unwind info emission:Charles Davis2011-05-271-16/+29
| | | | | | | | | | - Flip order of bitfields. This gets our output matching GAS. - Handle case where the end of the prolog wasn't specified. - If the resulting unwind info struct is less than 8 bytes, pad to 8 bytes. Add a test for the latter two. llvm-svn: 132188
* Start keeping track of where the various unwind instructions are in the prolog.Charles Davis2011-05-271-16/+23
| | | | | | | Use them to calculate the offset inside the prolog. Emit this value when emitting the unwind codes. llvm-svn: 132177
* Add missing break statements. Align UNWIND_INFO and RUNTIME_FUNCTION structsCharles Davis2011-05-271-0/+6
| | | | | | | | to 4 bytes. I'm surprised no one caught the missing break statements. llvm-svn: 132176
* Implement emission of all Win64 exception tables. Make the COFF streamer emitCharles Davis2011-05-221-1/+16
| | | | | | these tables. llvm-svn: 131833
* Make the COFF streamer emit unwind info when processing a .seh_handlerdataCharles Davis2011-05-221-0/+189
directive. Implement emission of Win64 EH unwind info. Pull in <cassert> in MCWin64EH.h so it can use the assert() macro. llvm-svn: 131832
OpenPOWER on IntegriCloud