Index: src/untrusted/pll_loader/pll_loader.cc |
diff --git a/src/untrusted/pll_loader/pll_loader.cc b/src/untrusted/pll_loader/pll_loader.cc |
index 46e496aa30eb780882bf1123f2ab79739a7c1311..b831a35a1040fa1512d580fb0b16dcc576667027 100644 |
--- a/src/untrusted/pll_loader/pll_loader.cc |
+++ b/src/untrusted/pll_loader/pll_loader.cc |
@@ -9,6 +9,7 @@ |
#include <sys/stat.h> |
#include <algorithm> |
+#include <string> |
#include "native_client/src/shared/platform/nacl_log.h" |
#include "native_client/src/untrusted/pnacl_dynloader/dynloader.h" |
@@ -92,7 +93,8 @@ void ModuleSet::SetSonameSearchPath(const std::vector<std::string> &dir_list) { |
void ModuleSet::AddBySoname(const char *soname) { |
// TODO(smklein): Deduplicate rather than failing once dependencies are added. |
Mark Seaborn
2016/03/30 23:24:57
You can remove this since you've addressed it.
Sean Klein
2016/04/01 23:12:24
Done.
|
if (sonames_.count(soname) != 0) { |
- NaClLog(LOG_FATAL, "PLL Loader found duplicate soname: %s\n", soname); |
+ // This module has already been added to the ModuleSet. |
+ return; |
} |
sonames_.insert(soname); |
@@ -102,6 +104,7 @@ void ModuleSet::AddBySoname(const char *soname) { |
// point to the same file. |
path.append("/"); |
path.append(soname); |
+ path.append(".translated"); |
struct stat buf; |
if (stat(path.c_str(), &buf) == 0) { |
AddByFilename(path.c_str()); |
@@ -116,9 +119,20 @@ void ModuleSet::AddByFilename(const char *filename) { |
void *pso_root; |
int err = pnacl_load_elf_file(filename, &pso_root); |
if (err != 0) { |
- NaClLog(LOG_FATAL, "pnacl_load_elf_file() failed: errno=%d\n", err); |
+ NaClLog(LOG_FATAL, |
+ "pll_loader could not open %s: errno=%d\n", filename, err); |
+ } |
+ const PLLModule module = PLLModule((const PLLRoot *) pso_root); |
Mark Seaborn
2016/03/30 23:24:57
Just:
PLLModule module((const PLLRoot *) pso_root)
Sean Klein
2016/04/01 23:12:24
Done, but with const as well.
|
+ modules_.push_back(module); |
+ const char *dependencies_list = module.GetDependenciesList(); |
+ size_t dependencies_count = module.GetDependenciesCount(); |
+ size_t string_index = 0; |
Mark Seaborn
2016/03/30 23:24:57
Maybe "offset" rather than "index"?
Sean Klein
2016/04/01 23:12:24
Done.
|
+ for (size_t i = 0; i < dependencies_count; i++) { |
+ std::string dependency_filename(dependencies_list + string_index); |
+ string_index += dependency_filename.length() + 1; |
+ dependency_filename.append(".translated"); |
+ AddByFilename(dependency_filename.c_str()); |
} |
- modules_.push_back(PLLModule((const PLLRoot *) pso_root)); |
} |
void *ModuleSet::GetSym(const char *name) { |