[PATCH] D15644: [asan] Use private aliases for global variables (compiler-rt part).

Yury Gribov via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 19 13:07:41 PST 2016


ygribov added a comment.

I guess you need to update asan_init version.


================
Comment at: lib/asan/asan_globals.cc:139
@@ +138,3 @@
+// Check ODR violation for given global G via special ODR indicator. We use
+// this method in case of compiler uses private aliases for global variables.
+static void CheckODRViolationViaIndicator(const Global *g) {
----------------
"in case compiler instruments global variables through their local aliases"?

================
Comment at: lib/asan/asan_globals.cc:143
@@ +142,3 @@
+  // If *odr_indicator is not zero, some module have already registred
+  // externally visible symbol with the same name. This is an ODR vioation.
+  if (*odr_indicator != 0) {
----------------
s/registred/registered/, s/vioation/violation/

================
Comment at: lib/asan/asan_globals.cc:144
@@ +143,3 @@
+  // externally visible symbol with the same name. This is an ODR vioation.
+  if (*odr_indicator != 0) {
+    for (ListOfGlobals *l = list_of_all_globals; l; l = l->next) {
----------------
You could simplify a bit by doing the easy case first and then early-exiting.

================
Comment at: lib/asan/asan_globals.cc:247
@@ +246,3 @@
+    u8 *odr_indicator = reinterpret_cast<u8 *>(g->odr_indicator);
+    *odr_indicator = 0;
+  }
----------------
What if indicator was set by a different module?


Repository:
  rL LLVM

http://reviews.llvm.org/D15644





More information about the llvm-commits mailing list