diff options
| author | Etienne Bergeron <etienneb@google.com> | 2016-08-03 05:03:35 +0000 |
|---|---|---|
| committer | Etienne Bergeron <etienneb@google.com> | 2016-08-03 05:03:35 +0000 |
| commit | 2bb23bfc73b1c56cb3e8638f908eb168665b8e15 (patch) | |
| tree | 1fa7c53600f220fd46d474ec717ff4d134608c94 /compiler-rt/lib/interception | |
| parent | d6bd1371fc4b540098285e5e2bf673879cf709f5 (diff) | |
| download | bcm5719-llvm-2bb23bfc73b1c56cb3e8638f908eb168665b8e15.tar.gz bcm5719-llvm-2bb23bfc73b1c56cb3e8638f908eb168665b8e15.zip | |
[compilter-rt] Try to fix correctly rL277560
rL277560: [compiler-rt] Fix broken interception unittest
llvm-svn: 277567
Diffstat (limited to 'compiler-rt/lib/interception')
| -rw-r--r-- | compiler-rt/lib/interception/interception_win.cc | 8 | ||||
| -rw-r--r-- | compiler-rt/lib/interception/tests/interception_win_test.cc | 4 |
2 files changed, 5 insertions, 7 deletions
diff --git a/compiler-rt/lib/interception/interception_win.cc b/compiler-rt/lib/interception/interception_win.cc index 07acedb30d6..c8d67b97668 100644 --- a/compiler-rt/lib/interception/interception_win.cc +++ b/compiler-rt/lib/interception/interception_win.cc @@ -462,6 +462,11 @@ static size_t GetInstructionSize(uptr address, size_t* rel_offset = nullptr) { 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 address, size_t* rel_offset = nullptr) { 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) { diff --git a/compiler-rt/lib/interception/tests/interception_win_test.cc b/compiler-rt/lib/interception/tests/interception_win_test.cc index 7d18ce99adc..67b40f70146 100644 --- a/compiler-rt/lib/interception/tests/interception_win_test.cc +++ b/compiler-rt/lib/interception/tests/interception_win_test.cc @@ -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)); |

