Add linkBC delegation.
diff --git a/lib/bcc/Script.cpp b/lib/bcc/Script.cpp
index 51e6d8a..42f7a04 100644
--- a/lib/bcc/Script.cpp
+++ b/lib/bcc/Script.cpp
@@ -142,12 +142,15 @@
int Script::linkBC(const char *bitcode, size_t bitcodeSize) {
- if (mStatus != ScriptStatus::Compiled) {
+ if (mStatus != ScriptStatus::Unknown) {
mErrorCode = BCC_INVALID_OPERATION;
+ LOGE("Invalid operation: %s\n", __func__);
return 1;
}
- return mCompiled->linkBC(bitcode, bitcodeSize);
+ libraryBC = bitcode;
+ librarySize = bitcodeSize;
+ return 0;
}
@@ -233,15 +236,14 @@
}
}
- // TODO(logan): Link source with the library
-#if 0
+ // Link the source module with the library module
if (libraryBC) {
if (mCompiled->linkBC(libraryBC, librarySize) != 0) {
return 1;
}
}
-#endif
+ // Compile and JIT the code
if (mCompiled->compile() != 0) {
return 1;
}