Refactoring interface.
Change-Id: I7afcd83408d381dcf4d053ffe66150f567e02545
diff --git a/lib/ExecutionEngine/Script.h b/lib/ExecutionEngine/Script.h
index 70df516..e9f7b09 100644
--- a/lib/ExecutionEngine/Script.h
+++ b/lib/ExecutionEngine/Script.h
@@ -53,6 +53,7 @@
enum ObjectType {
Unknown,
Relocatable,
+ SharedObject,
Executable,
};
}
@@ -88,6 +89,12 @@
objPath.append(".o");
break;
}
+
+ case ScriptObject::SharedObject: {
+ objPath.append(".so");
+ break;
+ }
+
default: {
assert(false && "Unknown object type!");
}
@@ -158,6 +165,27 @@
char const *cacheName,
unsigned long flags);
+ /*
+ * Link the given bitcodes in mSourceList to shared object (.so).
+ *
+ * Currently, it requires one to provide the relocatable object files with
+ * given bitcodes to output a shared object.
+ *
+ * The usage of this function is flexible. You can have a relocatable object
+ * compiled before and pass it in objPath to generate shared object. If the
+ * objPath is NULL, we'll invoke prepareRelocatable() to get .o first (if
+ * you haven't done that yet) and then link the output relocatable object
+ * file. The latter case will have libbcc compile with USE_CACHE enabled.
+ *
+ * TODO: Currently, we only support to link the bitcodes in mSourceList[0].
+ *
+ */
+ int prepareSharedObject(char const *cacheDir,
+ char const *cacheName,
+ char const *objPath,
+ char const *dsoPath,
+ unsigned long flags);
+
int prepareRelocatable(char const *cacheDir,
char const *cacheName,
llvm::Reloc::Model RelocModel,