diff options
author | Reid Kleckner <rnk@google.com> | 2016-05-02 23:22:18 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2016-05-02 23:22:18 +0000 |
commit | 7f90dd23539d7e18d826451605cceb142ea15575 (patch) | |
tree | 9744625aa268b3713c72de66ffd05b171712fe3a /lib/MC/MCWin64EH.cpp | |
parent | cde8f4fdcc39b26ab2b63b63bf876fa4e72d394c (diff) |
[MC] Create unique .pdata sections for every .text section
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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268331 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCWin64EH.cpp')
-rw-r--r-- | lib/MC/MCWin64EH.cpp | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/lib/MC/MCWin64EH.cpp b/lib/MC/MCWin64EH.cpp index 1b73b7afb6a..fdc4c10cd6c 100644 --- a/lib/MC/MCWin64EH.cpp +++ b/lib/MC/MCWin64EH.cpp @@ -17,7 +17,7 @@ #include "llvm/MC/MCSymbol.h" #include "llvm/Support/Win64EH.h" -namespace llvm { +using namespace llvm; // NOTE: All relocations generated here are 4-byte image-relative. @@ -218,35 +218,29 @@ static void EmitUnwindInfo(MCStreamer &streamer, WinEH::FrameInfo *info) { } } -namespace Win64EH { -void UnwindEmitter::Emit(MCStreamer &Streamer) const { - MCContext &Context = Streamer.getContext(); - +void llvm::Win64EH::UnwindEmitter::Emit(MCStreamer &Streamer) const { // Emit the unwind info structs first. - for (const auto &CFI : Streamer.getWinFrameInfos()) { - MCSection *XData = getXDataSection(CFI->Function, Context); + for (WinEH::FrameInfo *CFI : Streamer.getWinFrameInfos()) { + MCSection *XData = Streamer.getAssociatedXDataSection(CFI->TextSection); Streamer.SwitchSection(XData); - EmitUnwindInfo(Streamer, CFI); + ::EmitUnwindInfo(Streamer, CFI); } // Now emit RUNTIME_FUNCTION entries. - for (const auto &CFI : Streamer.getWinFrameInfos()) { - MCSection *PData = getPDataSection(CFI->Function, Context); + for (WinEH::FrameInfo *CFI : Streamer.getWinFrameInfos()) { + MCSection *PData = Streamer.getAssociatedPDataSection(CFI->TextSection); Streamer.SwitchSection(PData); EmitRuntimeFunction(Streamer, CFI); } } -void UnwindEmitter::EmitUnwindInfo(MCStreamer &Streamer, - WinEH::FrameInfo *info) const { +void llvm::Win64EH::UnwindEmitter::EmitUnwindInfo( + MCStreamer &Streamer, WinEH::FrameInfo *info) const { // Switch sections (the static function above is meant to be called from // here and from Emit(). - MCContext &context = Streamer.getContext(); - MCSection *xdataSect = getXDataSection(info->Function, context); - Streamer.SwitchSection(xdataSect); + MCSection *XData = Streamer.getAssociatedXDataSection(info->TextSection); + Streamer.SwitchSection(XData); - llvm::EmitUnwindInfo(Streamer, info); -} + ::EmitUnwindInfo(Streamer, info); } -} // End of namespace llvm |