Fix Stack Unwind Behavior of Libunwind-ARM
authorMyungJoo Ham <myungjoo.ham@samsung.com>
Fri, 4 Mar 2016 04:38:15 +0000 (13:38 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Fri, 4 Mar 2016 05:28:42 +0000 (14:28 +0900)
Disable UNW_ARM_METHOD_DWARF, which gets problematic with
assembly-created stacks in ARM systems.

Although previous commits have fixed the compatibility issues
between cpp stacks and libunwind-arm, the assembly part
(asmhelpers.S) had similar problems.

Fix dotnet/coreclr#3462

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Commit migrated from https://github.com/dotnet/coreclr/commit/35b5df6888f1574e6ef9313c6bc8522d1817573d

src/coreclr/src/coreclr/hosts/unixcoreruncommon/coreruncommon.cpp

index 1125dfb..8d32a7d 100644 (file)
@@ -268,6 +268,20 @@ int ExecuteManagedAssembly(
     // Indicates failure
     int exitCode = -1;
 
+#ifdef _ARM_
+    // LIBUNWIND-ARM has a bug of side effect with DWARF mode
+    // Ref: https://github.com/dotnet/coreclr/issues/3462
+    // This is why Fedora is disabling it by default as well.
+    // Assuming that we cannot enforce the user to set
+    // environmental variables for third party packages,
+    // we set the environmental variable of libunwind locally here.
+
+    // Without this, any exception handling will fail, so let's do this
+    // as early as possible.
+    // 0x1: DWARF / 0x2: FRAME / 0x4: EXIDX
+    putenv("UNW_ARM_UNWIND_METHOD=6");
+#endif // _ARM_
+
     std::string coreClrDllPath(clrFilesAbsolutePath);
     coreClrDllPath.append("/");
     coreClrDllPath.append(coreClrDll);