Bug 1470488 - don't instrument win32's xptcall SharedStub; r=froydnj
authorDavid Major <dmajor@mozilla.com>
Fri, 22 Jun 2018 13:51:13 -0400
changeset 809865 b92e2898ab18c5087924488be1b21de53db06b12
parent 809864 a93c47f5147fa912d39230c580066fcc45b26b7f
child 809866 b04c3943f7b29472223bc78c29a43a28ad94f558
push id113833
push userbmo:ato@sny.no
push dateSat, 23 Jun 2018 12:17:51 +0000
reviewersfroydnj
bugs1470488
milestone62.0a1
Bug 1470488 - don't instrument win32's xptcall SharedStub; r=froydnj Compiler-inserted instrumentation is going to do terrible things to this function, so don't let the compiler do that.
xpcom/reflect/xptcall/md/win32/xptcstubs.cpp
--- a/xpcom/reflect/xptcall/md/win32/xptcstubs.cpp
+++ b/xpcom/reflect/xptcall/md/win32/xptcstubs.cpp
@@ -90,16 +90,21 @@ PrepareAndDispatch(nsXPTCStubBase* self,
 }
 
 } // extern "C"
 
 // declspec(naked) is broken in gcc
 #if !defined(__GNUC__)
 static
 __declspec(naked)
+// Compiler-inserted instrumentation is going to botch our assembly below,
+// so forbid the compiler from doing that.
+#if defined(__clang__)
+__attribute__((no_instrument_function))
+#endif
 void SharedStub(void)
 {
     __asm {
         push ebp            // set up simple stack frame
         mov  ebp, esp       // stack has: ebp/vtbl_index/retaddr/this/args
         push ecx            // make room for a ptr
         lea  eax, [ebp-4]   // pointer to stackBytesToPop
         push eax