NAME=ELF: ppc relocs
FILE=bins/elf/hello.ppc
CMDS=<<EOF
ii
echo ---
ir
s main
af
pdsf
EOF
EXPECT=<<EOF
nth      vaddr bind   type   lib name              
---------------------------------------------------
  1 ---------- GLOBAL FUNC       printf
  2 ---------- WEAK   NOTYPE     __gmon_start__
  3 ---------- GLOBAL FUNC       __libc_start_main
---
     vaddr      paddr type           name              
-------------------------------------------------------
0x10020008 0x00010008 R_PPC_GLOB_DAT __gmon_start__
0x10020064 0x10020064 R_PPC_JMP_SLOT printf
0x1002006c 0x1002006c R_PPC_JMP_SLOT __gmon_start__
0x10020074 0x10020074 R_PPC_JMP_SLOT __libc_start_main
0x100004a0 str.Simple_PPC_program. str.Simple_PPC_program.
EOF
RUN

NAME=ELF: arm relocs r2pay-arm32.so
FILE=bins/elf/r2pay-arm32.so
CMDS=<<EOF
ir~?
# ARM_RELATIVE
s 0xb58c0
pf x1x1x1x1
pd 1
echo ---
# ARM_ABS32
s 0xb58c4
pf x1x1x1x1
pd 1
echo ---
# ARM_ABS32
s 0xb58d8
pf x1x1x1x1
pd 1
echo ---
# ARM_GLOB_DAT
s 0xb5dbc
pf x1x1x1x1
pd 1
echo ---
# ARM_JUMP_SLOT
s 0xb5e08
pf x1x1x1x1
pd 1
echo ---
s section..init_array
pd 10
EOF
EXPECT=<<EOF
427
0x000b58c0 = 0x24 [LE]
0x000b58c1 = 0x45 [LE]
0x000b58c2 = 0x00 [LE]
0x000b58c3 = 0x00 [LE]
            ;-- section..fini_array:
            ;-- segment.LOAD1:
            0x000b58c0      .dword 0x00004524 ; entry0 ; entry.fini0 ; section..text; RELOC 32  ; [13] -rw- section size 4 named .fini_array
---
0x000b58c4 = 0x61 [LE]
0x000b58c5 = 0x45 [LE]
0x000b58c6 = 0x00 [LE]
0x000b58c7 = 0x00 [LE]
            ;-- section..init_array:
            ;-- .datadiv_decode1794556967687044894:
            0x000b58c4      .dword 0x00004561 ; reloc.target..datadiv_decode1794556967687044894 ; sym..datadiv_decode1794556967687044894; RELOC 32 .datadiv_decode1794556967687044894 @ 0x00004560 + 0x1 ; [14] -rw- section size 364 named .init_array
---
0x000b58d8 = 0x45 [LE]
0x000b58d9 = 0x8b [LE]
0x000b58da = 0x09 [LE]
0x000b58db = 0x00 [LE]
            ;-- .datadiv_decode668687990735969933:
            0x000b58d8      .dword 0x00098b45 ; reloc.target..datadiv_decode668687990735969933 ; sym..datadiv_decode668687990735969933; RELOC 32 .datadiv_decode668687990735969933 @ 0x00098b44 + 0x1
---
0x000b5dbc = 0x24 [LE]
0x000b5dbd = 0x35 [LE]
0x000b5dbe = 0x14 [LE]
0x000b5dbf = 0x00 [LE]
            ;-- x.10:
            0x000b5dbc      .dword 0x00143524 ; reloc.target.x.10 ; obj.x.10; RELOC 32 x.10 @ 0x00143524
---
0x000b5e08 = 0xb4 [LE]
0x000b5e09 = 0x37 [LE]
0x000b5e0a = 0x14 [LE]
0x000b5e0b = 0x00 [LE]
            ;-- __cxa_atexit:
            0x000b5e08      .dword 0x001437b4 ; reloc.target.__cxa_atexit; RELOC 32 __cxa_atexit
---
            ;-- section..init_array:
            ;-- .datadiv_decode1794556967687044894:
            0x000b58c4      .dword 0x00004561 ; reloc.target..datadiv_decode1794556967687044894 ; sym..datadiv_decode1794556967687044894; RELOC 32 .datadiv_decode1794556967687044894 @ 0x00004560 + 0x1 ; [14] -rw- section size 364 named .init_array
            ;-- .datadiv_decode12875440098136793118:
            0x000b58c8      .dword 0x00004571 ; reloc.target..datadiv_decode12875440098136793118 ; sym..datadiv_decode12875440098136793118; RELOC 32 .datadiv_decode12875440098136793118 @ 0x00004570 + 0x1
            ;-- .datadiv_decode11893604691534341392:
            0x000b58cc      .dword 0x00098029 ; reloc.target..datadiv_decode11893604691534341392 ; sym..datadiv_decode11893604691534341392; RELOC 32 .datadiv_decode11893604691534341392 @ 0x00098028 + 0x1
            0x000b58d0      .dword 0x00008115 ; entry.init0            ; RELOC 32 
            0x000b58d4      .dword 0x00055049 ; entry.init1            ; RELOC 32 
            ;-- .datadiv_decode668687990735969933:
            0x000b58d8      .dword 0x00098b45 ; reloc.target..datadiv_decode668687990735969933 ; sym..datadiv_decode668687990735969933; RELOC 32 .datadiv_decode668687990735969933 @ 0x00098b44 + 0x1
            ;-- .datadiv_decode16868916699024037624:
            0x000b58dc      .dword 0x00098b49 ; reloc.target..datadiv_decode16868916699024037624 ; sym..datadiv_decode16868916699024037624; RELOC 32 .datadiv_decode16868916699024037624 @ 0x00098b48 + 0x1
            ;-- .datadiv_decode12802097292201864397:
            0x000b58e0      .dword 0x00098b4d ; reloc.target..datadiv_decode12802097292201864397 ; sym..datadiv_decode12802097292201864397; RELOC 32 .datadiv_decode12802097292201864397 @ 0x00098b4c + 0x1
            ;-- .datadiv_decode12428479046606065387:
            0x000b58e4      .dword 0x00098b51 ; reloc.target..datadiv_decode12428479046606065387 ; sym..datadiv_decode12428479046606065387; RELOC 32 .datadiv_decode12428479046606065387 @ 0x00098b50 + 0x1
            ;-- .datadiv_decode7496105736011033460:
            0x000b58e8      .dword 0x00098b55 ; reloc.target..datadiv_decode7496105736011033460 ; sym..datadiv_decode7496105736011033460; RELOC 32 .datadiv_decode7496105736011033460 @ 0x00098b54 + 0x1
EOF
RUN

NAME=ELF: arm thumb relocs 1
FILE=bins/elf/mbedtls-bignum-thumb-interwork.so
CMDS=<<EOF
ir~?
# ARM_THM_PC22
s 0x08000b82
pf x1x1x1x1
pd 1
EOF
EXPECT=<<EOF
4810
0x08000b82 = 0x18 [LE]
0x08000b83 = 0xf0 [LE]
0x08000b84 = 0xe7 [LE]
0x08000b85 = 0xfc [LE]
            ;-- memset:
            0x08000b82      bl    reloc.target.memset                  ; RELOC 24 memset
EOF
RUN

NAME=ELF: arm64 relocs r2pay-arm64.so
FILE=bins/elf/r2pay-arm64.so
CMDS=<<EOF
ir~?
s section..init_array
pd 10
EOF
EXPECT=<<EOF
320
            ;-- section..init_array:
            ;-- segment.LOAD1:
            ;-- .datadiv_decode9958896245423089702:
            0x00126510      .qword 0x0000000000005a6c ; reloc.target..datadiv_decode9958896245423089702 ; sym..datadiv_decode9958896245423089702; RELOC 64 .datadiv_decode9958896245423089702 @ 0x00005a6c ; [12] -rw- section size 728 named .init_array
            ;-- .datadiv_decode10476194973746341988:
            0x00126518      .qword 0x0000000000005a80 ; reloc.target..datadiv_decode10476194973746341988 ; sym..datadiv_decode10476194973746341988; RELOC 64 .datadiv_decode10476194973746341988 @ 0x00005a80
            ;-- .datadiv_decode16323044921667855934:
            0x00126520      .qword 0x00000000000efddc ; reloc.target..datadiv_decode16323044921667855934 ; sym..datadiv_decode16323044921667855934; RELOC 64 .datadiv_decode16323044921667855934 @ 0x000efddc
            0x00126528      .qword 0x0000000000009080 ; entry.init0    ; RELOC 64 
            0x00126530      .qword 0x0000000000077d14 ; entry.init1    ; RELOC 64 
            ;-- .datadiv_decode667225052219618748:
            0x00126538      .qword 0x00000000000f22e0 ; reloc.target..datadiv_decode667225052219618748 ; sym..datadiv_decode667225052219618748; RELOC 64 .datadiv_decode667225052219618748 @ 0x000f22e0
            ;-- .datadiv_decode8132880250332170398:
            0x00126540      .qword 0x00000000000f22e4 ; reloc.target..datadiv_decode8132880250332170398 ; sym..datadiv_decode8132880250332170398; RELOC 64 .datadiv_decode8132880250332170398 @ 0x000f22e4
            ;-- .datadiv_decode3655886617018729963:
            0x00126548      .qword 0x00000000000f22e8 ; reloc.target..datadiv_decode3655886617018729963 ; sym..datadiv_decode3655886617018729963; RELOC 64 .datadiv_decode3655886617018729963 @ 0x000f22e8
            ;-- .datadiv_decode16406252260792032531:
            0x00126550      .qword 0x00000000000f22ec ; reloc.target..datadiv_decode16406252260792032531 ; sym..datadiv_decode16406252260792032531; RELOC 64 .datadiv_decode16406252260792032531 @ 0x000f22ec
            ;-- .datadiv_decode13403071575248320347:
            0x00126558      .qword 0x00000000000f22f0 ; reloc.target..datadiv_decode13403071575248320347 ; sym..datadiv_decode13403071575248320347; RELOC 64 .datadiv_decode13403071575248320347 @ 0x000f22f0
EOF
RUN

NAME=ELF: R_ARM_RELATIVE patch reloc
FILE=bins/arm/elf/hello_world
CMDS=<<EOF
pxw 4 @ 0x00010f08
pxw 4 @ 0x00010f0c
pxw 4 @ 0x00011020
pxw 4 @ 0x00011030
pxw 4 @ 0x00011034
pxw 4 @ 0x00011040
EOF
EXPECT=<<EOF
0x00010f08  0x00000509                                   ....
0x00010f0c  0x000004c9                                   ....
0x00011020  0x00000565                                   e...
0x00011030  0x00000525                                   %...
0x00011034  0x0000050d                                   ....
0x00011040  0x00011040                                   @...
EOF
RUN

NAME=ELF: arm64 relocs graphascii
FILE=bins/elf/graphascii.c-gcc-arm64-O0.o
CMDS=<<EOF
ir~?
s 0x8000444
pf x1x1x1x1
pi 1
echo ---
s 0x8000460
pf x1x1x1x1
pi 1
echo ---
s 0x800046c
pf x1x1x1x1
pi 1
echo ---
s 0x80003d8
pf x1x1x1x1
pi 1
EOF
EXPECT=<<EOF
315
0x08000444 = 0xe0 [LE]
0x08000445 = 0xff [LE]
0x08000446 = 0xfb [LE]
0x08000447 = 0xf0 [LE]
adrp x0, 0xfffffffffffff000
---
0x08000460 = 0x1c [LE]
0x08000461 = 0x0d [LE]
0x08000462 = 0x00 [LE]
0x08000463 = 0x94 [LE]
bl reloc.target.stackCursor
---
0x0800046c = 0x00 [LE]
0x0800046d = 0x00 [LE]
0x0800046e = 0x70 [LE]
0x0800046f = 0xf9 [LE]
ldr x0, [x0, 0x6000]
---
0x080003d8 = 0x3a [LE]
0x080003d9 = 0x0d [LE]
0x080003da = 0x00 [LE]
0x080003db = 0x94 [LE]
bl reloc.target.fputs
EOF
RUN

NAME=arm R_ARM_PREL31 relocation
FILE=bins/elf/arm-reloc-prel31.o
CMDS=<<EOF
ir~R_ARM_PREL31?
pf x2 @ 0x08000038
pd 1 @ 0x08000038
EOF
EXPECT=<<EOF
1
0x08000038 = 0x0090 [LE]
            ;-- section..data:
            ;-- foo:
            ;-- .data:
            ;-- reloc_slot:
            0x08000038      .dword 0x00000090                          ; RELOC 32 foo ; [02] -rw- section size 4 named .data
EOF
RUN

NAME=arm call/jump relocations
FILE=bins/elf/arm-reloc-call.o
CMDS=<<EOF
ir
pd 3 @ 0x08000038
EOF
EXPECT=<<EOF
     vaddr      paddr     target type         name             
---------------------------------------------------------------
0x08000038 0x00000038 0x08000034 R_ARM_CALL   foo - 0x08000040
0x0800003c 0x0000003c 0x08000034 R_ARM_JUMP24 foo - 0x08000044
0x08000040 0x00000040 0x08000034 R_ARM_CALL   foo - 0x08000048
            ;-- foo:
            ;-- arm:
            0x08000038      bl    foo                                  ; RELOC 24 foo @ 0x08000034 - 0x8000040
            ;-- foo:
            0x0800003c      bl    foo                                  ; RELOC 24 foo @ 0x08000034 - 0x8000044
            ;-- foo:
            0x08000040      blx   foo                                  ; RELOC 24 foo @ 0x08000034 - 0x8000048
EOF
RUN

NAME=arm alu, ldr group relocations
FILE=bins/elf/arm-adr-long.o
CMDS=<<EOF
ir
pd 3 @ 0x08000034
pd 3 @ 0x08000058
pd 2 @ 0x08000064
pd 2 @ 0x08000078
EOF
EXPECT=<<EOF
     vaddr      paddr     target type               name              
----------------------------------------------------------------------
0x08000034 0x00000034 0x08100034 R_ARM_ALU_PC_G0_NC dat1 - 0x0800003c
0x08000038 0x00000038 0x08100034 R_ARM_ALU_PC_G1_NC dat1 - 0x0800003c
0x0800003c 0x0000003c 0x08100034 R_ARM_ALU_PC_G2    dat1 - 0x0800003c
0x08000040 0x00000040 0x170f0034 R_ARM_ALU_PC_G0_NC dat2 - 0x08000048
0x08000044 0x00000044 0x170f0034 R_ARM_ALU_PC_G1_NC dat2 - 0x08000048
0x08000048 0x00000048 0x170f0034 R_ARM_ALU_PC_G2    dat2 - 0x08000048
0x0800004c 0x0000004c 0x08100034 R_ARM_ALU_PC_G0_NC dat1 - 0x08000054
0x08000050 0x00000050 0x08100034 R_ARM_ALU_PC_G1_NC dat1 - 0x08000054
0x08000054 0x00000054 0x08100034 R_ARM_ALU_PC_G2    dat1 - 0x08000054
0x08000058 0x00000058 0x170f0034 R_ARM_ALU_PC_G0_NC dat2 - 0x08000060
0x0800005c 0x0000005c 0x170f0034 R_ARM_ALU_PC_G1_NC dat2 - 0x08000060
0x08000060 0x00000060 0x170f0034 R_ARM_LDR_PC_G2    dat2 - 0x08000060
0x08000064 0x00000064 0x08100034 R_ARM_ALU_PC_G0_NC dat1 - 0x0800006c
0x08000068 0x00000068 0x08100034 R_ARM_LDR_PC_G1    dat1 - 0x0800006c
0x0800006c 0x0000006c 0x08100034 R_ARM_ALU_PC_G0_NC dat1 - 0x08000074
0x08000070 0x00000070 0x08100034 R_ARM_ALU_PC_G1_NC dat1 - 0x08000074
0x08000074 0x00000074 0x08100034 R_ARM_LDR_PC_G2    dat1 - 0x08000074
0x08000078 0x00000078 0x08100034 R_ARM_ALU_PC_G0_NC dat1 - 0x08000080
0x0800007c 0x0000007c 0x08100034 R_ARM_LDRS_PC_G1   dat1 - 0x08000080
            ;-- section..text:
            ;-- section..text.0:
            ;-- section..text.2:
            ;-- section..text.1:
            ;-- dat1:
            ;-- _start:
            0x08000034      add   r0, pc, 0xff000                      ; RELOC 32 dat1 @ 0x08100034 - 0x800003c ; [05] -r-x section size 76 named .text.1
            ;-- dat1:
            0x08000038      add   r0, r0, 0xff0                        ; RELOC 32 dat1 @ 0x08100034 - 0x800003c
            ;-- dat1:
            0x0800003c      add   r0, r0, 8                            ; RELOC 32 dat1 @ 0x08100034 - 0x800003c
            ;-- dat2:
            0x08000058      add   r0, pc, 240, 12                      ; RELOC 32 dat2 @ 0x170f0034 - 0x8000060
            ;-- dat2:
            0x0800005c      add   r0, r0, 0xef000                      ; RELOC 32 dat2 @ 0x170f0034 - 0x8000060
            ;-- dat2:
            0x08000060      ldr   r0, [r0, 0xfd4]                      ; RELOC 32 dat2 @ 0x170f0034 - 0x8000060
            ;-- dat1:
            0x08000064      add   r0, pc, 0xff000                      ; RELOC 32 dat1 @ 0x08100034 - 0x800006c
            ;-- dat1:
            0x08000068      ldr   r0, [r0, 0xfc8]                      ; RELOC 32 dat1 @ 0x08100034 - 0x800006c
            ;-- dat1:
            0x08000078      add   r0, pc, 0xff000                      ; RELOC 32 dat1 @ 0x08100034 - 0x8000080
            ;-- dat1:
            0x0800007c      ldrd  r0, r1, [r0, 0xb4]                   ; RELOC 32 dat1 @ 0x08100034 - 0x8000080
EOF
RUN

NAME=arm dynamic R_ARM_JUMP_SLOT relocation
FILE=bins/elf/arm-reloc-jump-slot.so
CMDS=<<EOF
ir
pf x2 @ 0x000011c4
pd 1 @ 0x000011c4
EOF
EXPECT=<<EOF
     vaddr      paddr     target type            name        
-------------------------------------------------------------
0x000011c4 0x000001c4 0x000011d0 R_ARM_JUMP_SLOT target_func
0x000011c4 = 0x11d0 [LE]
            ;-- target_func:
            0x000011c4      .dword 0x000011d0 ; reloc.target.target_func; RELOC 32 target_func
EOF
RUN

NAME=arm MOV relocations
FILE=bins/elf/arm-mov-relocs.o
CMDS=<<EOF
ir
pd 5 @ 0x08001000
pd 5 @ 0x08001100
pd 5 @ 0x08001200
pd 5 @ 0x08001300
pd 5 @ 0x08001400
pd 5 @ 0x08001500
EOF
EXPECT=<<EOF
     vaddr      paddr     target type               name                  
--------------------------------------------------------------------------
0x08001000 0x00001000 0x08010000 R_ARM_MOVW_ABS_NC  label
0x08001004 0x00001004 0x08010004 R_ARM_MOVW_ABS_NC  label1
0x08001008 0x00001008 0x08010008 R_ARM_MOVW_ABS_NC  label2 + 0x00000004
0x0800100c 0x0000100c 0x0801fffc R_ARM_MOVW_ABS_NC  label3
0x08001010 0x00001010 0x0801fffc R_ARM_MOVW_ABS_NC  label3 + 0x00000004
0x08001100 0x00001100 0x08010000 R_ARM_MOVT_ABS     label
0x08001104 0x00001104 0x08010004 R_ARM_MOVT_ABS     label1
0x08001108 0x00001108 0x08010008 R_ARM_MOVT_ABS     label2 + 0x00000004
0x0800110c 0x0000110c 0x0801fffc R_ARM_MOVT_ABS     label3
0x08001110 0x00001110 0x0801fffc R_ARM_MOVT_ABS     label3 + 0x00000004
0x08001200 0x00001200 0x08010000 R_ARM_MOVW_PREL_NC label - 0x08001200
0x08001204 0x00001204 0x08010004 R_ARM_MOVW_PREL_NC label1 - 0x08001204
0x08001208 0x00001208 0x08010008 R_ARM_MOVW_PREL_NC label2 - 0x08001204
0x0800120c 0x0000120c 0x0801fffc R_ARM_MOVW_PREL_NC label3 - 0x0800120c
0x08001210 0x00001210 0x0801fffc R_ARM_MOVW_PREL_NC label3 - 0x07ffeffc
0x08001300 0x00001300 0x08010000 R_ARM_MOVT_PREL    label - 0x08001300
0x08001304 0x00001304 0x08010004 R_ARM_MOVT_PREL    label1 - 0x08001304
0x08001308 0x00001308 0x08010008 R_ARM_MOVT_PREL    label2 - 0x08001304
0x0800130c 0x0000130c 0x0801fffc R_ARM_MOVT_PREL    label3 - 0x0800130c
0x08001310 0x00001310 0x0801fffc R_ARM_MOVT_PREL    label3 - 0x07ffeffc
0x08001400 0x00001400 0x08010000 R_ARM_MOVW_BREL_NC label - 0x08000000
0x08001404 0x00001404 0x08010004 R_ARM_MOVW_BREL_NC label1 - 0x08000000
0x08001408 0x00001408 0x08010008 R_ARM_MOVW_BREL_NC label2 - 0x08000000
0x0800140c 0x0000140c 0x0801fffc R_ARM_MOVW_BREL_NC label3 - 0x08000000
0x08001410 0x00001410 0x08020000 R_ARM_MOVW_BREL_NC label3.4 - 0x08000000
0x08001500 0x00001500 0x08010000 R_ARM_MOVT_BREL    label - 0x08000000
0x08001504 0x00001504 0x08010004 R_ARM_MOVT_BREL    label1 - 0x08000000
0x08001508 0x00001508 0x08010008 R_ARM_MOVT_BREL    label2 - 0x08000000
0x0800150c 0x0000150c 0x0801fffc R_ARM_MOVT_BREL    label3 - 0x08000000
0x08001510 0x00001510 0x08020000 R_ARM_MOVT_BREL    label3.4 - 0x08000000
0x08001600 0x00001600 0x08010000 R_ARM_MOVW_ABS_NC  label
0x08001604 0x00001604 0x08010004 R_ARM_MOVW_ABS_NC  label1
0x08001608 0x00001608 0x08010008 R_ARM_MOVW_ABS_NC  label2 + 0x00000004
0x0800160c 0x0000160c 0x0801fffc R_ARM_MOVW_ABS_NC  label3
0x08001610 0x00001610 0x0801fffc R_ARM_MOVW_ABS_NC  label3 + 0x00000004
0x08001700 0x00001700 0x08010000 R_ARM_MOVT_ABS     label
0x08001704 0x00001704 0x08010004 R_ARM_MOVT_ABS     label1
0x08001708 0x00001708 0x08010008 R_ARM_MOVT_ABS     label2 + 0x00000004
0x0800170c 0x0000170c 0x0801fffc R_ARM_MOVT_ABS     label3
0x08001710 0x00001710 0x0801fffc R_ARM_MOVT_ABS     label3 + 0x00000004
0x08001800 0x00001800 0x08010000 R_ARM_MOVW_PREL_NC label - 0x08001800
0x08001804 0x00001804 0x08010004 R_ARM_MOVW_PREL_NC label1 - 0x08001804
0x08001808 0x00001808 0x08010008 R_ARM_MOVW_PREL_NC label2 - 0x08001804
0x0800180c 0x0000180c 0x0801fffc R_ARM_MOVW_PREL_NC label3 - 0x0800180c
0x08001810 0x00001810 0x0801fffc R_ARM_MOVW_PREL_NC label3 - 0x07ffeffc
0x08001900 0x00001900 0x08010000 R_ARM_MOVT_PREL    label - 0x08001900
0x08001904 0x00001904 0x08010004 R_ARM_MOVT_PREL    label1 - 0x08001904
0x08001908 0x00001908 0x08010008 R_ARM_MOVT_PREL    label2 - 0x08001904
0x0800190c 0x0000190c 0x0801fffc R_ARM_MOVT_PREL    label3 - 0x0800190c
0x08001910 0x00001910 0x0801fffc R_ARM_MOVT_PREL    label3 - 0x07ffeffc
0x08001a00 0x00001a00 0x08010000 R_ARM_MOVW_BREL_NC label - 0x08000000
0x08001a04 0x00001a04 0x08010004 R_ARM_MOVW_BREL_NC label1 - 0x08000000
0x08001a08 0x00001a08 0x08010008 R_ARM_MOVW_BREL_NC label2 - 0x08000000
0x08001a0c 0x00001a0c 0x0801fffc R_ARM_MOVW_BREL_NC label3 - 0x08000000
0x08001a10 0x00001a10 0x08020000 R_ARM_MOVW_BREL_NC label3.4 - 0x08000000
0x08001b00 0x00001b00 0x08010000 R_ARM_MOVT_BREL    label - 0x08000000
0x08001b04 0x00001b04 0x08010004 R_ARM_MOVT_BREL    label1 - 0x08000000
0x08001b08 0x00001b08 0x08010008 R_ARM_MOVT_BREL    label2 - 0x08000000
0x08001b0c 0x00001b0c 0x0801fffc R_ARM_MOVT_BREL    label3 - 0x08000000
0x08001b10 0x00001b10 0x08020000 R_ARM_MOVT_BREL    label3.4 - 0x08000000
            ;-- section..text:
            ;-- section..R_ARM_MOVW_ABS_NC:
            ;-- label:
            ;-- _start:
            0x08001000      movw  r0, 0                                ; RELOC 32 label @ 0x08010000 ; [03] -r-x section size 20 named .R_ARM_MOVW_ABS_NC
            ;-- label1:
            0x08001004      movw  r1, 4                                ; RELOC 32 label1 @ 0x08010004
            ;-- label2:
            0x08001008      movw  r2, 0xc                              ; RELOC 32 label2 @ 0x08010008 + 0x4
            ;-- label3:
            0x0800100c      movw  r3, 0xfffc                           ; RELOC 32 label3 @ 0x0801fffc
            ;-- label3:
            0x08001010      movw  r4, 0                                ; RELOC 32 label3 @ 0x0801fffc + 0x4
            ;-- section..R_ARM_MOVT_ABS:
            ;-- label:
            0x08001100      movt  r0, 0x801                            ; RELOC 32 label @ 0x08010000 ; [05] -r-x section size 20 named .R_ARM_MOVT_ABS
            ;-- label1:
            0x08001104      movt  r1, 0x801                            ; RELOC 32 label1 @ 0x08010004
            ;-- label2:
            0x08001108      movt  r2, 0x801                            ; RELOC 32 label2 @ 0x08010008 + 0x4
            ;-- label3:
            0x0800110c      movt  r3, 0x801                            ; RELOC 32 label3 @ 0x0801fffc
            ;-- label3:
            0x08001110      movt  r4, 0x802                            ; RELOC 32 label3 @ 0x0801fffc + 0x4
            ;-- section..R_ARM_MOVW_PREL_NC:
            ;-- label:
            0x08001200      movw  r0, 0xee00                           ; RELOC 32 label @ 0x08010000 - 0x8001200 ; [07] -r-x section size 20 named .R_ARM_MOVW_PREL_NC
            ;-- label1:
            0x08001204      movw  r1, 0xee00                           ; RELOC 32 label1 @ 0x08010004 - 0x8001204
            ;-- label2:
            0x08001208      movw  r2, 0xee04                           ; RELOC 32 label2 @ 0x08010008 - 0x8001204
            ;-- label3:
            0x0800120c      movw  r3, 0xedf0                           ; RELOC 32 label3 @ 0x0801fffc - 0x800120c
            ;-- label3:
            0x08001210      movw  r4, 0x1000                           ; RELOC 32 label3 @ 0x0801fffc - 0x7ffeffc
            ;-- section..R_ARM_MOVT_PREL:
            ;-- label:
            0x08001300      movt  r0, 0x801                            ; RELOC 32 label @ 0x08010000 - 0x8001300 ; [09] -r-x section size 20 named .R_ARM_MOVT_PREL
            ;-- label1:
            0x08001304      movt  r1, 0x801                            ; RELOC 32 label1 @ 0x08010004 - 0x8001304
            ;-- label2:
            0x08001308      movt  r2, 0x801                            ; RELOC 32 label2 @ 0x08010008 - 0x8001304
            ;-- label3:
            0x0800130c      movt  r3, 0x801                            ; RELOC 32 label3 @ 0x0801fffc - 0x800130c
            ;-- label3:
            0x08001310      movt  r4, 0x802                            ; RELOC 32 label3 @ 0x0801fffc - 0x7ffeffc
            ;-- section..R_ARM_MOVW_BREL_NC:
            ;-- label:
            0x08001400      movw  r0, 0                                ; RELOC 16 label @ 0x08010000 - 0x8000000 ; [11] -r-x section size 20 named .R_ARM_MOVW_BREL_NC
            ;-- label1:
            0x08001404      movw  r1, 4                                ; RELOC 16 label1 @ 0x08010004 - 0x8000000
            ;-- label2:
            0x08001408      movw  r2, 8                                ; RELOC 16 label2 @ 0x08010008 - 0x8000000
            ;-- label3:
            0x0800140c      movw  r3, 0xfffc                           ; RELOC 16 label3 @ 0x0801fffc - 0x8000000
            ;-- label3.4:
            0x08001410      movw  r4, 0                                ; RELOC 16 label3.4 @ 0x08020000 - 0x8000000
            ;-- section..R_ARM_MOVT_BREL:
            ;-- label:
            0x08001500      movt  r0, 1                                ; RELOC 32 label @ 0x08010000 - 0x8000000 ; [13] -r-x section size 20 named .R_ARM_MOVT_BREL
            ;-- label1:
            0x08001504      movt  r1, 1                                ; RELOC 32 label1 @ 0x08010004 - 0x8000000
            ;-- label2:
            0x08001508      movt  r2, 1                                ; RELOC 32 label2 @ 0x08010008 - 0x8000000
            ;-- label3:
            0x0800150c      movt  r3, 1                                ; RELOC 32 label3 @ 0x0801fffc - 0x8000000
            ;-- label3.4:
            0x08001510      movt  r4, 2                                ; RELOC 32 label3.4 @ 0x08020000 - 0x8000000
EOF
RUN

NAME=thumb2 mov relocations
FILE=bins/elf/arm-thumb2-mov-relocs.o
CMDS=<<EOF
ir
pd 5 @ 0x08001600
pd 5 @ 0x08001700
pd 5 @ 0x08001800
pd 5 @ 0x08001900
pd 5 @ 0x08001a00
pd 5 @ 0x08001b00
EOF
EXPECT=<<EOF
     vaddr      paddr     target type                   name                  
------------------------------------------------------------------------------
0x08001000 0x00001000 0x08010000 R_ARM_THM_MOVW_ABS_NC  label
0x08001004 0x00001004 0x08010004 R_ARM_THM_MOVW_ABS_NC  label1
0x08001008 0x00001008 0x08010008 R_ARM_THM_MOVW_ABS_NC  label2 + 0x00000004
0x0800100c 0x0000100c 0x0801fffc R_ARM_THM_MOVW_ABS_NC  label3
0x08001010 0x00001010 0x0801fffc R_ARM_THM_MOVW_ABS_NC  label3 + 0x00000004
0x08001100 0x00001100 0x08010000 R_ARM_THM_MOVT_ABS     label
0x08001104 0x00001104 0x08010004 R_ARM_THM_MOVT_ABS     label1
0x08001108 0x00001108 0x08010008 R_ARM_THM_MOVT_ABS     label2 + 0x00040000
0x0800110c 0x0000110c 0x0801fffc R_ARM_THM_MOVT_ABS     label3
0x08001110 0x00001110 0x0801fffc R_ARM_THM_MOVT_ABS     label3 + 0x00040000
0x08001200 0x00001200 0x08010000 R_ARM_THM_MOVW_PREL_NC label - 0x08001200
0x08001204 0x00001204 0x08010004 R_ARM_THM_MOVW_PREL_NC label1 - 0x08001204
0x08001208 0x00001208 0x08010008 R_ARM_THM_MOVW_PREL_NC label2 - 0x08001204
0x0800120c 0x0000120c 0x0801fffc R_ARM_THM_MOVW_PREL_NC label3 - 0x0800120c
0x08001210 0x00001210 0x0801fffc R_ARM_THM_MOVW_PREL_NC label3 - 0x07fffffc
0x08001300 0x00001300 0x08010000 R_ARM_THM_MOVT_PREL    label - 0x08001300
0x08001304 0x00001304 0x08010004 R_ARM_THM_MOVT_PREL    label1 - 0x08001304
0x08001308 0x00001308 0x08010008 R_ARM_THM_MOVT_PREL    label2 - 0x07fc1308
0x0800130c 0x0000130c 0x0801fffc R_ARM_THM_MOVT_PREL    label3 - 0x0800130c
0x08001310 0x00001310 0x0801fffc R_ARM_THM_MOVT_PREL    label3 + 0x1b13ecf0
0x08001400 0x00001400 0x08010000 R_ARM_THM_MOVW_BREL_NC label - 0x08000000
0x08001404 0x00001404 0x08010004 R_ARM_THM_MOVW_BREL_NC label1 - 0x08000000
0x08001408 0x00001408 0x08010008 R_ARM_THM_MOVW_BREL_NC label2 - 0x08000000
0x0800140c 0x0000140c 0x0801fffc R_ARM_THM_MOVW_BREL_NC label3 - 0x08000000
0x08001410 0x00001410 0x08020000 R_ARM_THM_MOVW_BREL_NC label3.4 - 0x08000000
0x08001500 0x00001500 0x08010000 R_ARM_THM_MOVT_BREL    label - 0x08000000
0x08001504 0x00001504 0x08010004 R_ARM_THM_MOVT_BREL    label1 - 0x08000000
0x08001508 0x00001508 0x08010008 R_ARM_THM_MOVT_BREL    label2 - 0x08000000
0x0800150c 0x0000150c 0x0801fffc R_ARM_THM_MOVT_BREL    label3 - 0x08000000
0x08001510 0x00001510 0x08020000 R_ARM_THM_MOVT_BREL    label3.4 - 0x08000000
0x08001600 0x00001600 0x08010000 R_ARM_THM_MOVW_ABS_NC  label
0x08001604 0x00001604 0x08010004 R_ARM_THM_MOVW_ABS_NC  label1
0x08001608 0x00001608 0x08010008 R_ARM_THM_MOVW_ABS_NC  label2 + 0x00000004
0x0800160c 0x0000160c 0x0801fffc R_ARM_THM_MOVW_ABS_NC  label3
0x08001610 0x00001610 0x0801fffc R_ARM_THM_MOVW_ABS_NC  label3 + 0x00000004
0x08001700 0x00001700 0x08010000 R_ARM_THM_MOVT_ABS     label
0x08001704 0x00001704 0x08010004 R_ARM_THM_MOVT_ABS     label1
0x08001708 0x00001708 0x08010008 R_ARM_THM_MOVT_ABS     label2 + 0x00040000
0x0800170c 0x0000170c 0x0801fffc R_ARM_THM_MOVT_ABS     label3
0x08001710 0x00001710 0x0801fffc R_ARM_THM_MOVT_ABS     label3 + 0x00040000
0x08001800 0x00001800 0x08010000 R_ARM_THM_MOVW_PREL_NC label - 0x08001800
0x08001804 0x00001804 0x08010004 R_ARM_THM_MOVW_PREL_NC label1 - 0x08001804
0x08001808 0x00001808 0x08010008 R_ARM_THM_MOVW_PREL_NC label2 - 0x08001804
0x0800180c 0x0000180c 0x0801fffc R_ARM_THM_MOVW_PREL_NC label3 - 0x0800180c
0x08001810 0x00001810 0x0801fffc R_ARM_THM_MOVW_PREL_NC label3 - 0x080005fc
0x08001900 0x00001900 0x08010000 R_ARM_THM_MOVT_PREL    label - 0x08001900
0x08001904 0x00001904 0x08010004 R_ARM_THM_MOVT_PREL    label1 - 0x08001904
0x08001908 0x00001908 0x08010008 R_ARM_THM_MOVT_PREL    label2 - 0x07fc1908
0x0800190c 0x0000190c 0x0801fffc R_ARM_THM_MOVT_PREL    label3 - 0x0800190c
0x08001910 0x00001910 0x0801fffc R_ARM_THM_MOVT_PREL    label3 + 0x2113e6f0
0x08001a00 0x00001a00 0x08010000 R_ARM_THM_MOVW_BREL_NC label - 0x08000000
0x08001a04 0x00001a04 0x08010004 R_ARM_THM_MOVW_BREL_NC label1 - 0x08000000
0x08001a08 0x00001a08 0x08010008 R_ARM_THM_MOVW_BREL_NC label2 - 0x08000000
0x08001a0c 0x00001a0c 0x0801fffc R_ARM_THM_MOVW_BREL_NC label3 - 0x08000000
0x08001a10 0x00001a10 0x08020000 R_ARM_THM_MOVW_BREL_NC label3.4 - 0x08000000
0x08001b00 0x00001b00 0x08010000 R_ARM_THM_MOVT_BREL    label - 0x08000000
0x08001b04 0x00001b04 0x08010004 R_ARM_THM_MOVT_BREL    label1 - 0x08000000
0x08001b08 0x00001b08 0x08010008 R_ARM_THM_MOVT_BREL    label2 - 0x08000000
0x08001b0c 0x00001b0c 0x0801fffc R_ARM_THM_MOVT_BREL    label3 - 0x08000000
0x08001b10 0x00001b10 0x08020000 R_ARM_THM_MOVT_BREL    label3.4 - 0x08000000
            ;-- section..R_ARM_THM_MOVW_ABS_NC:
            ;-- label:
            0x08001600      movw  r0, 0                                ; RELOC 32 label @ 0x08010000 ; [15] -r-x section size 20 named .R_ARM_THM_MOVW_ABS_NC
            ;-- label1:
            0x08001604      movw  r1, 4                                ; RELOC 32 label1 @ 0x08010004
            ;-- label2:
            0x08001608      movw  r2, 0xc                              ; RELOC 32 label2 @ 0x08010008 + 0x4
            ;-- label3:
            0x0800160c      movw  r3, 0xfffc                           ; RELOC 32 label3 @ 0x0801fffc
            ;-- label3:
            0x08001610      movw  r4, 0                                ; RELOC 32 label3 @ 0x0801fffc + 0x4
            ;-- section..R_ARM_THM_MOVT_ABS:
            ;-- label:
            0x08001700      movt  r0, 0x801                            ; RELOC 32 label @ 0x08010000 ; [17] -r-x section size 20 named .R_ARM_THM_MOVT_ABS
            ;-- label1:
            0x08001704      movt  r1, 0x801                            ; RELOC 32 label1 @ 0x08010004
            ;-- label2:
            0x08001708      movt  r2, 0x805                            ; RELOC 32 label2 @ 0x08010008 + 0x40000
            ;-- label3:
            0x0800170c      movt  r3, 0x801                            ; RELOC 32 label3 @ 0x0801fffc
            ;-- label3:
            0x08001710      movt  r4, 0x805                            ; RELOC 32 label3 @ 0x0801fffc + 0x40000
            ;-- section..R_ARM_THM_MOVW_PREL_NC:
            ;-- label:
            0x08001800      movw  r0, 0xe800                           ; RELOC 32 label @ 0x08010000 - 0x8001800 ; [19] -r-x section size 20 named .R_ARM_THM_MOVW_PREL_NC
            ;-- label1:
            0x08001804      movw  r1, 0xe800                           ; RELOC 32 label1 @ 0x08010004 - 0x8001804
            ;-- label2:
            0x08001808      movw  r2, 0xe804                           ; RELOC 32 label2 @ 0x08010008 - 0x8001804
            ;-- label3:
            0x0800180c      movw  r3, 0xe7f0                           ; RELOC 32 label3 @ 0x0801fffc - 0x800180c
            ;-- label3:
            0x08001810      movw  r4, 0xfa00                           ; RELOC 32 label3 @ 0x0801fffc - 0x80005fc
            ;-- section..R_ARM_THM_MOVT_PREL:
            ;-- label:
            0x08001900      movt  r0, 0                                ; RELOC 32 label @ 0x08010000 - 0x8001900 ; [21] -r-x section size 20 named .R_ARM_THM_MOVT_PREL
            ;-- label1:
            0x08001904      movt  r1, 0                                ; RELOC 32 label1 @ 0x08010004 - 0x8001904
            ;-- label2:
            0x08001908      movt  r2, 4                                ; RELOC 32 label2 @ 0x08010008 - 0x7fc1908
            ;-- label3:
            0x0800190c      movt  r3, 1                                ; RELOC 32 label3 @ 0x0801fffc - 0x800190c
            ;-- label3:
            0x08001910      movt  r4, 0x2915                           ; RELOC 32 label3 @ 0x0801fffc + 0x2113e6f0
            ;-- section..R_ARM_THM_MOVW_BREL_NC:
            ;-- label:
            0x08001a00      movw  r0, 0                                ; RELOC 32 label @ 0x08010000 - 0x8000000 ; [23] -r-x section size 20 named .R_ARM_THM_MOVW_BREL_NC
            ;-- label1:
            0x08001a04      movw  r1, 4                                ; RELOC 32 label1 @ 0x08010004 - 0x8000000
            ;-- label2:
            0x08001a08      movw  r2, 8                                ; RELOC 32 label2 @ 0x08010008 - 0x8000000
            ;-- label3:
            0x08001a0c      movw  r3, 0xfffc                           ; RELOC 32 label3 @ 0x0801fffc - 0x8000000
            ;-- label3.4:
            0x08001a10      movw  r4, 0                                ; RELOC 32 label3.4 @ 0x08020000 - 0x8000000
            ;-- section..R_ARM_THM_MOVT_BREL:
            ;-- label:
            0x08001b00      movt  r0, 1                                ; RELOC 32 label @ 0x08010000 - 0x8000000 ; [25] -r-x section size 20 named .R_ARM_THM_MOVT_BREL
            ;-- label1:
            0x08001b04      movt  r1, 1                                ; RELOC 32 label1 @ 0x08010004 - 0x8000000
            ;-- label2:
            0x08001b08      movt  r2, 1                                ; RELOC 32 label2 @ 0x08010008 - 0x8000000
            ;-- label3:
            0x08001b0c      movt  r3, 1                                ; RELOC 32 label3 @ 0x0801fffc - 0x8000000
            ;-- label3.4:
            0x08001b10      movt  r4, 2                                ; RELOC 32 label3.4 @ 0x08020000 - 0x8000000
EOF
RUN

#Due to the object file, the disassembly is printed incorrectly, hence checking hexdump at some places

NAME=thumb undefined symbols relocations
FILE=bins/elf/arm-thumb-undefined-weak.o
CMDS=<<EOF
ir
px 32
EOF
EXPECT=<<EOF
     vaddr      paddr     target type                    name                
-----------------------------------------------------------------------------
0x08000034 0x00000034 0x08000138 R_ARM_THM_JUMP19        target - 0x08000038
0x08000038 0x00000038 0x08000138 R_ARM_THM_JUMP24        target - 0x0800003c
0x0800003c 0x0000003c 0x08000138 R_ARM_THM_CALL          target - 0x08000040
0x08000040 0x00000040 0x08000138 R_ARM_THM_CALL          target - 0x08000044
0x08000044 0x00000044 0x08000138 R_ARM_THM_MOVT_PREL     target - 0x08000044
0x08000048 0x00000048 0x08000138 R_ARM_THM_MOVW_PREL_NC  target - 0x08000048
0x0800004c 0x0000004c 0x08000138 R_ARM_THM_ALU_PREL_11_0 target - 0x08000050
0x08000050 0x00000050 0x08000138 R_ARM_THM_PC12          target - 0x08000054
- offset -   0 1  2 3  4 5  6 7  8 9  A B  C D  E F  0123456789ABCDEF
0x08000034  00f0 8080 00f0 7eb8 00f0 7cf8 00f0 7ae8  ......~...|...z.
0x08000044  c0f2 0000 40f2 f000 0ff2 e800 dff8 e400  ....@...........
EOF
RUN

NAME=thumb16 alu group relocations
FILE=bins/elf/arm-thumb-alu.o
CMDS=<<EOF
ir
#R_ARM_THM_ALU_ABS_G0_NC
px 18 @ 0x08000034
#R_ARM_THM_ALU_ABS_G1_NC
px 18 @ 0x08000046
#R_ARM_THM_ALU_ABS_G2_NC
px 18 @ 0x08000058
#R_ARM_THM_ALU_ABS_G3
px 18 @ 0x0800006a
EOF
EXPECT=<<EOF
     vaddr      paddr     target type                    name              
---------------------------------------------------------------------------
0x08000034 0x00000034 0x0800007c R_ARM_THM_ALU_ABS_G0_NC sym1
0x08000036 0x00000036 0x0800007c R_ARM_THM_ALU_ABS_G0_NC sym1
0x08000038 0x00000038 0x0800007c R_ARM_THM_ALU_ABS_G0_NC sym1 + 0x00000001
0x0800003a 0x0000003a 0x0800007c R_ARM_THM_ALU_ABS_G0_NC sym1 + 0x000000ff
0x0800003c 0x0000003c 0x0800007c R_ARM_THM_ALU_ABS_G0_NC sym2
0x0800003e 0x0000003e 0x0800007c R_ARM_THM_ALU_ABS_G0_NC sym2 + 0x00000001
0x08000040 0x00000040 0x0800007c R_ARM_THM_ALU_ABS_G0_NC sym2 + 0x000000ff
0x08000042 0x00000042 0x0800007e R_ARM_THM_ALU_ABS_G0_NC fn + 0x00000001
0x08000044 0x00000044 0x0800007e R_ARM_THM_ALU_ABS_G0_NC fn + 0x00000003
0x08000046 0x00000046 0x0800007c R_ARM_THM_ALU_ABS_G1_NC sym1
0x08000048 0x00000048 0x0800007c R_ARM_THM_ALU_ABS_G1_NC sym1
0x0800004a 0x0000004a 0x0800007c R_ARM_THM_ALU_ABS_G1_NC sym1 + 0x00000001
0x0800004c 0x0000004c 0x0800007c R_ARM_THM_ALU_ABS_G1_NC sym1 + 0x000000ff
0x0800004e 0x0000004e 0x0800007c R_ARM_THM_ALU_ABS_G1_NC sym2
0x08000050 0x00000050 0x0800007c R_ARM_THM_ALU_ABS_G1_NC sym2 + 0x00000001
0x08000052 0x00000052 0x0800007c R_ARM_THM_ALU_ABS_G1_NC sym2 + 0x000000ff
0x08000054 0x00000054 0x0800007e R_ARM_THM_ALU_ABS_G1_NC fn + 0x00000001
0x08000056 0x00000056 0x0800007e R_ARM_THM_ALU_ABS_G1_NC fn + 0x00000003
0x08000058 0x00000058 0x0800007c R_ARM_THM_ALU_ABS_G2_NC sym1
0x0800005a 0x0000005a 0x0800007c R_ARM_THM_ALU_ABS_G2_NC sym1
0x0800005c 0x0000005c 0x0800007c R_ARM_THM_ALU_ABS_G2_NC sym1 + 0x00000001
0x0800005e 0x0000005e 0x0800007c R_ARM_THM_ALU_ABS_G2_NC sym1 + 0x000000ff
0x08000060 0x00000060 0x0800007c R_ARM_THM_ALU_ABS_G2_NC sym2
0x08000062 0x00000062 0x0800007c R_ARM_THM_ALU_ABS_G2_NC sym2 + 0x00000001
0x08000064 0x00000064 0x0800007c R_ARM_THM_ALU_ABS_G2_NC sym2 + 0x000000ff
0x08000066 0x00000066 0x0800007e R_ARM_THM_ALU_ABS_G2_NC fn + 0x00000001
0x08000068 0x00000068 0x0800007e R_ARM_THM_ALU_ABS_G2_NC fn + 0x00000003
0x0800006a 0x0000006a 0x0800007c R_ARM_THM_ALU_ABS_G3    sym1
0x0800006c 0x0000006c 0x0800007c R_ARM_THM_ALU_ABS_G3    sym1
0x0800006e 0x0000006e 0x0800007c R_ARM_THM_ALU_ABS_G3    sym1 + 0x00000001
0x08000070 0x00000070 0x0800007c R_ARM_THM_ALU_ABS_G3    sym1 + 0x000000ff
0x08000072 0x00000072 0x0800007c R_ARM_THM_ALU_ABS_G3    sym2
0x08000074 0x00000074 0x0800007c R_ARM_THM_ALU_ABS_G3    sym2 + 0x00000001
0x08000076 0x00000076 0x0800007c R_ARM_THM_ALU_ABS_G3    sym2 + 0x000000ff
0x08000078 0x00000078 0x0800007e R_ARM_THM_ALU_ABS_G3    fn + 0x00000001
0x0800007a 0x0000007a 0x0800007e R_ARM_THM_ALU_ABS_G3    fn + 0x00000003
- offset -   0 1  2 3  4 5  6 7  8 9  A B  C D  E F  0123456789ABCDEF
0x08000034  7c30 7c20 7d20 7b20 7d20 7d20 7b20 7f20  |0| } { } } { . 
0x08000044  8120                                     . 
- offset -   0 1  2 3  4 5  6 7  8 9  A B  C D  E F  0123456789ABCDEF
0x08000046  0030 0020 0020 0120 0020 0020 0120 0020  .0. . . . . . . 
0x08000056  0020                                     . 
- offset -   0 1  2 3  4 5  6 7  8 9  A B  C D  E F  0123456789ABCDEF
0x08000058  0030 0020 0020 0020 0020 0020 0020 0020  .0. . . . . . . 
0x08000068  0020                                     . 
- offset -   0 1  2 3  4 5  6 7  8 9  A B  C D  E F  0123456789ABCDEF
0x0800006a  0830 0820 0820 0820 0820 0820 0820 0820  .0. . . . . . . 
0x0800007a  0820                                     . 
EOF
RUN

NAME=thumb32 R_ARM_THM_JUMP24 relocation
FILE=bins/elf/arm-reloc-thm-jump24.o
CMDS=<<EOF
ir
pd 1 @ 0x08000034
pf x2 @ 0x08000034
EOF
EXPECT=<<EOF
     vaddr      paddr     target type             name             
-------------------------------------------------------------------
0x08000034 0x00000034 0x0800012c R_ARM_THM_JUMP24 foo - 0x08000038
            ;-- section..text:
            ;-- foo:
            ;-- .text:
            ;-- _start:
        ,=< 0x08000034      b.w   reloc.target.foo                     ; RELOC 24 foo ; [01] -r-x section size 4 named .text
0x08000034 = 0xf000 [LE]
EOF
RUN
