@@ -2732,6 +2732,9 @@ handle_thunk (MonoCompile *cfg, guchar *code, const guchar *target)
2732
2732
if (!cfg -> arch .thunks ) {
2733
2733
cfg -> arch .thunks = cfg -> thunks ;
2734
2734
cfg -> arch .thunks_size = cfg -> thunk_area ;
2735
+ #ifdef THUNK_ADDR_ALIGNMENT
2736
+ cfg -> arch .thunks = ALIGN_TO (cfg -> arch .thunks , THUNK_ADDR_ALIGNMENT );
2737
+ #endif
2735
2738
}
2736
2739
thunks = cfg -> arch .thunks ;
2737
2740
thunks_size = cfg -> arch .thunks_size ;
@@ -3907,11 +3910,11 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
3907
3910
if (cfg -> compile_aot && ins -> sreg1 == ppc_r12 ) {
3908
3911
/* The trampolines clobber this */
3909
3912
ppc_mr (code , ppc_r29 , ins -> sreg1 );
3910
- ppc_ldptr (code , ppc_r0 , ins -> inst_offset , ppc_r29 );
3913
+ ppc_ldptr (code , ppc_r12 , ins -> inst_offset , ppc_r29 );
3911
3914
} else {
3912
- ppc_ldptr (code , ppc_r0 , ins -> inst_offset , ins -> sreg1 );
3915
+ ppc_ldptr (code , ppc_r12 , ins -> inst_offset , ins -> sreg1 );
3913
3916
}
3914
- ppc_mtlr (code , ppc_r0 );
3917
+ ppc_mtlr (code , ppc_r12 );
3915
3918
ppc_blrl (code );
3916
3919
/* FIXME: this should be handled somewhere else in the new jit */
3917
3920
code = emit_move_return_value (cfg , ins , code );
@@ -5556,6 +5559,14 @@ mono_arch_emit_exceptions (MonoCompile *cfg)
5556
5559
}
5557
5560
5558
5561
set_code_cursor (cfg , code );
5562
+
5563
+ #ifdef THUNK_ADDR_ALIGNMENT
5564
+ /* We need to align thunks_offset to 8 byte boundary, hence allocating first 8 bytes
5565
+ for padding purpose */
5566
+ if (cfg -> thunk_area != 0 ) {
5567
+ cfg -> thunk_area += THUNK_ADDR_ALIGNMENT ;
5568
+ }
5569
+ #endif
5559
5570
}
5560
5571
#endif
5561
5572
0 commit comments