@@ -873,7 +873,8 @@ get_func_section_size(AOTCompContext *comp_ctx, AOTCompData *comp_data,
873
873
const bool need_precheck = obj_data -> comp_ctx -> enable_stack_bound_check
874
874
|| obj_data -> comp_ctx -> enable_stack_estimation ;
875
875
/* aot_func#xxx + aot_func_internal#xxx in XIP mode for xtensa */
876
- if (obj_data -> comp_ctx -> is_indirect_mode && need_precheck )
876
+ if (obj_data -> comp_ctx -> is_indirect_mode && need_precheck
877
+ && !strncmp (obj_data -> comp_ctx -> target_arch , "xtensa" , 6 ))
877
878
size *= 2 ;
878
879
879
880
/* max_local_cell_nums */
@@ -2417,7 +2418,8 @@ aot_emit_init_data_section(uint8 *buf, uint8 *buf_end, uint32 *p_offset,
2417
2418
offset = align_uint (offset , 4 );
2418
2419
const bool need_precheck = obj_data -> comp_ctx -> enable_stack_bound_check
2419
2420
|| obj_data -> comp_ctx -> enable_stack_estimation ;
2420
- if (obj_data -> comp_ctx -> is_indirect_mode && need_precheck )
2421
+ if (obj_data -> comp_ctx -> is_indirect_mode && need_precheck
2422
+ && !strncmp (obj_data -> comp_ctx -> target_arch , "xtensa" , 6 ))
2421
2423
EMIT_U32 (comp_data -> func_count * 2 );
2422
2424
else
2423
2425
EMIT_U32 (comp_data -> func_count );
@@ -2607,7 +2609,8 @@ aot_emit_func_section(uint8 *buf, uint8 *buf_end, uint32 *p_offset,
2607
2609
2608
2610
const bool need_precheck = obj_data -> comp_ctx -> enable_stack_bound_check
2609
2611
|| obj_data -> comp_ctx -> enable_stack_estimation ;
2610
- if (obj_data -> comp_ctx -> is_indirect_mode && need_precheck ) {
2612
+ if (obj_data -> comp_ctx -> is_indirect_mode && need_precheck
2613
+ && !strncmp (obj_data -> comp_ctx -> target_arch , "xtensa" , 6 )) {
2611
2614
/*
2612
2615
* Explicitly emit aot_func_internal#xxx for Xtensa XIP, therefore,
2613
2616
* for aot_func#xxx, func_indexes ranged from 0 ~ func_count,
@@ -2625,6 +2628,13 @@ aot_emit_func_section(uint8 *buf, uint8 *buf_end, uint32 *p_offset,
2625
2628
for (i = 0 ; i < comp_data -> func_count ; i ++ )
2626
2629
EMIT_U32 (funcs [i ]-> func_type_index );
2627
2630
2631
+ if (obj_data -> comp_ctx -> is_indirect_mode && need_precheck
2632
+ && !strncmp (obj_data -> comp_ctx -> target_arch , "xtensa" , 6 )) {
2633
+ /* func_type_index for aot_func_internal#xxxx */
2634
+ for (i = 0 ; i < comp_data -> func_count ; i ++ )
2635
+ EMIT_U32 (funcs [i ]-> func_type_index );
2636
+ }
2637
+
2628
2638
for (i = 0 ; i < comp_data -> func_count ; i ++ ) {
2629
2639
uint32 max_local_cell_num =
2630
2640
funcs [i ]-> param_cell_num + funcs [i ]-> local_cell_num ;
@@ -2688,12 +2698,6 @@ aot_emit_func_section(uint8 *buf, uint8 *buf_end, uint32 *p_offset,
2688
2698
}
2689
2699
#endif /* end of WASM_ENABLE_GC != 0 */
2690
2700
2691
- if (obj_data -> comp_ctx -> is_indirect_mode && need_precheck ) {
2692
- /* func_type_index for aot_func_internal#xxxx */
2693
- for (i = 0 ; i < comp_data -> func_count ; i ++ )
2694
- EMIT_U32 (funcs [i ]-> func_type_index );
2695
- }
2696
-
2697
2701
if (offset - * p_offset != section_size + sizeof (uint32 ) * 2 ) {
2698
2702
aot_set_last_error ("emit function section failed." );
2699
2703
return false;
0 commit comments