From 3b46c5ae24325d7b31efedf4ed5435c4cb0f43e4 Mon Sep 17 00:00:00 2001 From: Jonghyun Park Date: Wed, 17 Aug 2016 15:32:41 +0900 Subject: [PATCH] Makes FCallMemcpy unwindable (dotnet/coreclr#6753) FCallMemcpy function in vm/arm/memcpy.S creates an stack frame that libunwind cannot recognize, which leads to the issue in dotnet/coreclr#6752. This commit makes the stack frame of FCallMemcpy unwindable to fix issue dotnet/coreclr#6752. Commit migrated from https://github.com/dotnet/coreclr/commit/a641d3aa4e90ef59b89511705c43d2a036a9c0d4 --- src/coreclr/src/pal/inc/unixasmmacrosarm.inc | 4 ++++ src/coreclr/src/vm/arm/memcpy.S | 11 +++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/coreclr/src/pal/inc/unixasmmacrosarm.inc b/src/coreclr/src/pal/inc/unixasmmacrosarm.inc index c983d7f..14b0b41 100644 --- a/src/coreclr/src/pal/inc/unixasmmacrosarm.inc +++ b/src/coreclr/src/pal/inc/unixasmmacrosarm.inc @@ -21,6 +21,10 @@ C_FUNC(\Name): LEAF_END \Name, \Section .endm +.macro NESTED_END_MARKED Name, Section + LEAF_END_MARKED \Name, \Section +.endm + .macro PATCH_LABEL Name .thumb_func .global C_FUNC(\Name) diff --git a/src/coreclr/src/vm/arm/memcpy.S b/src/coreclr/src/vm/arm/memcpy.S index b09d61c..b978860 100644 --- a/src/coreclr/src/vm/arm/memcpy.S +++ b/src/coreclr/src/vm/arm/memcpy.S @@ -14,17 +14,20 @@ // Copy a block of memory in a forward direction. // - LEAF_ENTRY FCallMemcpy, _TEXT + NESTED_ENTRY FCallMemcpy, _TEXT, NoHandler cmp r2, #0 beq LOCAL_LABEL(GC_POLL) + + PROLOG_PUSH "{r7, lr}" + PROLOG_STACK_SAVE r7 ldr r3, [r0] ldr r3, [r1] - push {r7, lr} // r7 as a dummy to make SP aligned blx C_FUNC(memcpy) - pop {r7, lr} + + EPILOG_POP "{r7, pc}" LOCAL_LABEL(GC_POLL): ldr r0, =g_TrapReturningThreads @@ -33,4 +36,4 @@ LOCAL_LABEL(GC_POLL): it ne bne C_FUNC(FCallMemCpy_GCPoll) bx lr - LEAF_END_MARKED FCallMemcpy, _TEXT + NESTED_END_MARKED FCallMemcpy, _TEXT -- 2.7.4