Branch to 0 bug fixed
Change-Id: I9212fb594f51310451389047b98377f2ea3a81ad
diff --git a/bcc.cpp b/bcc.cpp
index 95c8700..d27ff36 100644
--- a/bcc.cpp
+++ b/bcc.cpp
@@ -1558,19 +1558,6 @@
case llvm::Value::FunctionVal:
{
llvm::Function* F = (llvm::Function*) V;
- void* FnStub = GetLazyFunctionStubIfAvailable(F);
-
- if(FnStub)
- /*
- * Return the function stub if it's already created.
- * We do this first so that:
- * we're returning the same address for the function
- * as any previous call.
- *
- * TODO: Yes, this is wrong. The lazy stub isn't guaranteed
- * to be close enough to call.
- */
- return FnStub;
/*
* If we know the target can handle arbitrary-distance calls, try to
@@ -1581,6 +1568,19 @@
if(void* ResultPtr = GetPointerToGlobalIfAvailable(F))
return ResultPtr;
+ void* FnStub = GetLazyFunctionStubIfAvailable(F);
+ if(FnStub)
+ /*
+ * Return the function stub if it's already created.
+ * We do this first so that:
+ * we're returning the same address for the function
+ * as any previous call.
+ *
+ * TODO: Yes, this is wrong. The lazy stub isn't guaranteed
+ * to be close enough to call.
+ */
+ return FnStub;
+
/*
* x86_64 architecture may encounter the bug
* http://hlvm.llvm.org/bugs/show_bug.cgi?id=5201