Follow the ELF spec. Use the terms relocatable.
Also, clean up the code.
Change-Id: I135050b1c3072ebb33ea0b48f9e2902c9eccd587
diff --git a/lib/ExecutionEngine/Script.cpp b/lib/ExecutionEngine/Script.cpp
index bfa914b..085e7c8 100644
--- a/lib/ExecutionEngine/Script.cpp
+++ b/lib/ExecutionEngine/Script.cpp
@@ -76,8 +76,9 @@
break;
}
- for (size_t i = 0; i < 2; ++i)
+ for (size_t i = 0; i < 2; ++i) {
delete mSourceList[i];
+ }
}
@@ -179,10 +180,10 @@
return 0;
}
-int Script::prepareObject(char const *cacheDir,
- char const *cacheName,
- llvm::Reloc::Model RelocModel,
- unsigned long flags) {
+int Script::prepareRelocatable(char const *cacheDir,
+ char const *cacheName,
+ llvm::Reloc::Model RelocModel,
+ unsigned long flags) {
mObjectType = ScriptObject::Relocatable;
#if USE_CACHE
if (cacheDir && cacheName) {
diff --git a/lib/ExecutionEngine/Script.h b/lib/ExecutionEngine/Script.h
index 7fe3e03..ef682a6 100644
--- a/lib/ExecutionEngine/Script.h
+++ b/lib/ExecutionEngine/Script.h
@@ -158,10 +158,10 @@
char const *cacheName,
unsigned long flags);
- int prepareObject(char const *cacheDir,
- char const *cacheName,
- llvm::Reloc::Model RelocModel,
- unsigned long flags);
+ int prepareRelocatable(char const *cacheDir,
+ char const *cacheName,
+ llvm::Reloc::Model RelocModel,
+ unsigned long flags);
char const *getCompilerErrorMessage();
diff --git a/lib/ExecutionEngine/bcc.cpp b/lib/ExecutionEngine/bcc.cpp
index 075d6c1..45ab1ee 100644
--- a/lib/ExecutionEngine/bcc.cpp
+++ b/lib/ExecutionEngine/bcc.cpp
@@ -29,6 +29,7 @@
#include <string>
#include <utils/StopWatch.h>
+
#include <llvm/Support/CodeGen.h>
using namespace bcc;
@@ -124,26 +125,38 @@
}
-extern "C" int bccPrepareObject(BCCScriptRef script,
- char const *cacheDir,
- char const *cacheName,
- bccRelocModelEnum RelocModel,
- unsigned long flags) {
+extern "C" int bccPrepareRelocatable(BCCScriptRef script,
+ char const *cacheDir,
+ char const *cacheName,
+ bccRelocModelEnum RelocModel,
+ unsigned long flags) {
BCC_FUNC_LOGGER();
llvm::Reloc::Model RM;
switch (RelocModel) {
- case bccRelocDefault: RM = llvm::Reloc::Default; break;
- case bccRelocStatic: RM = llvm::Reloc::Static; break;
- case bccRelocPIC: RM = llvm::Reloc::PIC_; break;
- case bccRelocDynamicNoPIC: RM = llvm::Reloc::DynamicNoPIC; break;
+ case bccRelocDefault: {
+ RM = llvm::Reloc::Default;
+ break;
+ }
+ case bccRelocStatic: {
+ RM = llvm::Reloc::Static;
+ break;
+ }
+ case bccRelocPIC: {
+ RM = llvm::Reloc::PIC_;
+ break;
+ }
+ case bccRelocDynamicNoPIC: {
+ RM = llvm::Reloc::DynamicNoPIC;
+ break;
+ }
default: {
ALOGE("Unrecognized relocation model for bccPrepareObject!");
return BCC_INVALID_VALUE;
}
}
- return unwrap(script)->prepareObject(cacheDir, cacheName, RM, flags);
+ return unwrap(script)->prepareRelocatable(cacheDir, cacheName, RM, flags);
}