From 992556847350e1f467216fa2385347c21c3f70b3 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sat, 11 Oct 2014 12:59:39 +0800 Subject: [PATCH] devices/runtime: add returns_twice attribute on __eh_setjmp (fixes exception crashes) --- artiq/devices/runtime.py | 1 + .../llvmpy/0002-add-returns-twice-attribute.patch | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 patches/llvmpy/0002-add-returns-twice-attribute.patch diff --git a/artiq/devices/runtime.py b/artiq/devices/runtime.py index 3a5d87f84..d9bac42ce 100644 --- a/artiq/devices/runtime.py +++ b/artiq/devices/runtime.py @@ -65,6 +65,7 @@ class LinkInterface: func_type = lc.Type.function(lc.Type.int(), [lc.Type.pointer(lc.Type.int(8))]) function = self.llvm_module.add_function(func_type, "__eh_setjmp") function.add_attribute(lc.ATTR_NO_UNWIND) + function.add_attribute(lc.ATTR_RETURNS_TWICE) func_type = lc.Type.function(lc.Type.pointer(lc.Type.int(8)), []) self.llvm_module.add_function(func_type, "__eh_push") diff --git a/patches/llvmpy/0002-add-returns-twice-attribute.patch b/patches/llvmpy/0002-add-returns-twice-attribute.patch new file mode 100644 index 000000000..20a9e0d77 --- /dev/null +++ b/patches/llvmpy/0002-add-returns-twice-attribute.patch @@ -0,0 +1,12 @@ +diff --git a/llvm/core.py b/llvm/core.py +index 20ad062..245ac65 100644 +--- a/llvm/core.py ++++ b/llvm/core.py +@@ -379,6 +379,7 @@ class AttrEnum(Enum): + ATTR_NAKED = AttrVal.Naked + ATTR_INLINE_HINT = AttrVal.InlineHint + ATTR_STACK_ALIGNMENT = AttrVal.StackAlignment ++ ATTR_RETURNS_TWICE = AttrVal.ReturnsTwice + + AttrEnum.declare() +