diff options
author | Alex Brachet <abrachet@google.com> | 2023-01-30 19:27:18 +0000 |
---|---|---|
committer | Alex Brachet <abrachet@google.com> | 2023-01-30 19:27:18 +0000 |
commit | 6d9b0759c24e93c2ef1f10ca59c7317c7b440468 (patch) | |
tree | 0036cfc15513a71b2b4fcf98c915fc2847f17e5b /llvm/lib/MC/MCStreamer.cpp | |
parent | 155e0cf5dc2ffba0a509b1dea25fb4c31eeb367e (diff) | |
download | llvm-6d9b0759c24e93c2ef1f10ca59c7317c7b440468.zip llvm-6d9b0759c24e93c2ef1f10ca59c7317c7b440468.tar.gz llvm-6d9b0759c24e93c2ef1f10ca59c7317c7b440468.tar.bz2 |
[MC] Allow .pushsection between .cfi_startproc/.cfi_endproc
This follows the behavior of gnu assemblers. This is useful when
writing inline assembly.
Differential Revision: https://reviews.llvm.org/D141893
Diffstat (limited to 'llvm/lib/MC/MCStreamer.cpp')
-rw-r--r-- | llvm/lib/MC/MCStreamer.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/MC/MCStreamer.cpp b/llvm/lib/MC/MCStreamer.cpp index 5671107..517e258 100644 --- a/llvm/lib/MC/MCStreamer.cpp +++ b/llvm/lib/MC/MCStreamer.cpp @@ -278,7 +278,7 @@ MCSymbol *MCStreamer::getDwarfLineTableSymbol(unsigned CUID) { } bool MCStreamer::hasUnfinishedDwarfFrameInfo() { - return !DwarfFrameInfos.empty() && !DwarfFrameInfos.back().End; + return !FrameInfoStack.empty(); } MCDwarfFrameInfo *MCStreamer::getCurrentDwarfFrameInfo() { @@ -288,7 +288,7 @@ MCDwarfFrameInfo *MCStreamer::getCurrentDwarfFrameInfo() { ".cfi_startproc and .cfi_endproc directives"); return nullptr; } - return &DwarfFrameInfos.back(); + return &DwarfFrameInfos[FrameInfoStack.back().first]; } bool MCStreamer::emitCVFileDirective(unsigned FileNo, StringRef Filename, @@ -445,7 +445,8 @@ void MCStreamer::emitConditionalAssignment(MCSymbol *Symbol, void MCStreamer::emitCFISections(bool EH, bool Debug) {} void MCStreamer::emitCFIStartProc(bool IsSimple, SMLoc Loc) { - if (hasUnfinishedDwarfFrameInfo()) + if (!FrameInfoStack.empty() && + getCurrentSectionOnly() == FrameInfoStack.back().second) return getContext().reportError( Loc, "starting new .cfi frame before finishing the previous one"); @@ -464,6 +465,7 @@ void MCStreamer::emitCFIStartProc(bool IsSimple, SMLoc Loc) { } } + FrameInfoStack.emplace_back(DwarfFrameInfos.size(), getCurrentSectionOnly()); DwarfFrameInfos.push_back(Frame); } @@ -475,6 +477,7 @@ void MCStreamer::emitCFIEndProc() { if (!CurFrame) return; emitCFIEndProcImpl(*CurFrame); + FrameInfoStack.pop_back(); } void MCStreamer::emitCFIEndProcImpl(MCDwarfFrameInfo &Frame) { |