[PATCH] D45590: [Support] Fix building for Windows on ARM

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 12 13:31:29 PDT 2018


mstorsjo created this revision.
mstorsjo added reviewers: martell, compnerd, rnk.
Herald added a subscriber: kristof.beyls.

The commit in SVN r310001 that added support for this actually didn't use the right struct field for the frame pointer - for ARM, there is no register named Fp in the CONTEXT struct. On Windows, the https://reviews.llvm.org/source/libunwind/ register is used as frame pointer.


Repository:
  rL LLVM

https://reviews.llvm.org/D45590

Files:
  lib/Support/Windows/Signals.inc


Index: lib/Support/Windows/Signals.inc
===================================================================
--- lib/Support/Windows/Signals.inc
+++ lib/Support/Windows/Signals.inc
@@ -533,10 +533,14 @@
   StackFrame.AddrPC.Offset = Context.Eip;
   StackFrame.AddrStack.Offset = Context.Esp;
   StackFrame.AddrFrame.Offset = Context.Ebp;
-#elif defined(_M_ARM64) || defined(_M_ARM)
+#elif defined(_M_ARM64)
   StackFrame.AddrPC.Offset = Context.Pc;
   StackFrame.AddrStack.Offset = Context.Sp;
   StackFrame.AddrFrame.Offset = Context.Fp;
+#elif defined(_M_ARM)
+  StackFrame.AddrPC.Offset = Context.Pc;
+  StackFrame.AddrStack.Offset = Context.Sp;
+  StackFrame.AddrFrame.Offset = Context.R11;
 #endif
   StackFrame.AddrPC.Mode = AddrModeFlat;
   StackFrame.AddrStack.Mode = AddrModeFlat;
@@ -816,7 +820,11 @@
   StackFrame.AddrPC.Mode = AddrModeFlat;
   StackFrame.AddrStack.Offset = ep->ContextRecord->Sp;
   StackFrame.AddrStack.Mode = AddrModeFlat;
+#if defined(_M_ARM64)
   StackFrame.AddrFrame.Offset = ep->ContextRecord->Fp;
+#else
+  StackFrame.AddrFrame.Offset = ep->ContextRecord->R11;
+#endif
   StackFrame.AddrFrame.Mode = AddrModeFlat;
 #endif
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45590.142251.patch
Type: text/x-patch
Size: 1158 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180412/b522a116/attachment.bin>


More information about the llvm-commits mailing list