[compiler-rt] r277567 - [compilter-rt] Try to fix correctly rL277560

Etienne Bergeron via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 2 22:03:35 PDT 2016


Author: etienneb
Date: Wed Aug  3 00:03:35 2016
New Revision: 277567

URL: http://llvm.org/viewvc/llvm-project?rev=277567&view=rev
Log:
[compilter-rt] Try to fix correctly rL277560

rL277560: [compiler-rt] Fix broken interception unittest

Modified:
    compiler-rt/trunk/lib/interception/interception_win.cc
    compiler-rt/trunk/lib/interception/tests/interception_win_test.cc

Modified: compiler-rt/trunk/lib/interception/interception_win.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/interception/interception_win.cc?rev=277567&r1=277566&r2=277567&view=diff
==============================================================================
--- compiler-rt/trunk/lib/interception/interception_win.cc (original)
+++ compiler-rt/trunk/lib/interception/interception_win.cc Wed Aug  3 00:03:35 2016
@@ -462,6 +462,11 @@ static size_t GetInstructionSize(uptr ad
       return 0;
   }
 
+  switch (0x00FFFFFF & *(u32*)address) {
+    case 0x24A48D:  // 8D A4 24 XX XX XX XX : lea esp, [esp + XX XX XX XX]
+      return 7;
+  }
+
 #if SANITIZER_WINDOWS64
   switch (*(u8*)address) {
     case 0xA1:  // A1 XX XX XX XX XX XX XX XX :
@@ -570,9 +575,6 @@ static size_t GetInstructionSize(uptr ad
     case 0x24748B:  // 8B 74 24 XX : mov esi, dword ptr [esp + XX]
     case 0x247C8B:  // 8B 7C 24 XX : mov edi, dword ptr [esp + XX]
       return 4;
-
-    case 0x24A48D:  // 8D A4 24 XX XX XX XX : lea esp, [esp + XX XX XX XX]
-      return 7;
   }
 
   switch (*(u32*)address) {

Modified: compiler-rt/trunk/lib/interception/tests/interception_win_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/interception/tests/interception_win_test.cc?rev=277567&r1=277566&r2=277567&view=diff
==============================================================================
--- compiler-rt/trunk/lib/interception/tests/interception_win_test.cc (original)
+++ compiler-rt/trunk/lib/interception/tests/interception_win_test.cc Wed Aug  3 00:03:35 2016
@@ -481,11 +481,7 @@ TEST(Interception, PatchableFunction) {
   EXPECT_TRUE(TestFunctionPatching(kPatchableCode3, override));
 #endif
   EXPECT_TRUE(TestFunctionPatching(kPatchableCode4, override));
-#if SANITIZER_WINDOWS64
-  EXPECT_FALSE(TestFunctionPatching(kPatchableCode5, override));
-#else
   EXPECT_TRUE(TestFunctionPatching(kPatchableCode5, override));
-#endif
 
   EXPECT_FALSE(TestFunctionPatching(kUnpatchableCode1, override));
   EXPECT_FALSE(TestFunctionPatching(kUnpatchableCode2, override));




More information about the llvm-commits mailing list