[PATCH] D29168: [compiler-rt] Use interception to access to strong functions defined in the main executable.

Marcos Pividori via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 2 13:46:18 PST 2017


mpividori added inline comments.


================
Comment at: lib/sanitizer_common/sanitizer_win_weak_interception.cc:34-35
+    (void *)GetModuleHandleA(0), real_function);
+  if (real && !__interception::OverrideFunction((uptr)dll_function, real, 0))
+    abort();
+  return 0;
----------------
zturner wrote:
> I don't have a strong opinion here, but if the override fails, should it abort, or should it just behave as if the function was not found?
I think it is appropriate to fail.
If the user has provided a strong definition (that means we can find it with `InternalGetProcAddress()`) then we should use it. We can not ignore it because it would be incorrect. If we can not override it, then we should fail because otherwise the program would behave in an unexpected way.
Is the same that we do on dll_thunks in `https://reviews.llvm.org/D29154`. If it fails to override the function, it aborts.


https://reviews.llvm.org/D29168





More information about the llvm-commits mailing list