diff options
| author | Kai Nacke <kai.nacke@redstar.de> | 2013-08-27 04:16:16 +0000 |
|---|---|---|
| committer | Kai Nacke <kai.nacke@redstar.de> | 2013-08-27 04:16:16 +0000 |
| commit | 1b7e4866f41c360b85cfe74d419084550166ec7b (patch) | |
| tree | b038bd06b5e195b5a551e27e562aba01ea1e98ad /llvm/lib/MC | |
| parent | bc839fcd3e7830616ca4e9c687459aab886eb91e (diff) | |
| download | bcm5719-llvm-1b7e4866f41c360b85cfe74d419084550166ec7b.tar.gz bcm5719-llvm-1b7e4866f41c360b85cfe74d419084550166ec7b.zip | |
Fix wrong code offset for unwind code SET_FPREG.
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
Diffstat (limited to 'llvm/lib/MC')
| -rw-r--r-- | llvm/lib/MC/MCStreamer.cpp | 4 | ||||
| -rw-r--r-- | llvm/lib/MC/MCWin64EH.cpp | 5 |
2 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/MC/MCStreamer.cpp b/llvm/lib/MC/MCStreamer.cpp index 6542f42a03b..fb43a4adbda 100644 --- a/llvm/lib/MC/MCStreamer.cpp +++ b/llvm/lib/MC/MCStreamer.cpp @@ -470,7 +470,9 @@ void MCStreamer::EmitWin64EHSetFrame(unsigned Register, unsigned Offset) { report_fatal_error("Frame register and offset already specified!"); if (Offset & 0x0F) report_fatal_error("Misaligned frame pointer offset!"); - MCWin64EHInstruction Inst(Win64EH::UOP_SetFPReg, 0, Register, Offset); + MCSymbol *Label = getContext().CreateTempSymbol(); + MCWin64EHInstruction Inst(Win64EH::UOP_SetFPReg, Label, Register, Offset); + EmitLabel(Label); CurFrame->LastFrameInst = CurFrame->Instructions.size(); CurFrame->Instructions.push_back(Inst); } diff --git a/llvm/lib/MC/MCWin64EH.cpp b/llvm/lib/MC/MCWin64EH.cpp index c5b637c9244..8db1fa2a93c 100644 --- a/llvm/lib/MC/MCWin64EH.cpp +++ b/llvm/lib/MC/MCWin64EH.cpp @@ -64,7 +64,7 @@ static void EmitAbsDifference(MCStreamer &streamer, MCSymbol *lhs, static void EmitUnwindCode(MCStreamer &streamer, MCSymbol *begin, MCWin64EHInstruction &inst) { - uint8_t b1, b2; + uint8_t b2; uint16_t w; b2 = (inst.getOperation() & 0x0F); switch (inst.getOperation()) { @@ -93,8 +93,7 @@ static void EmitUnwindCode(MCStreamer &streamer, MCSymbol *begin, streamer.EmitIntValue(b2, 1); break; case Win64EH::UOP_SetFPReg: - b1 = inst.getOffset() & 0xF0; - streamer.EmitIntValue(b1, 1); + EmitAbsDifference(streamer, inst.getLabel(), begin); streamer.EmitIntValue(b2, 1); break; case Win64EH::UOP_SaveNonVol: |

