mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Add support in the LTO library for loading an object from the middle
of an file. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127781 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -95,10 +95,19 @@ LTOModule *LTOModule::makeLTOModule(const char *path,
|
||||
}
|
||||
|
||||
LTOModule *LTOModule::makeLTOModule(int fd, const char *path,
|
||||
off_t size,
|
||||
size_t size,
|
||||
std::string &errMsg) {
|
||||
return makeLTOModule(fd, path, size, size, 0, errMsg);
|
||||
}
|
||||
|
||||
LTOModule *LTOModule::makeLTOModule(int fd, const char *path,
|
||||
size_t file_size,
|
||||
size_t map_size,
|
||||
off_t offset,
|
||||
std::string &errMsg) {
|
||||
OwningPtr<MemoryBuffer> buffer;
|
||||
if (error_code ec = MemoryBuffer::getOpenFile(fd, path, buffer, size)) {
|
||||
if (error_code ec = MemoryBuffer::getOpenFile(fd, path, buffer, file_size,
|
||||
map_size, offset, false)) {
|
||||
errMsg = ec.message();
|
||||
return NULL;
|
||||
}
|
||||
|
@@ -52,7 +52,12 @@ struct LTOModule {
|
||||
static LTOModule* makeLTOModule(const char* path,
|
||||
std::string& errMsg);
|
||||
static LTOModule* makeLTOModule(int fd, const char *path,
|
||||
off_t size,
|
||||
size_t size,
|
||||
std::string& errMsg);
|
||||
static LTOModule* makeLTOModule(int fd, const char *path,
|
||||
size_t file_size,
|
||||
size_t map_size,
|
||||
off_t offset,
|
||||
std::string& errMsg);
|
||||
static LTOModule* makeLTOModule(const void* mem, size_t length,
|
||||
std::string& errMsg);
|
||||
|
@@ -95,11 +95,24 @@ lto_module_t lto_module_create(const char* path)
|
||||
// loads an object file from disk
|
||||
// returns NULL on error (check lto_get_error_message() for details)
|
||||
//
|
||||
lto_module_t lto_module_create_from_fd(int fd, const char *path, off_t size)
|
||||
lto_module_t lto_module_create_from_fd(int fd, const char *path, size_t size)
|
||||
{
|
||||
return LTOModule::makeLTOModule(fd, path, size, sLastErrorString);
|
||||
}
|
||||
|
||||
//
|
||||
// loads an object file from disk
|
||||
// returns NULL on error (check lto_get_error_message() for details)
|
||||
//
|
||||
lto_module_t lto_module_create_from_fd_at_offset(int fd, const char *path,
|
||||
size_t file_size,
|
||||
size_t map_size,
|
||||
off_t offset)
|
||||
{
|
||||
return LTOModule::makeLTOModule(fd, path, file_size, map_size,
|
||||
offset, sLastErrorString);
|
||||
}
|
||||
|
||||
//
|
||||
// loads an object file from memory
|
||||
// returns NULL on error (check lto_get_error_message() for details)
|
||||
|
@@ -2,6 +2,7 @@ lto_get_error_message
|
||||
lto_get_version
|
||||
lto_module_create
|
||||
lto_module_create_from_fd
|
||||
lto_module_create_from_fd_at_offset
|
||||
lto_module_create_from_memory
|
||||
lto_module_get_num_symbols
|
||||
lto_module_get_symbol_attribute
|
||||
|
Reference in New Issue
Block a user