Explorar o código

Fix logic deciding whether to validate in DxcLinker (#2451)

Tex Riddell %!s(int64=6) %!d(string=hai) anos
pai
achega
5e8adfe675
Modificáronse 1 ficheiros con 10 adicións e 2 borrados
  1. 10 2
      tools/clang/tools/dxcompiler/dxclinker.cpp

+ 10 - 2
tools/clang/tools/dxcompiler/dxclinker.cpp

@@ -217,6 +217,15 @@ HRESULT STDMETHODCALLTYPE DxcLinker::Link(
       m_pLinker->SetValidatorVersion(opts.ValVerMajor, opts.ValVerMinor);
     }
 
+    bool needsValidation = !opts.DisableValidation;
+    // Disable validation if ValVerMajor is 0 (offline target, never validate),
+    // or pre-release library targets lib_6_1/lib_6_2.
+    if (opts.ValVerMajor == 0 ||
+        opts.TargetProfile == "lib_6_1" ||
+        opts.TargetProfile == "lib_6_2") {
+      needsValidation = false;
+    }
+
     // Attach libraries.
     bool bSuccess = true;
     for (unsigned i = 0; i < libCount; i++) {
@@ -259,8 +268,7 @@ HRESULT STDMETHODCALLTYPE DxcLinker::Link(
         }
         // Validation.
         HRESULT valHR = S_OK;
-        // Skip validation on lib for now.
-        if (!opts.TargetProfile.startswith("lib_")) {
+        if (needsValidation) {
           valHR = dxcutil::ValidateAndAssembleToContainer(
               std::move(pM), pOutputBlob, pMalloc, SerializeFlags,
               pOutputStream,