[PATCH] D15642: [asan] Use private aliases for global variables (LLVM part).
Maxim Ostapenko via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 20 06:16:11 PST 2016
m.ostapenko added inline comments.
================
Comment at: lib/Transforms/Instrumentation/AddressSanitizer.cpp:1399
@@ +1398,3 @@
+
+ if (ClUsePrivateAliasForGlobals) {
+ // Create local alias for NewGlobal to avoid crash on ODR between
----------------
ygribov wrote:
> Would it make sense to disable this on platforms that don't have aliases (Windows and maybe OSX)?
Yes, you are right, perhaps something like this:
```
bool CanUsePrivateAliases = TargetTriple.isOSBinFormatELF();
if (CanUsePrivateAliases && ClUsePrivateAliasForGlobals) {
...
```
?
================
Comment at: lib/Transforms/Instrumentation/AddressSanitizer.cpp:1408
@@ +1407,3 @@
+ // _odr_genXXX to detect ODR violation.
+ auto *ODRIndicatorSym =
+ new GlobalVariable(M, IRB.getInt8Ty(), false, Linkage,
----------------
ygribov wrote:
> Perhaps just reuse ODRIndicator here?
I use ODRIndicatorSym->copyAttributesFrom() that would be inaccessible if use ODRIndicator (that is Constant *). Perhaps we can change it's type to support copyAttributesFrom() interface, but I failed to find reasonable default value for it. If use Constant *, we can just use zero.
Repository:
rL LLVM
http://reviews.llvm.org/D15642
More information about the llvm-commits
mailing list