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

Side by Side Diff: src/IceASanInstrumentation.cpp

Issue 2068593003: Implemented linking to a dummy ASan runtime (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fixed szbuild.py and improved test Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « src/IceASanInstrumentation.h ('k') | src/IceInstrumentation.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceASanInstrumentation.cpp - ASan ------------*- C++ -*-===// 1 //===- subzero/src/IceASanInstrumentation.cpp - ASan ------------*- C++ -*-===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 /// 9 ///
10 /// \file 10 /// \file
11 /// \brief Implements the AddressSanitizer instrumentation class. 11 /// \brief Implements the AddressSanitizer instrumentation class.
12 /// 12 ///
13 //===----------------------------------------------------------------------===// 13 //===----------------------------------------------------------------------===//
14 14
15 #include "IceASanInstrumentation.h" 15 #include "IceASanInstrumentation.h"
16 16
17 #include "IceBuildDefs.h" 17 #include "IceBuildDefs.h"
18 #include "IceCfgNode.h"
18 #include "IceGlobalInits.h" 19 #include "IceGlobalInits.h"
20 #include "IceInst.h"
19 21
20 #include <sstream> 22 #include <sstream>
21 23
22 namespace Ice { 24 namespace Ice {
23 25
24 namespace { 26 namespace {
25 constexpr SizeT RzSize = 32; 27 constexpr SizeT RzSize = 32;
26 const std::string RzPrefix = "__$rz"; 28 const std::string RzPrefix = "__$rz";
27 const llvm::NaClBitcodeRecord::RecordVector RzContents = 29 const llvm::NaClBitcodeRecord::RecordVector RzContents =
28 llvm::NaClBitcodeRecord::RecordVector(RzSize, 'R'); 30 llvm::NaClBitcodeRecord::RecordVector(RzSize, 'R');
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 Rz->addInitializer( 104 Rz->addInitializer(
103 VariableDeclaration::ZeroInitializer::create(List, RzSize)); 105 VariableDeclaration::ZeroInitializer::create(List, RzSize));
104 } 106 }
105 Rz->setIsConstant(Global->getIsConstant()); 107 Rz->setIsConstant(Global->getIsConstant());
106 RzArray->addInitializer(VariableDeclaration::RelocInitializer::create( 108 RzArray->addInitializer(VariableDeclaration::RelocInitializer::create(
107 List, Rz, RelocOffsetArray(0))); 109 List, Rz, RelocOffsetArray(0)));
108 ++RzArraySize; 110 ++RzArraySize;
109 return Rz; 111 return Rz;
110 } 112 }
111 113
114 void ASanInstrumentation::instrumentStart(Cfg *Func) {
115 Constant *ShadowMemInit =
116 Ctx->getConstantExternSym(Ctx->getGlobalString("__asan_init"));
117 constexpr SizeT NumArgs = 0;
118 constexpr Variable *Void = nullptr;
119 constexpr bool NoTailCall = false;
120
121 auto *Call = InstCall::create(Func, NumArgs, Void, ShadowMemInit, NoTailCall);
122 Func->getEntryNode()->getInsts().push_front(Call);
123 }
124
112 } // end of namespace Ice 125 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceASanInstrumentation.h ('k') | src/IceInstrumentation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698