summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/DynamicLoader.cpp
diff options
context:
space:
mode:
authorTamas Berghammer <tberghammer@google.com>2015-06-30 10:41:23 +0000
committerTamas Berghammer <tberghammer@google.com>2015-06-30 10:41:23 +0000
commitf256184693d166f23eb2d0ed6379e9348909c7d2 (patch)
tree9b692c2f9c750d8dd00319490cd312e8a54667df /lldb/source/Core/DynamicLoader.cpp
parentcd4994e925bb159e3a818cc1a6b51017e922433f (diff)
downloadbcm5719-llvm-f256184693d166f23eb2d0ed6379e9348909c7d2.tar.gz
bcm5719-llvm-f256184693d166f23eb2d0ed6379e9348909c7d2.zip
Fix [vdso] handling on Android (x86 and aarch64)
* Add in-memory object file handling to the core dynamic loader * Fix in memory object file handling in ObjectFileELF (previously only part of the file was loaded before parsing) * Fix load address setting in ObjectFileELF for 32-bit targets when the load bias is negative * Change hack in DYLDRendezvous.cpp to be more specific and not to interfere with object files with fixed load address Differential revision: http://reviews.llvm.org/D10800 llvm-svn: 241057
Diffstat (limited to 'lldb/source/Core/DynamicLoader.cpp')
-rw-r--r--lldb/source/Core/DynamicLoader.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/lldb/source/Core/DynamicLoader.cpp b/lldb/source/Core/DynamicLoader.cpp
index 1f545b727a1..ffd7425f523 100644
--- a/lldb/source/Core/DynamicLoader.cpp
+++ b/lldb/source/Core/DynamicLoader.cpp
@@ -186,6 +186,24 @@ DynamicLoader::LoadModuleAtAddress(const FileSpec &file, addr_t link_map_addr, a
{
UpdateLoadedSections(module_sp, link_map_addr, base_addr);
}
+ else
+ {
+ // Try to fetch the load address of the file from the process. It can be different from the
+ // address reported by the linker in case of a file with fixed load address because the
+ // linker reports the bias between the load address specified in the file and the actual
+ // load address it loaded the file.
+ bool is_loaded;
+ lldb::addr_t load_addr;
+ Error error = m_process->GetFileLoadAddress(file, is_loaded, load_addr);
+ if (error.Fail() || !is_loaded)
+ load_addr = base_addr;
+
+ if ((module_sp = m_process->ReadModuleFromMemory(file, load_addr)))
+ {
+ UpdateLoadedSections(module_sp, link_map_addr, base_addr);
+ target.GetImages().AppendIfNeeded(module_sp);
+ }
+ }
return module_sp;
}
OpenPOWER on IntegriCloud