ARM: thumb mode flag generating issue
Hi, there is a very strange bug in Legacy JIT.
if (call->gtCallMoreFlags & GTF_CALL_M_VIRTSTUB_REL_INDIRECT)
{
#if CPU_LOAD_STORE_ARCH
callReg = regSet.rsGrabReg(compiler->virtualStubParamInfo->GetRegMask());
noway_assert(callReg == compiler->virtualStubParamInfo->GetReg());
instGen_Set_Reg_To_Imm(EA_HANDLE_CNS_RELOC, compiler->virtualStubParamInfo->GetReg(),
(ssize_t)stubAddr);
// The stub will write-back to this register, so don't track it
regTracker.rsTrackRegTrash(compiler->virtualStubParamInfo->GetReg());
getEmitter()->emitIns_R_R_I(INS_ldr, EA_PTRSIZE, REG_JUMP_THUNK_PARAM,
compiler->virtualStubParamInfo->GetReg(), 0);
regTracker.rsTrackRegTrash(REG_JUMP_THUNK_PARAM);
callTypeStubAddr = emitter::EC_INDIR_R;
getEmitter()->emitIns_Call(emitter::EC_INDIR_R,
NULL, // methHnd
INDEBUG_LDISASM_COMMA(sigInfo) NULL, // addr
args, retSize, gcInfo.gcVarPtrSetCur, gcInfo.gcRegGCrefSetCur,
gcInfo.gcRegByrefSetCur, ilOffset, REG_JUMP_THUNK_PARAM);
When the symbol is loaded into the register REG_JUMP_THUNK_PARAM, it's without thumb +1 flag. Symbol is RhpUniversalTransition from CoreRT. I looked at the code, the relocation should be set to thumb mov32, but why the symbol is eventually loaded without +1 is not clear. Can anyone say anything about this?
@BruceForstall @jkotas please take a look
- This path should be taken for virtual or interface calls only. I would not expect this path to be ever taken for
RhpUniversalTransitionsymbol. How did we ended up here withRhpUniversalTransition? - The ABI for interface calls is different between CoreCLR and CoreRT today. What is the interface call ABI that you are trying to make work for CoreRT on Linux ARM?
@dotnet/jit-contrib
@sergign60 Correct symbol is RhpInitialDynamicInterfaceDispatch at this place, x64 has the same behavior, it loads RhpUniversalTransition at the end. After I implement corresponding stubs, error is gone. I think because of the empty symbols, the pipeline failed in the wrong direction. And RhpInitialDynamicInterfaceDispatch symbol is "special" and CoreRT generates the appropriate relocation for it for ObjWriter. Thanks to all!