[MC,COFF] .safeseh: avoid changeSection (#132624)
The directive temporarily switches to the .sxdata section to emit data, and then calls `insert`, which makes `CurFrag` out of sync of the current section. Call push/switch/pop instead. Related to #132464 (cherry picked from commit ece72e2731350d9840c6446db9276b04d593cc23)
This commit is contained in:
parent
943b43250b
commit
5ba1949728
@ -299,7 +299,8 @@ void MCWinCOFFStreamer::emitCOFFSafeSEH(MCSymbol const *Symbol) {
|
||||
return;
|
||||
|
||||
MCSection *SXData = getContext().getObjectFileInfo()->getSXDataSection();
|
||||
changeSection(SXData);
|
||||
pushSection();
|
||||
switchSection(SXData);
|
||||
SXData->ensureMinAlignment(Align(4));
|
||||
|
||||
insert(getContext().allocFragment<MCSymbolIdFragment>(Symbol));
|
||||
@ -310,6 +311,7 @@ void MCWinCOFFStreamer::emitCOFFSafeSEH(MCSymbol const *Symbol) {
|
||||
// function. Go ahead and oblige it here.
|
||||
CSymbol->setType(COFF::IMAGE_SYM_DTYPE_FUNCTION
|
||||
<< COFF::SCT_COMPLEX_TYPE_SHIFT);
|
||||
popSection();
|
||||
}
|
||||
|
||||
void MCWinCOFFStreamer::emitCOFFSymbolIndex(MCSymbol const *Symbol) {
|
||||
|
@ -1,4 +1,5 @@
|
||||
; RUN: llc -mtriple=i686-pc-windows-msvc < %s | FileCheck %s
|
||||
; RUN: llc -mtriple=i686-pc-windows-msvc -filetype=obj < %s -o %t
|
||||
|
||||
declare void @may_throw_or_crash()
|
||||
declare i32 @_except_handler3(...)
|
||||
@ -208,6 +209,14 @@ catch:
|
||||
; CHECK-NEXT: .long 0
|
||||
; CHECK-NEXT: .long 1
|
||||
|
||||
; CHECK-LABEL: inlineasm:
|
||||
; CHECK: .safeseh my_handler
|
||||
define i32 @inlineasm() {
|
||||
entry:
|
||||
call void asm sideeffect ".safeseh my_handler", "~{dirflag},~{fpsr},~{flags}"()
|
||||
ret i32 0
|
||||
}
|
||||
|
||||
; CHECK-LABEL: ___ehhandler$use_CxxFrameHandler3:
|
||||
; CHECK: movl $L__ehtable$use_CxxFrameHandler3, %eax
|
||||
; CHECK-NEXT: jmp ___CxxFrameHandler3 # TAILCALL
|
||||
|
Loading…
x
Reference in New Issue
Block a user