From 6dfded39db455174083f5487c3eeeef1462a2642 Mon Sep 17 00:00:00 2001
From: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Date: Sun, 11 Jan 2015 14:34:13 -0800
Subject: [PATCH 2/4] libunwind: Use __builtin_trap rather than
 __builtin_unreachable for older toolchains

http://www.llvm.org/bugs/show_bug.cgi?id=22198

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
---
 src/DwarfInstructions.hpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/DwarfInstructions.hpp b/src/DwarfInstructions.hpp
index 3e4fbd1..91b8886 100644
--- a/src/DwarfInstructions.hpp
+++ b/src/DwarfInstructions.hpp
@@ -71,7 +71,9 @@ private:
       return evaluateExpression((pint_t)prolog.cfaExpression, addressSpace, 
                                 registers, 0);
     assert(0 && "getCFA(): unknown location");
-    __builtin_unreachable();
+    // __builtin_unreachable() is more appropriate but is only available on gcc-4.5 and newer.
+    // __builtin_trap() is better than an ifdef mess for something that will never run anyways.
+    __builtin_trap();
   }
 };
 
-- 
2.15.1

