@@ -321,11 +321,13 @@ apply_relocation(AOTModule *module, uint8 *target_section_addr,
321321
322322 /* Convert from middle endian */
323323 insn = middle_endian_convert (insn );
324-
325- /**/
324+
325+ /* Extract the first 10 bits from Position 6 to 15 in insn */
326326 addend = (insn << 16 ) >> 22 ;
327327 addend = addend << 10 ;
328+ /* Extract the remaining 10 bits from Position 17 to 26 in insn */
328329 addend |= ((insn << 5 ) >> 22 );
330+ /* Fill in 1 bits to get the 21 bit Offset Value */
329331 addend = addend << 1 ;
330332
331333 /* (S + A) - P */
@@ -338,7 +340,7 @@ apply_relocation(AOTModule *module, uint8 *target_section_addr,
338340 insn = insn & 0xf801003f ;
339341 insn |= ((((value >> 1 ) & 0x3ff ) << 17 )
340342 | (((value >> 1 ) & 0xffc00 ) >> 4 ));
341-
343+
342344 /* Convert to middle endian */
343345 insn = middle_endian_convert (insn );
344346
@@ -357,9 +359,12 @@ apply_relocation(AOTModule *module, uint8 *target_section_addr,
357359 /* Convert from middle endian */
358360 insn = middle_endian_convert (insn );
359361
362+ /* Extract the first 10 bits from Position 6 to 15 in insn */
360363 addend = (insn << 16 ) >> 22 ;
361364 addend = addend << 9 ;
365+ /* Extract the remaining 9 bits from Position 18 to 26 in insn */
362366 addend |= ((insn << 5 ) >> 23 );
367+ /* Fill in 2 bits to get the 21 bit Offset Value */
363368 addend = addend << 2 ;
364369
365370 /* (S + A) - P */
@@ -368,7 +373,7 @@ apply_relocation(AOTModule *module, uint8 *target_section_addr,
368373 P = (uintptr_t )(target_section_addr + reloc_offset );
369374 P &= (uintptr_t )~3 ;
370375 value = (int32 )(S + A + addend - P );
371-
376+
372377 insn = insn & 0xf803003f ;
373378 insn |= ((((value >> 2 ) & 0x1ff ) << 18 )
374379 | (((value >> 2 ) & 0x7fe00 ) >> 3 ));
0 commit comments