Skip to content
Snippets Groups Projects
Commit 895c30a5 authored by Avi Kivity's avatar Avi Kivity
Browse files

elf: use paths for opening elf objects

dlopen() uses files, so do so as well.  Change DT_NEEDED handling to add the
path.
parent ae138704
No related branches found
No related tags found
No related merge requests found
......@@ -490,7 +490,7 @@ namespace elf {
auto needed = dynamic_str_array(DT_NEEDED);
for (auto lib : needed) {
debug(fmt("needed: %1%") % lib);
_prog.add(lib);
_prog.add(std::string("/usr/lib") + lib);
}
}
......@@ -543,12 +543,11 @@ namespace elf {
elf_object* program::add(std::string name)
{
if (!_files.count(name)) {
std::string pathname = "/usr/lib/" + name;
auto f(_fs.open(pathname));
auto f(_fs.open(name));
if (!f) {
return nullptr;
}
auto ef = new elf_file(*this, f, pathname);
auto ef = new elf_file(*this, f, name);
ef->set_base(_next_alloc);
_files[name] = ef;
ef->load_segments();
......
......@@ -164,7 +164,7 @@ int main(int ac, char **av)
void main_thread(elf::program& prog)
{
test_threads();
prog.add("libjvm.so");
prog.add("/usr/lib/libjvm.so");
auto JNI_GetDefaultJavaVMInitArgs
= prog.lookup_function<void (void*)>("JNI_GetDefaultJavaVMInitArgs");
JavaVMInitArgs vm_args;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment