diff --git a/src/striga/semantics.py b/src/striga/semantics.py index f56df09..95df9b6 100644 --- a/src/striga/semantics.py +++ b/src/striga/semantics.py @@ -133,10 +133,17 @@ class Semantics: self.call_handler = self.module.add_function("__striga_call", helper_ty) self.ret_handler = self.module.add_function("__striga_ret", helper_ty) self.syscall_handler = self.module.add_function("__striga_syscall", helper_ty) - self.undef_flags = { - name: self.module.add_function(f"__striga_undef_{name}", undef_flag_ty) - for name in FLAGS - } + def add_undef_flag_helper(name: str) -> Function: + helper = self.module.add_function(f"__striga_undef_{name}", undef_flag_ty) + # Undefined-flag helpers model arbitrary values, not side effects. + # Match Remill's symbolic/undefined helper annotations so calls can + # be deleted after their flag stores are proven dead. + helper.attributes.add_memory("none") + helper.attributes.add("nounwind") + helper.attributes.add("willreturn") + return helper + + self.undef_flags = {name: add_undef_flag_helper(name) for name in FLAGS} # Set per function lifted self.insn_blocks: dict[int, BasicBlock] = {}