Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Unified Diff: src/IceASanInstrumentation.cpp

Issue 2256903003: Subzero: Replace pointers to allocation functions in stores (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests_lit/asan_tests/localreplacement.ll » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceASanInstrumentation.cpp
diff --git a/src/IceASanInstrumentation.cpp b/src/IceASanInstrumentation.cpp
index 3978706a1ab5a13c123de5d1677838b09c81aa9b..389760bd5ce162a141305b5aeed5ffe9ad4b95ea 100644
--- a/src/IceASanInstrumentation.cpp
+++ b/src/IceASanInstrumentation.cpp
@@ -389,6 +389,24 @@ void ASanInstrumentation::instrumentLoad(LoweringContext &Context,
void ASanInstrumentation::instrumentStore(LoweringContext &Context,
InstStore *Instr) {
+ Operand *Data = Instr->getData();
+ if (auto *Reloc = llvm::dyn_cast<ConstantRelocatable>(Data)) {
+ std::string DataName = Reloc->getName().toStringOrEmpty();
+ assert(!DataName.empty());
Jim Stichnoth 2016/08/18 13:17:19 I just realized that if you use this pattern: S
tlively 2016/08/18 15:17:48 Done.
+ StringMap::const_iterator DataSub = FuncSubstitutions.find(DataName);
+ if (DataSub != FuncSubstitutions.end()) {
+ auto *NewData = ConstantRelocatable::create(
+ Ctx, Reloc->getType(),
+ RelocatableTuple(Reloc->getOffset(), RelocOffsetArray(0),
+ Ctx->getGlobalString(DataSub->second),
+ Reloc->getEmitString()));
+ auto *NewStore = InstStore::create(Context.getNode()->getCfg(), NewData,
+ Instr->getAddr());
+ Instr->setDeleted();
+ Context.insert(NewStore);
+ Instr = NewStore;
+ }
+ }
Karl 2016/08/18 14:17:01 Minor nit. It appears that instrument load/store l
tlively 2016/08/18 15:17:48 Done.
Constant *Func =
Ctx->getConstantExternSym(Ctx->getGlobalString("__asan_check_store"));
instrumentAccess(Context, Instr->getAddr(),
« no previous file with comments | « no previous file | tests_lit/asan_tests/localreplacement.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698