@@ -526,6 +526,11 @@ class RuntimeDyldCheckerExprEval {
526
526
527
527
uint64_t LoadAddr = LoadAddrExprResult.getValue ();
528
528
529
+ // If there is no error but the content pointer is null then this is a
530
+ // zero-fill symbol/section.
531
+ if (LoadAddr == 0 )
532
+ return std::make_pair (0 , RemainingExpr);
533
+
529
534
return std::make_pair (
530
535
EvalResult (Checker.readMemoryAtAddr (LoadAddr, ReadSize)),
531
536
RemainingExpr);
@@ -735,8 +740,12 @@ uint64_t RuntimeDyldCheckerImpl::getSymbolLocalAddr(StringRef Symbol) const {
735
740
logAllUnhandledErrors (SymInfo.takeError (), errs (), " RTDyldChecker: " );
736
741
return 0 ;
737
742
}
743
+
744
+ if (SymInfo->isZeroFill ())
745
+ return 0 ;
746
+
738
747
return static_cast <uint64_t >(
739
- reinterpret_cast <uintptr_t >(SymInfo->Content .data ()));
748
+ reinterpret_cast <uintptr_t >(SymInfo->getContent () .data ()));
740
749
}
741
750
742
751
uint64_t RuntimeDyldCheckerImpl::getSymbolRemoteAddr (StringRef Symbol) const {
@@ -746,7 +755,7 @@ uint64_t RuntimeDyldCheckerImpl::getSymbolRemoteAddr(StringRef Symbol) const {
746
755
return 0 ;
747
756
}
748
757
749
- return SymInfo->TargetAddress ;
758
+ return SymInfo->getTargetAddress () ;
750
759
}
751
760
752
761
uint64_t RuntimeDyldCheckerImpl::readMemoryAtAddr (uint64_t SrcAddr,
@@ -774,7 +783,7 @@ StringRef RuntimeDyldCheckerImpl::getSymbolContent(StringRef Symbol) const {
774
783
logAllUnhandledErrors (SymInfo.takeError (), errs (), " RTDyldChecker: " );
775
784
return StringRef ();
776
785
}
777
- return SymInfo->Content ;
786
+ return SymInfo->getContent () ;
778
787
}
779
788
780
789
std::pair<uint64_t , std::string> RuntimeDyldCheckerImpl::getSectionAddr (
@@ -796,10 +805,13 @@ std::pair<uint64_t, std::string> RuntimeDyldCheckerImpl::getSectionAddr(
796
805
797
806
uint64_t Addr = 0 ;
798
807
799
- if (IsInsideLoad)
800
- Addr = pointerToJITTargetAddress (SecInfo->Content .data ());
801
- else
802
- Addr = SecInfo->TargetAddress ;
808
+ if (IsInsideLoad) {
809
+ if (SecInfo->isZeroFill ())
810
+ Addr = 0 ;
811
+ else
812
+ Addr = pointerToJITTargetAddress (SecInfo->getContent ().data ());
813
+ } else
814
+ Addr = SecInfo->getTargetAddress ();
803
815
804
816
return std::make_pair (Addr, " " );
805
817
}
@@ -823,10 +835,12 @@ std::pair<uint64_t, std::string> RuntimeDyldCheckerImpl::getStubOrGOTAddrFor(
823
835
824
836
uint64_t Addr = 0 ;
825
837
826
- if (IsInsideLoad)
827
- Addr = pointerToJITTargetAddress (StubInfo->Content .data ());
828
- else
829
- Addr = StubInfo->TargetAddress ;
838
+ if (IsInsideLoad) {
839
+ if (StubInfo->isZeroFill ())
840
+ return std::make_pair ((uint64_t )0 , " Detected zero-filled stub/GOT entry" );
841
+ Addr = pointerToJITTargetAddress (StubInfo->getContent ().data ());
842
+ } else
843
+ Addr = StubInfo->getTargetAddress ();
830
844
831
845
return std::make_pair (Addr, " " );
832
846
}
0 commit comments