@@ -366,6 +366,22 @@ impl Arch for ArchArm {
366366 ( imm22 << 1 ) << 9 >> 9
367367 }
368368
369+ // Thumb unconditional branch (B, 11-bit offset)
370+ elf:: R_ARM_THM_PC11 => {
371+ let data = section_data[ address..address + 2 ] . try_into ( ) ?;
372+ let insn = self . endianness . read_u16_bytes ( data) as i32 ;
373+ let imm11 = insn & 0x7ff ;
374+ ( imm11 << 1 ) << 20 >> 20
375+ }
376+
377+ // Thumb conditional branch (B<cond>, 8-bit offset)
378+ elf:: R_ARM_THM_PC9 => {
379+ let data = section_data[ address..address + 2 ] . try_into ( ) ?;
380+ let insn = self . endianness . read_u16_bytes ( data) as i32 ;
381+ let imm8 = insn & 0xff ;
382+ ( imm8 << 1 ) << 23 >> 23
383+ }
384+
369385 // Data
370386 elf:: R_ARM_ABS32 => {
371387 let data = section_data[ address..address + 4 ] . try_into ( ) ?;
@@ -399,6 +415,8 @@ impl Arch for ArchArm {
399415 elf:: R_ARM_PC24 => Some ( "R_ARM_PC24" ) ,
400416 elf:: R_ARM_XPC25 => Some ( "R_ARM_XPC25" ) ,
401417 elf:: R_ARM_CALL => Some ( "R_ARM_CALL" ) ,
418+ elf:: R_ARM_THM_PC11 => Some ( "R_ARM_THM_PC11" ) ,
419+ elf:: R_ARM_THM_PC9 => Some ( "R_ARM_THM_PC9" ) ,
402420 _ => None ,
403421 } ,
404422 _ => None ,
@@ -418,6 +436,8 @@ impl Arch for ArchArm {
418436 elf:: R_ARM_PC24 => 4 ,
419437 elf:: R_ARM_XPC25 => 4 ,
420438 elf:: R_ARM_CALL => 4 ,
439+ elf:: R_ARM_THM_PC11 => 2 ,
440+ elf:: R_ARM_THM_PC9 => 2 ,
421441 _ => 1 ,
422442 } ,
423443 _ => 1 ,
@@ -544,7 +564,9 @@ impl unarm::FormatIns for ArgsFormatter<'_> {
544564 | RelocationFlags :: Elf ( elf:: R_ARM_THM_PC22 )
545565 | RelocationFlags :: Elf ( elf:: R_ARM_PC24 )
546566 | RelocationFlags :: Elf ( elf:: R_ARM_XPC25 )
547- | RelocationFlags :: Elf ( elf:: R_ARM_CALL ) => {
567+ | RelocationFlags :: Elf ( elf:: R_ARM_CALL )
568+ | RelocationFlags :: Elf ( elf:: R_ARM_THM_PC11 )
569+ | RelocationFlags :: Elf ( elf:: R_ARM_THM_PC9 ) => {
548570 return self . write ( InstructionPart :: reloc ( ) ) ;
549571 }
550572 _ => { }
0 commit comments