Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: src/untrusted/pll_loader/pll_loader.h

Issue 1832623002: PNaCl Dynamic Linking: Using unordered_set to disallow duplicate modules. (Closed) Base URL: https://chromium.googlesource.com/native_client/src/native_client.git@master
Patch Set: Code review Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/untrusted/pll_loader/pll_loader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 17 matching lines...) Expand all
35 void *GetExportedSym(const char *name); 37 void *GetExportedSym(const char *name);
36 void *InstantiateTLSBlock(); 38 void *InstantiateTLSBlock();
37 39
38 private: 40 private:
39 const PLLRoot *root_; 41 const PLLRoot *root_;
40 }; 42 };
41 43
42 // ModuleSet represents a set of loaded PLLs. 44 // ModuleSet represents a set of loaded PLLs.
43 class ModuleSet { 45 class ModuleSet {
44 public: 46 public:
45 // Load a PLL and add it to the set. 47 // Load a PLL by filename. Does not add the filename to a known set of loaded
48 // modules, and will not de-duplicate loading modules.
46 void AddByFilename(const char *filename); 49 void AddByFilename(const char *filename);
47 50
51 // Change the search path used by the linker when looking for PLLs by soname.
52 void SetSonameSearchPath(const std::vector<std::string> &dir_list);
53
54 // Load a PLL by soname and add the soname to the set of loaded modules.
55 void AddBySoname(const char *soname);
56
48 // Looks up a symbol in the set of modules. This does a linear search of 57 // 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(). 58 // the modules, in the order that they were added using AddByFilename().
50 void *GetSym(const char *name); 59 void *GetSym(const char *name);
51 60
52 // Applies relocations to the modules, resolving references between them. 61 // Applies relocations to the modules, resolving references between them.
53 void ResolveRefs(); 62 void ResolveRefs();
54 63
55 private: 64 private:
65 // The search path used to look for "sonames".
66 std::vector<std::string> search_path_;
67 // An unordered set of "sonames" (to see if a module has been loaded).
68 std::unordered_set<std::string> sonames_;
56 std::vector<PLLModule> modules_; 69 std::vector<PLLModule> modules_;
57 }; 70 };
58 71
59 #endif 72 #endif
OLDNEW
« no previous file with comments | « no previous file | src/untrusted/pll_loader/pll_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698