@@ -56,6 +56,27 @@ bool swift::writeTBD(ModuleDecl *M, StringRef OutputFilename,
5656 return false ;
5757}
5858
59+ // / Determine if a symbol name is ignored when validating the TBD's contents
60+ // / against the IR's.
61+ // /
62+ // / \param name The name of the symbol in question.
63+ // / \param IRModule The module being validated.
64+ // /
65+ // / \returns Whether or not the presence or absence of the symbol named \a name
66+ // / should be ignored (instead of potentially producing a diagnostic.)
67+ static bool isSymbolIgnored (const StringRef& name,
68+ const llvm::Module &IRModule) {
69+ if (llvm::Triple (IRModule.getTargetTriple ()).isOSWindows ()) {
70+ // (SR-15938) Error when referencing #dsohandle in a Swift test on Windows
71+ // On Windows, ignore the lack of __ImageBase in the TBD file.
72+ if (name == " __ImageBase" ) {
73+ return true ;
74+ }
75+ }
76+
77+ return false ;
78+ }
79+
5980static bool validateSymbols (DiagnosticEngine &diags,
6081 const std::vector<std::string> &symbols,
6182 const llvm::Module &IRModule,
@@ -77,6 +98,11 @@ static bool validateSymbols(DiagnosticEngine &diags,
7798 // with what TBDGen created.
7899 auto unmangledName = nameValue.getKey ();
79100
101+ if (isSymbolIgnored (unmangledName, IRModule)) {
102+ // This symbol should not affect validation. Skip it.
103+ continue ;
104+ }
105+
80106 SmallString<128 > name;
81107 llvm::Mangler::getNameWithPrefix (name, unmangledName,
82108 IRModule.getDataLayout ());
0 commit comments