forked from M-Labs/artiq
devices/runtime: add returns_twice attribute on __eh_setjmp (fixes exception crashes)
This commit is contained in:
parent
3ee9a87a00
commit
9925568473
|
@ -65,6 +65,7 @@ class LinkInterface:
|
||||||
func_type = lc.Type.function(lc.Type.int(), [lc.Type.pointer(lc.Type.int(8))])
|
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 = self.llvm_module.add_function(func_type, "__eh_setjmp")
|
||||||
function.add_attribute(lc.ATTR_NO_UNWIND)
|
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)), [])
|
func_type = lc.Type.function(lc.Type.pointer(lc.Type.int(8)), [])
|
||||||
self.llvm_module.add_function(func_type, "__eh_push")
|
self.llvm_module.add_function(func_type, "__eh_push")
|
||||||
|
|
|
@ -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()
|
||||||
|
|
Loading…
Reference in New Issue