[llvm] f8e783f - [DX] Speculative fix for big endian encoding

Chris Bieneman via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 1 21:22:24 PST 2023


Author: Chris Bieneman
Date: 2023-02-01T23:19:35-06:00
New Revision: f8e783f1662812a0a417e463f1ea646c96bb0743

URL: https://github.com/llvm/llvm-project/commit/f8e783f1662812a0a417e463f1ea646c96bb0743
DIFF: https://github.com/llvm/llvm-project/commit/f8e783f1662812a0a417e463f1ea646c96bb0743.diff

LOG: [DX] Speculative fix for big endian encoding

I missed byte swapping the size field.

Added: 
    

Modified: 
    llvm/lib/MC/DXContainerPSVInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/MC/DXContainerPSVInfo.cpp b/llvm/lib/MC/DXContainerPSVInfo.cpp
index 5463f850be1e..399f54c8332f 100644
--- a/llvm/lib/MC/DXContainerPSVInfo.cpp
+++ b/llvm/lib/MC/DXContainerPSVInfo.cpp
@@ -26,6 +26,8 @@ void PSVRuntimeInfo::write(raw_ostream &OS, uint32_t Version) const {
   default:
     InfoSize = sizeof(dxbc::PSV::v2::RuntimeInfo);
   }
+  if (sys::IsBigEndianHost)
+    sys::swapByteOrder(InfoSize);
   // Write the size of the info.
   OS.write(reinterpret_cast<const char *>(&InfoSize), sizeof(uint32_t));
   // Write the info itself.


        


More information about the llvm-commits mailing list