devices/runtime: add returns_twice attribute on __eh_setjmp (fixes exception crashes)

This commit is contained in:
Sebastien Bourdeauducq 2014-10-11 12:59:39 +08:00
parent 3ee9a87a00
commit 9925568473
2 changed files with 13 additions and 0 deletions

View File

@ -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")

View File

@ -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()