1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00

Test .seh_startchained and .seh_endchained parsing.

Rework how the MCWin64EHUnwindInfo instances are stored. Fix issues with
chained unwind areas exposed by the test that were related to this.

The ChainedParent field had the wrong address, because when the chained unwind
info was added, the addresses shifted around. Now we store the pointers to the
structures, which are now allocated from the MC heap.

llvm-svn: 132106
This commit is contained in:
Charles Davis 2011-05-26 02:45:47 +00:00
parent e704bfb21e
commit 0021487a8e
3 changed files with 18 additions and 15 deletions

View File

@ -58,7 +58,7 @@ namespace llvm {
MCDwarfFrameInfo *getCurrentFrameInfo();
void EnsureValidFrame();
std::vector<MCWin64EHUnwindInfo> W64UnwindInfos;
std::vector<MCWin64EHUnwindInfo *> W64UnwindInfos;
MCWin64EHUnwindInfo *CurrentW64UnwindInfo;
void setCurrentW64UnwindInfo(MCWin64EHUnwindInfo *Frame);
void EnsureValidW64UnwindInfo();
@ -101,7 +101,7 @@ namespace llvm {
}
MCWin64EHUnwindInfo &getW64UnwindInfo(unsigned i) {
return W64UnwindInfos[i];
return *W64UnwindInfos[i];
}
/// @name Assembly File Formatting.

View File

@ -307,8 +307,8 @@ void MCStreamer::EmitCFISameValue(int64_t Register) {
}
void MCStreamer::setCurrentW64UnwindInfo(MCWin64EHUnwindInfo *Frame) {
W64UnwindInfos.push_back(*Frame);
CurrentW64UnwindInfo = &W64UnwindInfos.back();
W64UnwindInfos.push_back(Frame);
CurrentW64UnwindInfo = W64UnwindInfos.back();
}
void MCStreamer::EnsureValidW64UnwindInfo() {
@ -321,11 +321,11 @@ void MCStreamer::EmitWin64EHStartProc(const MCSymbol *Symbol) {
MCWin64EHUnwindInfo *CurFrame = CurrentW64UnwindInfo;
if (CurFrame && !CurFrame->End)
report_fatal_error("Starting a function before ending the previous one!");
MCWin64EHUnwindInfo Frame;
Frame.Begin = getContext().CreateTempSymbol();
Frame.Function = Symbol;
EmitLabel(Frame.Begin);
setCurrentW64UnwindInfo(&Frame);
MCWin64EHUnwindInfo *Frame = new (getContext()) MCWin64EHUnwindInfo;
Frame->Begin = getContext().CreateTempSymbol();
Frame->Function = Symbol;
EmitLabel(Frame->Begin);
setCurrentW64UnwindInfo(Frame);
}
void MCStreamer::EmitWin64EHEndProc() {
@ -339,13 +339,13 @@ void MCStreamer::EmitWin64EHEndProc() {
void MCStreamer::EmitWin64EHStartChained() {
EnsureValidW64UnwindInfo();
MCWin64EHUnwindInfo Frame;
MCWin64EHUnwindInfo *Frame = new (getContext()) MCWin64EHUnwindInfo;
MCWin64EHUnwindInfo *CurFrame = CurrentW64UnwindInfo;
Frame.Begin = getContext().CreateTempSymbol();
Frame.Function = CurFrame->Function;
Frame.ChainedParent = CurFrame;
EmitLabel(Frame.Begin);
setCurrentW64UnwindInfo(&Frame);
Frame->Begin = getContext().CreateTempSymbol();
Frame->Function = CurFrame->Function;
Frame->ChainedParent = CurFrame;
EmitLabel(Frame->Begin);
setCurrentW64UnwindInfo(Frame);
}
void MCStreamer::EmitWin64EHEndChained() {

View File

@ -35,6 +35,9 @@ func:
.seh_handlerdata
.long 0
.text
.seh_startchained
.seh_endprologue
.seh_endchained
lea (%rbx), %rsp
pop %rbx
addq $24, %rsp