mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-07 12:28:24 +00:00
unique_ptrify RuntimeDyldImpl::loadObject
I'm not sure this is a particularly helpful API (to pass ownership and then return it unconditionally) rather than just pass the underlying object by non-const reference, but this was the original API so I'll just make it more safe/stable and anyone else is free to adjust that at their whim, of course. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217081 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -137,10 +137,10 @@ static std::error_code getOffset(const SymbolRef &Sym, uint64_t &Result) {
|
|||||||
return object_error::success;
|
return object_error::success;
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjectImage *RuntimeDyldImpl::loadObject(ObjectImage *InputObject) {
|
std::unique_ptr<ObjectImage>
|
||||||
|
RuntimeDyldImpl::loadObject(std::unique_ptr<ObjectImage> Obj) {
|
||||||
MutexGuard locked(lock);
|
MutexGuard locked(lock);
|
||||||
|
|
||||||
std::unique_ptr<ObjectImage> Obj(InputObject);
|
|
||||||
if (!Obj)
|
if (!Obj)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
@@ -250,7 +250,7 @@ ObjectImage *RuntimeDyldImpl::loadObject(ObjectImage *InputObject) {
|
|||||||
// Give the subclasses a chance to tie-up any loose ends.
|
// Give the subclasses a chance to tie-up any loose ends.
|
||||||
finalizeLoad(*Obj, LocalSections);
|
finalizeLoad(*Obj, LocalSections);
|
||||||
|
|
||||||
return Obj.release();
|
return Obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
// A helper method for computeTotalAllocSize.
|
// A helper method for computeTotalAllocSize.
|
||||||
@@ -816,8 +816,7 @@ RuntimeDyld::loadObject(std::unique_ptr<ObjectFile> InputObject) {
|
|||||||
if (!Dyld->isCompatibleFile(&Obj))
|
if (!Dyld->isCompatibleFile(&Obj))
|
||||||
report_fatal_error("Incompatible object format!");
|
report_fatal_error("Incompatible object format!");
|
||||||
|
|
||||||
Dyld->loadObject(InputImage.get());
|
return Dyld->loadObject(std::move(InputImage));
|
||||||
return InputImage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<ObjectImage>
|
std::unique_ptr<ObjectImage>
|
||||||
@@ -865,8 +864,7 @@ RuntimeDyld::loadObject(std::unique_ptr<ObjectBuffer> InputBuffer) {
|
|||||||
if (!Dyld->isCompatibleFormat(InputBufferPtr))
|
if (!Dyld->isCompatibleFormat(InputBufferPtr))
|
||||||
report_fatal_error("Incompatible object format!");
|
report_fatal_error("Incompatible object format!");
|
||||||
|
|
||||||
Dyld->loadObject(InputImage.get());
|
return Dyld->loadObject(std::move(InputImage));
|
||||||
return InputImage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void *RuntimeDyld::getSymbolAddress(StringRef Name) {
|
void *RuntimeDyld::getSymbolAddress(StringRef Name) {
|
||||||
|
@@ -373,7 +373,8 @@ public:
|
|||||||
this->Checker = Checker;
|
this->Checker = Checker;
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjectImage *loadObject(ObjectImage *InputObject);
|
std::unique_ptr<ObjectImage>
|
||||||
|
loadObject(std::unique_ptr<ObjectImage> InputObject);
|
||||||
|
|
||||||
uint8_t* getSymbolAddress(StringRef Name) {
|
uint8_t* getSymbolAddress(StringRef Name) {
|
||||||
// FIXME: Just look up as a function for now. Overly simple of course.
|
// FIXME: Just look up as a function for now. Overly simple of course.
|
||||||
|
Reference in New Issue
Block a user