projects
/
oota-llvm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Expand 64bit {SHL,SHR,SRA}_PARTS on sparcv9.
[oota-llvm.git]
/
tools
/
llvm-rtdyld
/
llvm-rtdyld.cpp
diff --git
a/tools/llvm-rtdyld/llvm-rtdyld.cpp
b/tools/llvm-rtdyld/llvm-rtdyld.cpp
index ead541a5b80fa46482a7699e6e7142e7b07c55a7..65c0ab72553895fd5ddf7c198a3520ee229d05c7 100644
(file)
--- a/
tools/llvm-rtdyld/llvm-rtdyld.cpp
+++ b/
tools/llvm-rtdyld/llvm-rtdyld.cpp
@@
-22,6
+22,8
@@
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/Memory.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/Memory.h"
#include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/PrettyStackTrace.h"
+#include "llvm/Support/Signals.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/system_error.h"
using namespace llvm;
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/system_error.h"
using namespace llvm;
@@
-60,16
+62,17
@@
public:
SmallVector<sys::MemoryBlock, 16> DataMemory;
uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
SmallVector<sys::MemoryBlock, 16> DataMemory;
uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
- unsigned SectionID);
+ unsigned SectionID
, StringRef SectionName
);
uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
- unsigned SectionID, bool IsReadOnly);
+ unsigned SectionID, StringRef SectionName,
+ bool IsReadOnly);
virtual void *getPointerToNamedFunction(const std::string &Name,
bool AbortOnFailure = true) {
return 0;
}
virtual void *getPointerToNamedFunction(const std::string &Name,
bool AbortOnFailure = true) {
return 0;
}
- bool
applyPermissions
(std::string *ErrMsg) { return false; }
+ bool
finalizeMemory
(std::string *ErrMsg) { return false; }
// Invalidate instruction cache for sections with execute permissions.
// Some platforms with separate data cache and instruction cache require
// Invalidate instruction cache for sections with execute permissions.
// Some platforms with separate data cache and instruction cache require
@@
-80,7
+83,8
@@
public:
uint8_t *TrivialMemoryManager::allocateCodeSection(uintptr_t Size,
unsigned Alignment,
uint8_t *TrivialMemoryManager::allocateCodeSection(uintptr_t Size,
unsigned Alignment,
- unsigned SectionID) {
+ unsigned SectionID,
+ StringRef SectionName) {
sys::MemoryBlock MB = sys::Memory::AllocateRWX(Size, 0, 0);
FunctionMemory.push_back(MB);
return (uint8_t*)MB.base();
sys::MemoryBlock MB = sys::Memory::AllocateRWX(Size, 0, 0);
FunctionMemory.push_back(MB);
return (uint8_t*)MB.base();
@@
-89,6
+93,7
@@
uint8_t *TrivialMemoryManager::allocateCodeSection(uintptr_t Size,
uint8_t *TrivialMemoryManager::allocateDataSection(uintptr_t Size,
unsigned Alignment,
unsigned SectionID,
uint8_t *TrivialMemoryManager::allocateDataSection(uintptr_t Size,
unsigned Alignment,
unsigned SectionID,
+ StringRef SectionName,
bool IsReadOnly) {
sys::MemoryBlock MB = sys::Memory::AllocateRWX(Size, 0, 0);
DataMemory.push_back(MB);
bool IsReadOnly) {
sys::MemoryBlock MB = sys::Memory::AllocateRWX(Size, 0, 0);
DataMemory.push_back(MB);
@@
-124,8
+129,8
@@
static int printLineInfoForInput() {
InputFileList.push_back("-");
for(unsigned i = 0, e = InputFileList.size(); i != e; ++i) {
// Instantiate a dynamic linker.
InputFileList.push_back("-");
for(unsigned i = 0, e = InputFileList.size(); i != e; ++i) {
// Instantiate a dynamic linker.
- TrivialMemoryManager
*MemMgr = new TrivialMemoryManage
r;
- RuntimeDyld Dyld(MemMgr);
+ TrivialMemoryManager
MemMg
r;
+ RuntimeDyld Dyld(
&
MemMgr);
// Load the input memory buffer.
OwningPtr<MemoryBuffer> InputBuffer;
// Load the input memory buffer.
OwningPtr<MemoryBuffer> InputBuffer;
@@
-146,11
+151,9
@@
static int printLineInfoForInput() {
OwningPtr<DIContext> Context(DIContext::getDWARFContext(LoadedObject->getObjectFile()));
// Use symbol info to iterate functions in the object.
OwningPtr<DIContext> Context(DIContext::getDWARFContext(LoadedObject->getObjectFile()));
// Use symbol info to iterate functions in the object.
- error_code ec;
for (object::symbol_iterator I = LoadedObject->begin_symbols(),
E = LoadedObject->end_symbols();
for (object::symbol_iterator I = LoadedObject->begin_symbols(),
E = LoadedObject->end_symbols();
- I != E && !ec;
- I.increment(ec)) {
+ I != E; ++I) {
object::SymbolRef::Type SymType;
if (I->getType(SymType)) continue;
if (SymType == object::SymbolRef::ST_Function) {
object::SymbolRef::Type SymType;
if (I->getType(SymType)) continue;
if (SymType == object::SymbolRef::ST_Function) {
@@
-180,8
+183,8
@@
static int printLineInfoForInput() {
static int executeInput() {
// Instantiate a dynamic linker.
static int executeInput() {
// Instantiate a dynamic linker.
- TrivialMemoryManager
*MemMgr = new TrivialMemoryManage
r;
- RuntimeDyld Dyld(MemMgr);
+ TrivialMemoryManager
MemMg
r;
+ RuntimeDyld Dyld(
&
MemMgr);
// If we don't have any input files, read from stdin.
if (!InputFileList.size())
// If we don't have any input files, read from stdin.
if (!InputFileList.size())
@@
-204,7
+207,7
@@
static int executeInput() {
// Resolve all the relocations we can.
Dyld.resolveRelocations();
// Clear instruction cache before code will be executed.
// Resolve all the relocations we can.
Dyld.resolveRelocations();
// Clear instruction cache before code will be executed.
- MemMgr
->
invalidateInstructionCache();
+ MemMgr
.
invalidateInstructionCache();
// FIXME: Error out if there are unresolved relocations.
// FIXME: Error out if there are unresolved relocations.
@@
-214,8
+217,8
@@
static int executeInput() {
return Error("no definition for '" + EntryPoint + "'");
// Invalidate the instruction cache for each loaded function.
return Error("no definition for '" + EntryPoint + "'");
// Invalidate the instruction cache for each loaded function.
- for (unsigned i = 0, e = MemMgr
->
FunctionMemory.size(); i != e; ++i) {
- sys::MemoryBlock &Data = MemMgr
->
FunctionMemory[i];
+ for (unsigned i = 0, e = MemMgr
.
FunctionMemory.size(); i != e; ++i) {
+ sys::MemoryBlock &Data = MemMgr
.
FunctionMemory[i];
// Make sure the memory is executable.
std::string ErrorStr;
sys::Memory::InvalidateInstructionCache(Data.base(), Data.size());
// Make sure the memory is executable.
std::string ErrorStr;
sys::Memory::InvalidateInstructionCache(Data.base(), Data.size());
@@
-236,6
+239,9
@@
static int executeInput() {
}
int main(int argc, char **argv) {
}
int main(int argc, char **argv) {
+ sys::PrintStackTraceOnErrorSignal();
+ PrettyStackTraceProgram X(argc, argv);
+
ProgramName = argv[0];
llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
ProgramName = argv[0];
llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.