lifting-bits / remill

Library for lifting machine code to LLVM bitcode
Apache License 2.0
1.27k stars 145 forks source link

Ian/recover flags #559

Closed 2over12 closed 2 years ago

2over12 commented 2 years ago

This PR adds several intrinsics to mark flag computations and branch conditions that can be consumed by branch recovery analyses.

The full list of added intrinsics are:

  __remill_flag_computation_zero
  __remill_flag_computation_overflow
  __remill_flag_computation_sign
  __remill_flag_computation_carry

  __remill_compare_sle
  __remill_compare_slt
  __remill_compare_sgt
  __remill_compare_sge

  __remill_compare_eq
  __remill_compare_neq

  __remill_compare_ugt
  __remill_compare_uge
  __remill_compare_ult
  __remill_compare_ule

Note: This PR breaks anvill downstream due to unresolved stack flags. The SimplifyStackArithFlags pass in the branch recovery PR fixes this issue by substituting flags computed based on the stack pointer.