OLD | NEW |
1 // Copyright 2016 The Native Client Authors. All rights reserved. | 1 // Copyright 2016 The Native Client Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NATIVE_CLIENT_SRC_UNTRUSTED_PLL_LOADER_PLL_LOADER_H_ | 5 #ifndef NATIVE_CLIENT_SRC_UNTRUSTED_PLL_LOADER_PLL_LOADER_H_ |
6 #define NATIVE_CLIENT_SRC_UNTRUSTED_PLL_LOADER_PLL_LOADER_H_ 1 | 6 #define NATIVE_CLIENT_SRC_UNTRUSTED_PLL_LOADER_PLL_LOADER_H_ 1 |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <unordered_set> | 9 #include <unordered_set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 29 matching lines...) Expand all Loading... |
40 | 40 |
41 private: | 41 private: |
42 const PLLRoot *root_; | 42 const PLLRoot *root_; |
43 }; | 43 }; |
44 | 44 |
45 // ModuleSet represents a set of loaded PLLs. | 45 // ModuleSet represents a set of loaded PLLs. |
46 class ModuleSet { | 46 class ModuleSet { |
47 public: | 47 public: |
48 // Load a PLL by filename. Does not add the filename to a known set of loaded | 48 // Load a PLL by filename. Does not add the filename to a known set of loaded |
49 // modules, and will not de-duplicate loading modules. | 49 // modules, and will not de-duplicate loading modules. |
50 void AddByFilename(const char *filename); | 50 // Returns a pointer to the PLL's pso_root. |
| 51 PLLRoot *AddByFilename(const char *filename); |
51 | 52 |
52 // Change the search path used by the linker when looking for PLLs by soname. | 53 // Change the search path used by the linker when looking for PLLs by soname. |
53 void SetSonameSearchPath(const std::vector<std::string> &dir_list); | 54 void SetSonameSearchPath(const std::vector<std::string> &dir_list); |
54 | 55 |
55 // Load a PLL by soname and add the soname to the set of loaded modules. | 56 // Load a PLL by soname and add the soname to the set of loaded modules. |
56 void AddBySoname(const char *soname); | 57 // Returns a pointer to the PLL's pso_root if it is loaded, NULL otherwise. |
| 58 PLLRoot *AddBySoname(const char *soname); |
57 | 59 |
58 // Looks up a symbol in the set of modules. This does a linear search of | 60 // Looks up a symbol in the set of modules. This does a linear search of |
59 // the modules, in the order that they were added using AddByFilename(). | 61 // the modules, in the order that they were added using AddByFilename(). |
60 void *GetSym(const char *name); | 62 void *GetSym(const char *name); |
61 | 63 |
62 // Applies relocations to the modules, resolving references between them. | 64 // Applies relocations to the modules, resolving references between them. |
63 void ResolveRefs(); | 65 void ResolveRefs(); |
64 | 66 |
65 private: | 67 private: |
66 // The search path used to look for "sonames". | 68 // The search path used to look for "sonames". |
67 std::vector<std::string> search_path_; | 69 std::vector<std::string> search_path_; |
68 // An unordered set of "sonames" (to see if a module has been loaded). | 70 // An unordered set of "sonames" (to see if a module has been loaded). |
69 std::unordered_set<std::string> sonames_; | 71 std::unordered_set<std::string> sonames_; |
70 std::vector<PLLModule> modules_; | 72 std::vector<PLLModule> modules_; |
71 }; | 73 }; |
72 | 74 |
73 #endif | 75 #endif |
OLD | NEW |