[llvm] r202915 - Fix endianness bug.

Rui Ueyama ruiu at google.com
Tue Mar 4 16:32:35 PST 2014


Author: ruiu
Date: Tue Mar  4 18:32:34 2014
New Revision: 202915

URL: http://llvm.org/viewvc/llvm-project?rev=202915&view=rev
Log:
Fix endianness bug.

Looks like llvm-readobj is the only customer of this code, and apparently
there's no test to cover this function. I'll write it after finishing
plumbing from llvm-objdump to there.

Modified:
    llvm/trunk/include/llvm/Support/Win64EH.h

Modified: llvm/trunk/include/llvm/Support/Win64EH.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Win64EH.h?rev=202915&r1=202914&r2=202915&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Win64EH.h (original)
+++ llvm/trunk/include/llvm/Support/Win64EH.h Tue Mar  4 18:32:34 2014
@@ -108,17 +108,20 @@ struct UnwindInfo {
 
   /// \brief Return pointer to language specific data part of UnwindInfo.
   const void *getLanguageSpecificData() const {
-    return reinterpret_cast<const void *>(&UnwindCodes[(NumCodes+1) & ~1]);
+    return reinterpret_cast<const support::ulittle32_t *>(
+        &UnwindCodes[(NumCodes + 1) & ~1]);
   }
 
   /// \brief Return image-relative offset of language-specific exception handler.
   uint32_t getLanguageSpecificHandlerOffset() const {
-    return *reinterpret_cast<const uint32_t *>(getLanguageSpecificData());
+    return *reinterpret_cast<const support::ulittle32_t *>(
+               getLanguageSpecificData());
   }
 
   /// \brief Set image-relative offset of language-specific exception handler.
   void setLanguageSpecificHandlerOffset(uint32_t offset) {
-    *reinterpret_cast<uint32_t *>(getLanguageSpecificData()) = offset;
+    *reinterpret_cast<support::ulittle32_t *>(getLanguageSpecificData()) =
+        offset;
   }
 
   /// \brief Return pointer to exception-specific data.





More information about the llvm-commits mailing list