Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARM: thumb mode flag generating issue #8608

Closed
BredPet opened this issue Jul 20, 2017 · 4 comments
Closed

ARM: thumb mode flag generating issue #8608

BredPet opened this issue Jul 20, 2017 · 4 comments
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI question Answer questions and provide assistance, not an issue with source code or documentation.
Milestone

Comments

@BredPet
Copy link
Contributor

BredPet commented Jul 20, 2017

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?

@BredPet
Copy link
Contributor Author

BredPet commented Jul 20, 2017

@BruceForstall
@jkotas please take a look

@jkotas
Copy link
Member

jkotas commented Jul 20, 2017

  • This path should be taken for virtual or interface calls only. I would not expect this path to be ever taken for RhpUniversalTransition symbol. How did we ended up here with RhpUniversalTransition?
  • 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?

@RussKeldorph
Copy link
Contributor

@dotnet/jit-contrib

@BredPet
Copy link
Contributor Author

BredPet commented Jul 21, 2017

@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!

@BredPet BredPet closed this as completed Jul 21, 2017
@msftgits msftgits transferred this issue from dotnet/coreclr Jan 31, 2020
@msftgits msftgits added this to the Future milestone Jan 31, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI question Answer questions and provide assistance, not an issue with source code or documentation.
Projects
None yet
Development

No branches or pull requests

4 participants