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> |
| 9 #include <unordered_set> |
8 #include <vector> | 10 #include <vector> |
9 | 11 |
10 #include "native_client/src/untrusted/pll_loader/pll_root.h" | 12 #include "native_client/src/untrusted/pll_loader/pll_root.h" |
11 | 13 |
12 // This helper class wraps the PLLRoot data structure and provides methods | 14 // This helper class wraps the PLLRoot data structure and provides methods |
13 // for accessing parts of PLLRoot. | 15 // for accessing parts of PLLRoot. |
14 class PLLModule { | 16 class PLLModule { |
15 public: | 17 public: |
16 explicit PLLModule(const PLLRoot *root) : root_(root) {} | 18 explicit PLLModule(const PLLRoot *root) : root_(root) {} |
17 | 19 |
(...skipping 28 matching lines...) Expand all Loading... |
46 void AddByFilename(const char *filename); | 48 void AddByFilename(const char *filename); |
47 | 49 |
48 // Looks up a symbol in the set of modules. This does a linear search of | 50 // Looks up a symbol in the set of modules. This does a linear search of |
49 // the modules, in the order that they were added using AddByFilename(). | 51 // the modules, in the order that they were added using AddByFilename(). |
50 void *GetSym(const char *name); | 52 void *GetSym(const char *name); |
51 | 53 |
52 // Applies relocations to the modules, resolving references between them. | 54 // Applies relocations to the modules, resolving references between them. |
53 void ResolveRefs(); | 55 void ResolveRefs(); |
54 | 56 |
55 private: | 57 private: |
| 58 // An unordered set of "sonames" (to see if a module has been loaded) and the |
| 59 // modules themselves. |
| 60 std::unordered_set<std::string> sonames_; |
56 std::vector<PLLModule> modules_; | 61 std::vector<PLLModule> modules_; |
57 }; | 62 }; |
58 | 63 |
59 #endif | 64 #endif |
OLD | NEW |