[PATCH] D15728: [cfi] Support for dlopen and dlclose
Peter Collingbourne via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 15 14:09:49 PST 2016
pcc added inline comments.
================
Comment at: lib/cfi/cfi.cc:235-261
@@ +234,29 @@
+ LoadedModule *modules_after = (LoadedModule *)MmapOrDie(
+ kMaxNumberOfModules * sizeof(LoadedModule), "ShadowUpdater");
+ uptr modules_after_cnt =
+ GetListOfModules(modules_after, kMaxNumberOfModules, nullptr);
+
+ InternalSort(&modules_before, modules_before_cnt, LoadedModuleCompare);
+ InternalSort(&modules_after, modules_after_cnt, LoadedModuleCompare);
+
+ LoadedModule *p = modules_before;
+ LoadedModule *p_end = p + modules_before_cnt;
+ LoadedModule *q = modules_after;
+ LoadedModule *q_end = q + modules_after_cnt;
+ while (p < p_end && q < q_end) {
+ if (p->base_address() < q->base_address()) {
+ remove_module(p++);
+ } else if (p->base_address() > q->base_address()) {
+ add_module(q++);
+ } else {
+ p++;
+ q++;
+ }
+ }
+ while (p < p_end)
+ remove_module(p++);
+ while (q < q_end)
+ add_module(q++);
+
+ UnmapOrDie(modules_before, kMaxNumberOfModules * sizeof(LoadedModule));
+ modules_before = modules_after;
----------------
Yes, that's why I was thinking this would need to be done after D16098. If it's too painful to re-order the patches I'd be fine with combining them.
Repository:
rL LLVM
http://reviews.llvm.org/D15728
More information about the llvm-commits
mailing list