[llvm] fc1df36 - [ASAN] NFC: Copy address space when creating globals with redzones
Reshabh Sharma via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 28 21:52:52 PDT 2021
Author: Reshabh Sharma
Date: 2021-04-29T10:21:43+05:30
New Revision: fc1df36e6e402cadb46befd32c4d195a4096477b
URL: https://github.com/llvm/llvm-project/commit/fc1df36e6e402cadb46befd32c4d195a4096477b
DIFF: https://github.com/llvm/llvm-project/commit/fc1df36e6e402cadb46befd32c4d195a4096477b.diff
LOG: [ASAN] NFC: Copy address space when creating globals with redzones
This patch makes sure that globals in supported address spaces
will be replaced by globals with red zones in the same address
space by copying the address space.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D101362
Added:
Modified:
llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
index cb48da63275c4..1b327f651badc 100644
--- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -2364,9 +2364,9 @@ bool ModuleAddressSanitizer::InstrumentGlobals(IRBuilder<> &IRB, Module &M,
GlobalValue::LinkageTypes Linkage = G->getLinkage();
if (G->isConstant() && Linkage == GlobalValue::PrivateLinkage)
Linkage = GlobalValue::InternalLinkage;
- GlobalVariable *NewGlobal =
- new GlobalVariable(M, NewTy, G->isConstant(), Linkage, NewInitializer,
- "", G, G->getThreadLocalMode());
+ GlobalVariable *NewGlobal = new GlobalVariable(
+ M, NewTy, G->isConstant(), Linkage, NewInitializer, "", G,
+ G->getThreadLocalMode(), G->getAddressSpace());
NewGlobal->copyAttributesFrom(G);
NewGlobal->setComdat(G->getComdat());
NewGlobal->setAlignment(MaybeAlign(getMinRedzoneSizeForGlobal()));
More information about the llvm-commits
mailing list