diff --git a/libunwind/src/DwarfInstructions.hpp b/libunwind/src/DwarfInstructions.hpp
index 18556c6f2d4b..b23e54739050 100644
--- a/libunwind/src/DwarfInstructions.hpp
+++ b/libunwind/src/DwarfInstructions.hpp
@@ -165,9 +165,10 @@ typename A::capability_t DwarfInstructions::getSavedCapabilityRegister(
#else
break;
#endif
+ case CFI_Parser::kRegisterUndefined:
+ return _LIBUNWIND_UNDEF_CAPABILITY;
case CFI_Parser::kRegisterInCFADecrypt: // sparc64 specific
- case CFI_Parser::kRegisterUndefined:
case CFI_Parser::kRegisterUnused:
case CFI_Parser::kRegisterOffsetFromCFA:
// FIX ME
diff --git a/libunwind/src/Registers.hpp b/libunwind/src/Registers.hpp
index 92b0b8b9bb9a..9eda92bc2d00 100644
--- a/libunwind/src/Registers.hpp
+++ b/libunwind/src/Registers.hpp
@@ -29,7 +29,9 @@ struct __attribute__((aligned(16))) fake_capability {
char bytes[16];
};
typedef struct fake_capability fake_capability_t;
+#define _LIBUNWIND_UNDEF_CAPABILITY ((fake_capability_t){0})
#else
+#define _LIBUNWIND_UNDEF_CAPABILITY 0
// To keep CAPABILITIES_NOT_SUPPORT working in hybrid mode
// TODO: remove
typedef __uintcap_t fake_capability_t;