[PATCH] D55794: [asan] In llvm.asan.globals, allow entries to be non-GlobalVariable and skip over them

John McCall via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 17 15:49:16 PST 2018


rjmccall added a comment.

Thanks!  I think the only real question here is whether the entry should be *skipped* if it isn't directly a global variable or if you should `stripPointerCasts()` to try to find the global.

For the IR-linker example I gave you, it's probably reasonable to assume that if the global is in `llvm.asan.globals` in one module, it's there in all of them, just possibly with a different type.  Assuming the linker picks a type for the global that corresponds to its type from at least one of the input modules (I.e. it doesn't just invent an arbitrarily different type from whole cloth), that means there should be at least one uncasted entry in `llvm.asan.globals`.

On the other hand, it's probably more resilient to strip casts.  This would also handle the case where e.g. a global-initialization optimization sees something weird, like a pointer-typed global being initialized with a float, and decides that its best option is to rewrite the global's type.  That shouldn't result in the global being dropped from `llvm.asan.globals`.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55794/new/

https://reviews.llvm.org/D55794





More information about the llvm-commits mailing list