[CoreRT armel]Fix for unwinding support for ARM is not fully implemented dotnet/corec...
authorSergey Ignatov <sergign60@mail.ru>
Thu, 9 Aug 2018 08:52:10 +0000 (11:52 +0300)
committerSergey Ignatov <sergign60@mail.ru>
Thu, 16 Aug 2018 09:37:40 +0000 (12:37 +0300)
Commit migrated from https://github.com/dotnet/coreclr/commit/f4eaea5265b90bdf782bbd62d1cbc246f62a7a75

src/coreclr/src/jit/compiler.h
src/coreclr/src/jit/unwind.cpp
src/coreclr/src/jit/unwindarm.cpp

index 705b293..09ff104 100644 (file)
@@ -7165,6 +7165,10 @@ private:
                      DWORD                 cfiCodeBytes,
                      const CFI_CODE* const pCfiCode);
 #endif
+#if defined(_TARGET_ARM_)
+    bool unwindCfiEpilogFormed; // Avoid duplicated unwind info for methods with multiple epilogs (we expect and require
+                                // all the epilogs to be precisely the same)
+#endif
 
 #endif // _TARGET_UNIX_
 
index db120c5..98f8673 100644 (file)
@@ -122,6 +122,10 @@ void Compiler::unwindGetFuncLocations(FuncInfoDsc*             func,
 
 void Compiler::createCfiCode(FuncInfoDsc* func, UCHAR codeOffset, UCHAR cfiOpcode, USHORT dwarfReg, INT offset)
 {
+#if defined(_TARGET_ARM_)
+    if (compGeneratingEpilog && unwindCfiEpilogFormed)
+        return;
+#endif
     CFI_CODE cfiEntry(codeOffset, cfiOpcode, dwarfReg, offset);
     func->cfiCodes->push_back(cfiEntry);
 }
@@ -153,7 +157,10 @@ void Compiler::unwindPushPopCFI(regNumber reg)
         // since it is pushed as a frame register.
         || (reg == REG_FPBASE)
 #endif // ETW_EBP_FRAMED
-#endif
+#endif // UNIX_AMD64_ABI
+#if defined(_TARGET_ARM_)
+        || (reg == REG_R11) || (reg == REG_LR) || (reg == REG_PC)
+#endif // _TARGET_ARM_
             )
     {
         createCfiCode(func, cbProlog, CFI_REL_OFFSET, mapRegNumToDwarfReg(reg));
index 9bb07ec..691d4e1 100644 (file)
@@ -194,6 +194,9 @@ void Compiler::unwindBegProlog()
     if (generateCFIUnwindCodes())
     {
         unwindBegPrologCFI();
+#if defined(_TARGET_ARM_)
+        unwindCfiEpilogFormed = false;
+#endif
         return;
     }
 #endif // _TARGET_UNIX_
@@ -235,6 +238,11 @@ void Compiler::unwindBegEpilog()
 void Compiler::unwindEndEpilog()
 {
     assert(compGeneratingEpilog);
+#if defined(_TARGET_UNIX_)
+#if defined(_TARGET_ARM_)
+    unwindCfiEpilogFormed = true;
+#endif
+#endif // _TARGET_UNIX_
 }
 
 #if defined(_TARGET_ARM_)