File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed
lib/Transforms/Instrumentation Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -593,6 +593,7 @@ class Module {
593
593
const_global_iterator global_begin () const { return GlobalList.begin (); }
594
594
global_iterator global_end () { return GlobalList.end (); }
595
595
const_global_iterator global_end () const { return GlobalList.end (); }
596
+ size_t global_size () const { return GlobalList.size (); }
596
597
bool global_empty () const { return GlobalList.empty (); }
597
598
598
599
iterator_range<global_iterator> globals () {
Original file line number Diff line number Diff line change @@ -811,16 +811,25 @@ bool DataFlowSanitizer::runOnModule(Module &M) {
811
811
if (ABIList.isIn (M, " skip" ))
812
812
return false ;
813
813
814
+ const unsigned InitialGlobalSize = M.global_size ();
815
+ const unsigned InitialModuleSize = M.size ();
816
+
817
+ bool Changed = false ;
818
+
814
819
if (!GetArgTLSPtr) {
815
820
Type *ArgTLSTy = ArrayType::get (ShadowTy, 64 );
816
821
ArgTLS = Mod->getOrInsertGlobal (" __dfsan_arg_tls" , ArgTLSTy);
817
- if (GlobalVariable *G = dyn_cast<GlobalVariable>(ArgTLS))
822
+ if (GlobalVariable *G = dyn_cast<GlobalVariable>(ArgTLS)) {
823
+ Changed |= G->getThreadLocalMode () != GlobalVariable::InitialExecTLSModel;
818
824
G->setThreadLocalMode (GlobalVariable::InitialExecTLSModel);
825
+ }
819
826
}
820
827
if (!GetRetvalTLSPtr) {
821
828
RetvalTLS = Mod->getOrInsertGlobal (" __dfsan_retval_tls" , ShadowTy);
822
- if (GlobalVariable *G = dyn_cast<GlobalVariable>(RetvalTLS))
829
+ if (GlobalVariable *G = dyn_cast<GlobalVariable>(RetvalTLS)) {
830
+ Changed |= G->getThreadLocalMode () != GlobalVariable::InitialExecTLSModel;
823
831
G->setThreadLocalMode (GlobalVariable::InitialExecTLSModel);
832
+ }
824
833
}
825
834
826
835
ExternalShadowMask =
@@ -1044,7 +1053,8 @@ bool DataFlowSanitizer::runOnModule(Module &M) {
1044
1053
}
1045
1054
}
1046
1055
1047
- return false ;
1056
+ return Changed || !FnsToInstrument.empty () ||
1057
+ M.global_size () != InitialGlobalSize || M.size () != InitialModuleSize;
1048
1058
}
1049
1059
1050
1060
Value *DFSanFunction::getArgTLSPtr () {
You can’t perform that action at this time.
0 commit comments