llvm.org GIT mirror llvm / 15a6377
Merge 81888 from mainline. Change the marker byte for stubs from 0xcd to 0xce (another form of interrupt instruction, which shouldn't arise any other way). 0xcd is also used by JITMemoryManager to initialize the buffer to garbage, which means it could appear following a noreturn call even when that is not a stub, confusing X86CompilationCallback2. PR 4929. git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_26@81981 91177308-0d34-0410-b5e6-96231b3b80d8 Tanya Lattner 10 years ago
1 changed file(s) with 6 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
337337 "Could not find return address on the stack!");
339339 // It's a stub if there is an interrupt marker after the call.
340 bool isStub = ((unsigned char*)RetAddr)[0] == 0xCD;
340 bool isStub = ((unsigned char*)RetAddr)[0] == 0xCE;
342342 // The call instruction should have pushed the return value onto the stack...
343343 #if defined (X86_64_JIT)
376376 // If this is a stub, rewrite the call into an unconditional branch
377377 // instruction so that two return addresses are not pushed onto the stack
378378 // when the requested function finally gets called. This also makes the
379 // 0xCD byte (interrupt) dead, so the marker doesn't effect anything.
379 // 0xCE byte (interrupt) dead, so the marker doesn't effect anything.
380380 #if defined (X86_64_JIT)
381381 // If the target address is within 32-bit range of the stub, use a
382382 // PC-relative branch instead of loading the actual address. (This is
485485 JCE.emitWordLE((intptr_t)Fn-JCE.getCurrentPCValue()-4);
486486 #endif
488 JCE.emitByte(0xCD); // Interrupt - Just a marker identifying the stub!
488 // This used to use 0xCD, but that value is used by JITMemoryManager to
489 // initialize the buffer with garbage, which means it may follow a
490 // noreturn function call, confusing X86CompilationCallback2. PR 4929.
491 JCE.emitByte(0xCE); // Interrupt - Just a marker identifying the stub!
489492 return JCE.finishGVStub(F);
490493 }