aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCWin64EH.cpp
AgeCommit message (Collapse)AuthorFilesLines
2016-05-02[MC] Create unique .pdata sections for every .text sectionReid Kleckner1-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
2015-06-23Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC)Alexander Kornienko1-1/+1
Apparently, the style needs to be agreed upon first. llvm-svn: 240390
2015-06-19Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko1-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
2015-05-30MC: Clean up MCExpr naming. NFC.Jim Grosbach1-9/+9
llvm-svn: 238634
2015-05-21Move alignment from MCSectionData to MCSection.Rafael Espindola1-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
2015-05-18MC: Clean up method names in MCContext.Jim Grosbach1-1/+1
The naming was a mish-mash of old and new style. Update to be consistent with the new. NFC. llvm-svn: 237594
2014-09-04MC Win64: Put unwind info for COMDAT code into the same COMDAT groupReid Kleckner1-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
2014-08-15EmitAbsValue is the same as EmitValue on non-darwin. NFC.Rafael Espindola1-1/+1
llvm-svn: 215688
2014-08-07MC: split Win64EHUnwindEmitter into a shared streamerSaleem Abdulrasool1-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
2014-08-03MC: rename Win64EHFrameInfo to WinEH::FrameInfoSaleem Abdulrasool1-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
2014-07-17MC: make WinEH opcode an opaque valueSaleem Abdulrasool1-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
2014-07-13MC: make MCWin64EHInstruction a POD-like structSaleem Abdulrasool1-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
2014-07-13MC: make helper function be more const-correctSaleem Abdulrasool1-10/+7
Introduce const-ness on parameters, they are used as read-only and should not be modified. NFC. llvm-svn: 212913
2014-07-13MC: make DWARF and Windows unwinding handling more similarSaleem Abdulrasool1-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
2014-07-12MC: rename MCW64UnwindInfo to MCWinFrameInfoSaleem Abdulrasool1-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
2014-07-10MC: modernise for loopSaleem Abdulrasool1-13/+9
Convert a for loop to range bsaed form. NFC. llvm-svn: 212684
2014-07-10MC: add and use an accessor for WinCFISaleem Abdulrasool1-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
2013-09-15Fix alignment of unwind data.Kai Nacke1-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
2013-09-15Generate IMAGE_REL_AMD64_ADDR32NB relocations for SEHKai Nacke1-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
2013-08-27Fix wrong code offset for unwind code SET_FPREG.Kai Nacke1-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
2013-07-08Revert: Fix wrong code offset for unwind code SET_FPREG.Kai Nacke1-2/+3
llvm-svn: 185793
2013-07-08Revert: Generate IMAGE_REL_AMD64_ADDR32NB relocations for SEH data structures.Kai Nacke1-21/+5
llvm-svn: 185791
2013-07-08Revert: Fix alignment of unwind data.Kai Nacke1-12/+7
llvm-svn: 185790
2013-07-06Fix alignment of unwind data.Kai Nacke1-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
2013-07-06Generate IMAGE_REL_AMD64_ADDR32NB relocations for SEHKai Nacke1-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
2013-07-06Fix wrong code offset for unwind code SET_FPREG.Kai Nacke1-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
2012-12-03Use the new script to sort the includes of every file under lib.Chandler Carruth1-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
2012-08-08Fix for .pdata and .xdata section attributes on COFF.Anton Korobeynikov1-4/+2
Patch by kai@redstar.de ! llvm-svn: 161487
2011-07-20Add MCObjectFileInfo and sink the MCSections initialization code fromEvan Cheng1-6/+28
TargetLoweringObjectFileImpl down to MCObjectFileInfo. TargetAsmInfo is done to one last method. It's *almost* gone! llvm-svn: 135569
2011-07-15Move some parts of TargetAsmInfo down to MCAsmInfo. This is not the greatestEvan Cheng1-5/+5
solution but it is a small step towards removing the horror that is TargetAsmInfo. llvm-svn: 135237
2011-05-27Add a parameter to the Win64 EH section getters to get a section with aCharles Davis1-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
2011-05-27Assorted fixes for Win64 EH unwind info emission:Charles Davis1-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
2011-05-27Start keeping track of where the various unwind instructions are in the prolog.Charles Davis1-16/+23
Use them to calculate the offset inside the prolog. Emit this value when emitting the unwind codes. llvm-svn: 132177
2011-05-27Add missing break statements. Align UNWIND_INFO and RUNTIME_FUNCTION structsCharles Davis1-0/+6
to 4 bytes. I'm surprised no one caught the missing break statements. llvm-svn: 132176
2011-05-22Implement emission of all Win64 exception tables. Make the COFF streamer emitCharles Davis1-1/+16
these tables. llvm-svn: 131833
2011-05-22Make the COFF streamer emit unwind info when processing a .seh_handlerdataCharles Davis1-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