From ce3252c348824a01b75275401cd53c5e6c6c0158 Mon Sep 17 00:00:00 2001 From: Josh Berdine Date: Thu, 10 Oct 2019 06:17:12 -0700 Subject: [PATCH] [sledge] Allow global variables as function names Summary: Some called functions are represented in llvm as a global variable with e.g. external linkage, and so they do not appear as 'functions'. It is still valid to call such functions, though the analyzer does not know their definitions. Reviewed By: bennostein Differential Revision: D17725609 fbshipit-source-id: 333d19c0d --- sledge/src/llair/frontend.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sledge/src/llair/frontend.ml b/sledge/src/llair/frontend.ml index 7e6b429da..026d94f99 100644 --- a/sledge/src/llair/frontend.ml +++ b/sledge/src/llair/frontend.ml @@ -778,7 +778,7 @@ let pp_code fs (insts, term, blocks) = let rec xlate_func_name x llv = match Llvm.classify_value llv with - | Function -> Exp.reg (xlate_name x ~global:() llv) + | Function | GlobalVariable -> Exp.reg (xlate_name x ~global:() llv) | ConstantExpr -> xlate_opcode x llv (Llvm.constexpr_opcode llv) | Argument | Instruction _ -> xlate_value x llv | GlobalAlias -> xlate_func_name x (Llvm.operand llv 0)