NAME=ELF: ARM BE8 instructions use code endian while data remains big-endian
FILE=bins/elf/armeb_hello_static
CMDS=<<EOF
e asm.comments=false
iI~^endian
?e --
pd 4 @ entry0
?e --
pxw 4 @ 0x10be8
EOF
EXPECT=<<EOF
endian   big
--
            ;-- entry0:
            0x00010824      4ff0000b       mov.w fp, 0
            0x00010828      4ff0000e       mov.w lr, 0
            0x0001082c      02bc           pop {r1}
            0x0001082e      6a46           mov r2, sp
--
0x00010be8  0xd358092b                                   .X.+
EOF
RUN

NAME=ELF: ARM BE8 abi makes the GNU backend decode code as little-endian, data stays big
FILE=bins/elf/armeb_hello_static
CMDS=<<EOF
e asm.comments=false
e asm.arch=arm.gnu
iI~^endian
iI~^abi
?e --
pd 4 @ entry0
?e --
pxw 4 @ 0x10be8
EOF
EXPECT=<<EOF
endian   big
abi      eabi5 be8
--
            ;-- entry0:
            0x00010824      4ff0000b       mov.w fp, 0
            0x00010828      4ff0000e       mov.w lr, 0
            0x0001082c      02bc           pop {r1}
            0x0001082e      6a46           mov r2, sp
--
0x00010be8  0xd358092b                                   .X.+
EOF
RUN

NAME=arm raw: be8 in asm.abi flips only the code endian (capstone)
FILE=malloc://64
CMDS=<<EOF
e asm.comments=false
e asm.arch=arm
e asm.bits=16
e cfg.bigendian=true
wx 4ff0000b4ff0000e @ 0
pd 2 @ 0
?e --
e asm.abi=eabi5 be8
pd 2 @ 0
?e --
e asm.abi=
pd 2 @ 0
EOF
EXPECT=<<EOF
            0x00000000      4ff0           ldr r7, [0x000003c4]
            0x00000002      000b           movs r3, r1
--
            0x00000000      4ff0000b       mov.w fp, 0
            0x00000004      4ff0000e       mov.w lr, 0
--
            0x00000000      4ff0           ldr r7, [0x000003c4]
            0x00000002      000b           movs r3, r1
EOF
RUN

NAME=arm raw: be8 in asm.abi reaches the GNU backend through endian_code
FILE=malloc://64
CMDS=<<EOF
e asm.comments=false
e asm.arch=arm.gnu
e asm.bits=16
e cfg.bigendian=true
wx 4ff0000b4ff0000e @ 0
pd 2 @ 0
?e --
e asm.abi=eabi5 be8
pd 2 @ 0
?e --
e asm.abi=
pd 2 @ 0
EOF
EXPECT=<<EOF
            0x00000000      4ff0           ldr r7, [0x000003c4] ; (0x000003c4)
            0x00000002      000b           movs r3, r1
--
            0x00000000      4ff0000b       mov.w fp, 0
            0x00000004      4ff0000e       mov.w lr, 0
--
            0x00000000      4ff0           ldr r7, [0x000003c4] ; (0x000003c4)
            0x00000002      000b           movs r3, r1
EOF
RUN

NAME=aarch64 BE8: GNU backend decodes instructions as little-endian
FILE=bins/elf/aarch64be_min
CMDS=<<EOF
e asm.comments=false
e asm.arch=arm.gnu
iI~^endian
?e --
pd 4 @ entry0
EOF
EXPECT=<<EOF
endian   big
--
            ;-- entry0:
            ;-- _start:
            0x004000f0      fd7bbfa9       stp x29, x30, [sp, #-16]!
            0x004000f4      a80b80d2       mov x8, 0x5d
            0x004000f8      fd030091       mov x29, sp
            0x004000fc      f5ffff97       bl sym.sub3.constprop.0
EOF
RUN

NAME=ARM BE8 ET_REL: thumb relocs patch little-endian halfwords
FILE=bins/elf/arm_be-be8-thumb-reloc.o
ARGS=-e bin.relocs.apply=true
CMDS=<<EOF
p8 0x18 @ 0x08000034
pi 4 @ 0x08000034
EOF
EXPECT=<<EOF
40f24b00c0f6000000f0058040f24c01c0f6000170477047
movw r0, 0x4b
movt r0, 0x800
beq.w sym.tf
movw r1, 0x4c
EOF
RUN

NAME=ARM BE8 ET_REL: arm movw/movt relocs patch little-endian words
FILE=bins/elf/arm_be-be8-thumb-movw.o
ARGS=-e bin.relocs.apply=true
CMDS=<<EOF
p8 16 @ 0x08000048
e asm.bits=32
pi 2 @ 0x08000048
EOF
EXPECT=<<EOF
542000e3002840e31eff2fe11eff2fe1
movw r2, 0x54
movt r2, 0x800
EOF
RUN

# arm_be-be8-thumb-reloc.o with 0x48 70 -> 00, 0x49 47 -> 00, 0x4a 70 -> 00, 0x4b 47 -> 10, 0x15b 10 -> 14, 0x15f 30 -> 02; a hex:// image because its relocations are applied at file load (bin.relocs.apply), which malloc:// + wff + wx does not give
NAME=ARM BE8 ET_REL: data reloc reads its addend and writes big-endian
FILE=hex://7f454c4601020100000000000000000000010028000000010000000000000000000001a00580000000340000000000280009000840f20000c0f200003ff4feaf40f20001c0f200010000001000000000410000001c616561626900010000001205372d4100060a07410801090200000000000000000000000000000000000000000000000000000000000000030000010000000000000000000000000300000300000000000000000000000003000004000000000000000000000000030000050000000100000000000000000400fff1000000080000000000000000000000010000000b0000000000000000000000030000000e000000000000000010000003000000130000000100000000120000010000001200000017000000001200000100743162652e6f00247400246400646174007466000000000000000000000a2f0000000400000a300000000800000a330000000c0000082f0000001400000802002e73796d746162002e737472746162002e7368737472746162002e72656c2e74657874002e64617461002e627373002e41524d2e6174747269627574657300000000000000000000000000000000000000000000000000000000000000000000000000000000000000001f0000000100000006000000000000003400000018000000000000000000000002000000000000001b000000090000004000000000000001380000002800000006000000010000000400000008000000250000000100000003000000000000004c00000004000000000000000000000001000000000000002b00000008000000030000000000000050000000000000000000000000000000010000000000000030700000030000000000000000000000500000001d000000000000000000000001000000000000000100000002000000000000000000000070000000b0000000070000000800000004000000100000000900000003000000000000000000000120000000150000000000000000000000010000000000000011000000030000000000000000000001600000004000000000000000000000000100000000
ARGS=-e bin.relocs.apply=true
CMDS=<<EOF
p8 0x18 @ 0x08000034
EOF
EXPECT=<<EOF
40f24b00c0f6000000f0058040f24c01c0f200010800005c
EOF
RUN

# arm_be-be8-thumb-movw.o with 0x48 00 -> fe, 0x49 20 -> ff, 0x4a 00 -> ff, 0x4b e3 -> eb, 0x4c 00 -> fe, 0x4d 20 -> ff, 0x4e 40 -> ff, 0x4f e3 -> ea, 0x1db 2b -> 1c, 0x1e3 2c -> 1d; a hex:// image because its relocations are applied at file load (bin.relocs.apply), which malloc:// + wff + wx does not give
NAME=ARM BE8 ET_REL: arm call/jump24 relocs patch little-endian words
FILE=hex://7f454c460102010000000000000000000001002800000001000000000000000000000248058000000034000000000028000d000c40f20001c0f200013ff4feaf3ff4feaf70477047feffffebfeffffea1eff2fe11eff2fe1410000001c616561626900010000001205372d4100060a0741080109020000001eff2fe1000000000000000000000000000000000000000000000000000000000300000100000000000000000000000003000003000000000000000000000000030000040000000000000000000000000300000500000000000000000000000003000007000000000000000000000000030000080000000100000000000000000400fff10000000c0000000000000000000000010000000f0000000000000000000000050000001200000000000000000400fff10000000f0000000000000000000000080000001f0000000100000000120000010000001c0000000000000000120000050000001e0000000c00000000120000050000002100000000000000001200000800000023000000130000000012000001006265382d626533322e6f0024740024610076342d626533322e6f006700616600680074660000000000000000000e2f0000000400000e3000000008000010330000000c00000e330000000000000e1c0000000400000e1d0000000000000028002e73796d746162002e737472746162002e7368737472746162002e72656c2e74657874002e64617461002e627373002e72656c2e746578742e61726d002e41524d2e61747472696275746573002e72656c2e746578742e76340000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001f0000000100000006000000000000003400000014000000000000000000000002000000000000001b000000090000004000000000000001b4000000200000000a000000010000000400000008000000250000000100000003000000000000004800000000000000000000000000000001000000000000002b0000000800000003000000000000004800000000000000000000000000000001000000000000003400000001000000060000000000000048000000100000000000000000000000040000000000000030000000090000004000000000000001d4000000100000000a0000000500000004000000080000003e700000030000000000000000000000580000001d00000000000000000000000100000000000000520000000100000006000000000000007800000004000000000000000000000004000000000000004e000000090000004000000000000001e4000000080000000a000000080000000400000008000000010000000200000000000000000000007c000001100000000b0000000c0000000400000010000000090000000300000000000000000000018c000000260000000000000000000000010000000000000011000000030000000000000000000001ec0000005b00000000000000000000000100000000
ARGS=-e bin.relocs.apply=true
CMDS=<<EOF
p8 8 @ 0x08000048
e asm.bits=32
pi 2 @ 0x08000048
EOF
EXPECT=<<EOF
010000eb000000ea
bl sym.af
b sym.af
EOF
RUN

# arm_be-be8-thumb-movw.o with 0x1db 2b -> 2d, 0x1e3 2c -> 2e; a hex:// image because its relocations are applied at file load (bin.relocs.apply), which malloc:// + wff + wx does not give
NAME=ARM BE8 ET_REL: arm movw/movt prel relocs patch little-endian words
FILE=hex://7f454c460102010000000000000000000001002800000001000000000000000000000248058000000034000000000028000d000c40f20001c0f200013ff4feaf3ff4feaf70477047002000e3002040e31eff2fe11eff2fe1410000001c616561626900010000001205372d4100060a0741080109020000001eff2fe1000000000000000000000000000000000000000000000000000000000300000100000000000000000000000003000003000000000000000000000000030000040000000000000000000000000300000500000000000000000000000003000007000000000000000000000000030000080000000100000000000000000400fff10000000c0000000000000000000000010000000f0000000000000000000000050000001200000000000000000400fff10000000f0000000000000000000000080000001f0000000100000000120000010000001c0000000000000000120000050000001e0000000c00000000120000050000002100000000000000001200000800000023000000130000000012000001006265382d626533322e6f0024740024610076342d626533322e6f006700616600680074660000000000000000000e2f0000000400000e3000000008000010330000000c00000e330000000000000e2d0000000400000e2e0000000000000028002e73796d746162002e737472746162002e7368737472746162002e72656c2e74657874002e64617461002e627373002e72656c2e746578742e61726d002e41524d2e61747472696275746573002e72656c2e746578742e76340000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001f0000000100000006000000000000003400000014000000000000000000000002000000000000001b000000090000004000000000000001b4000000200000000a000000010000000400000008000000250000000100000003000000000000004800000000000000000000000000000001000000000000002b0000000800000003000000000000004800000000000000000000000000000001000000000000003400000001000000060000000000000048000000100000000000000000000000040000000000000030000000090000004000000000000001d4000000100000000a0000000500000004000000080000003e700000030000000000000000000000580000001d00000000000000000000000100000000000000520000000100000006000000000000007800000004000000000000000000000004000000000000004e000000090000004000000000000001e4000000080000000a000000080000000400000008000000010000000200000000000000000000007c000001100000000b0000000c0000000400000010000000090000000300000000000000000000018c000000260000000000000000000000010000000000000011000000030000000000000000000001ec0000005b00000000000000000000000100000000
ARGS=-e bin.relocs.apply=true
CMDS=<<EOF
p8 8 @ 0x08000048
e asm.bits=32
pi 2 @ 0x08000048
EOF
EXPECT=<<EOF
0c2000e3002040e3
movw r2, 0xc
movt r2, 0
EOF
RUN

# arm_be-be8-thumb-movw.o with 0x3c 3f -> ff, 0x3d f4 -> f7, 0x3f af -> ff, 0x1cb 33 -> 0a; a hex:// image because its relocations are applied at file load (bin.relocs.apply), which malloc:// + wff + wx does not give
NAME=ARM BE8 ET_REL: thumb pc22 reloc patches little-endian halfwords
FILE=hex://7f454c460102010000000000000000000001002800000001000000000000000000000248058000000034000000000028000d000c40f20001c0f20001fff7feff3ff4feaf70477047002000e3002040e31eff2fe11eff2fe1410000001c616561626900010000001205372d4100060a0741080109020000001eff2fe1000000000000000000000000000000000000000000000000000000000300000100000000000000000000000003000003000000000000000000000000030000040000000000000000000000000300000500000000000000000000000003000007000000000000000000000000030000080000000100000000000000000400fff10000000c0000000000000000000000010000000f0000000000000000000000050000001200000000000000000400fff10000000f0000000000000000000000080000001f0000000100000000120000010000001c0000000000000000120000050000001e0000000c00000000120000050000002100000000000000001200000800000023000000130000000012000001006265382d626533322e6f0024740024610076342d626533322e6f006700616600680074660000000000000000000e2f0000000400000e30000000080000100a0000000c00000e330000000000000e2b0000000400000e2c0000000000000028002e73796d746162002e737472746162002e7368737472746162002e72656c2e74657874002e64617461002e627373002e72656c2e746578742e61726d002e41524d2e61747472696275746573002e72656c2e746578742e76340000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001f0000000100000006000000000000003400000014000000000000000000000002000000000000001b000000090000004000000000000001b4000000200000000a000000010000000400000008000000250000000100000003000000000000004800000000000000000000000000000001000000000000002b0000000800000003000000000000004800000000000000000000000000000001000000000000003400000001000000060000000000000048000000100000000000000000000000040000000000000030000000090000004000000000000001d4000000100000000a0000000500000004000000080000003e700000030000000000000000000000580000001d00000000000000000000000100000000000000520000000100000006000000000000007800000004000000000000000000000004000000000000004e000000090000004000000000000001e4000000080000000a000000080000000400000008000000010000000200000000000000000000007c000001100000000b0000000c0000000400000010000000090000000300000000000000000000018c000000260000000000000000000000010000000000000011000000030000000000000000000001ec0000005b00000000000000000000000100000000
ARGS=-e bin.relocs.apply=true
CMDS=<<EOF
p8 4 @ 0x0800003c
pi 1 @ 0x0800003c
EOF
EXPECT=<<EOF
00f003f8
bl sym.tf
EOF
RUN

# arm_be-be8-thumb-reloc.o with 0x36 00 -> 08, 0x117 17 -> 00, 0x11f 01 -> 00; a hex:// image because its relocations are applied at file load (bin.relocs.apply), which malloc:// + wff + wx does not give
NAME=ARM BE8 ET_REL: import reloc reads its in-place thumb addend little-endian
FILE=hex://7f454c4601020100000000000000000000010028000000010000000000000000000001a00580000000340000000000280009000840f20800c0f200003ff4feaf40f20001c0f200017047704700000000410000001c616561626900010000001205372d4100060a07410801090200000000000000000000000000000000000000000000000000000000000000030000010000000000000000000000000300000300000000000000000000000003000004000000000000000000000000030000050000000100000000000000000400fff1000000080000000000000000000000010000000b0000000000000000000000030000000e000000000000000010000003000000130000000100000000120000010000001200000000000000001200000000743162652e6f00247400246400646174007466000000000000000000000a2f0000000400000a300000000800000a330000000c0000082f0000001000000830002e73796d746162002e737472746162002e7368737472746162002e72656c2e74657874002e64617461002e627373002e41524d2e6174747269627574657300000000000000000000000000000000000000000000000000000000000000000000000000000000000000001f0000000100000006000000000000003400000018000000000000000000000002000000000000001b000000090000004000000000000001380000002800000006000000010000000400000008000000250000000100000003000000000000004c00000004000000000000000000000001000000000000002b00000008000000030000000000000050000000000000000000000000000000010000000000000030700000030000000000000000000000500000001d000000000000000000000001000000000000000100000002000000000000000000000070000000b0000000070000000800000004000000100000000900000003000000000000000000000120000000150000000000000000000000010000000000000011000000030000000000000000000001600000004000000000000000000000000100000000
ARGS=-e bin.relocs.apply=true
CMDS=<<EOF
ir
p8 8 @ 0x08000034
pi 2 @ 0x08000034
EOF
EXPECT=<<EOF
vaddr      paddr      type   ntype name
---------------------------------------
0x08000034 0x00000034 SET_32 47    tf + 0x080001a0
0x08000038 0x00000038 SET_32 48    tf + 0x080001a0
0x0800003c 0x0000003c SET_32 51    tf + 0x080001a0
0x08000040 0x00000040 SET_32 47    dat + 0x080001a0
0x08000044 0x00000044 SET_32 48    dat + 0x080001a0
0x080001a0 0x00000034 SET_32 47    tf + 0x080001a0
40f2a810c0f60000
movw r0, 0x1a8
movt r0, 0x800
EOF
RUN

# arm_be-be8-thumb-reloc.o with 0x25 80 -> 00, 0x34 40 -> f2, 0x35 f2 -> 40, 0x38 c0 -> f2, 0x39 f2 -> c0, 0x3c 3f -> f4, 0x3d f4 -> 3f, 0x3e fe -> af, 0x3f af -> fe, 0x40 40 -> f2, 0x41 f2 -> 40, 0x42 00 -> 01, 0x43 01 -> 00, 0x44 c0 -> f2, 0x45 f2 -> c0, 0x46 00 -> 01, 0x47 01 -> 00, 0x48 70 -> 47, 0x49 47 -> 70, 0x4a 70 -> 47, 0x4b 47 -> 70; a hex:// image because its relocations are applied at file load (bin.relocs.apply), which malloc:// + wff + wx does not give
NAME=ARM BE32 ET_REL: thumb relocs keep big-endian halfwords
FILE=hex://7f454c4601020100000000000000000000010028000000010000000000000000000001a005000000003400000000002800090008f2400000f2c00000f43faffef2400100f2c001004770477000000000410000001c616561626900010000001205372d4100060a07410801090200000000000000000000000000000000000000000000000000000000000000030000010000000000000000000000000300000300000000000000000000000003000004000000000000000000000000030000050000000100000000000000000400fff1000000080000000000000000000000010000000b0000000000000000000000030000000e000000000000000010000003000000130000000100000000120000010000001200000017000000001200000100743162652e6f00247400246400646174007466000000000000000000000a2f0000000400000a300000000800000a330000000c0000082f0000001000000830002e73796d746162002e737472746162002e7368737472746162002e72656c2e74657874002e64617461002e627373002e41524d2e6174747269627574657300000000000000000000000000000000000000000000000000000000000000000000000000000000000000001f0000000100000006000000000000003400000018000000000000000000000002000000000000001b000000090000004000000000000001380000002800000006000000010000000400000008000000250000000100000003000000000000004c00000004000000000000000000000001000000000000002b00000008000000030000000000000050000000000000000000000000000000010000000000000030700000030000000000000000000000500000001d000000000000000000000001000000000000000100000002000000000000000000000070000000b0000000070000000800000004000000100000000900000003000000000000000000000120000000150000000000000000000000010000000000000011000000030000000000000000000001600000004000000000000000000000000100000000
ARGS=-e bin.relocs.apply=true
CMDS=<<EOF
p8 0x18 @ 0x08000034
EOF
EXPECT=<<EOF
f240004bf6c00000f0008005f240014cf6c0010047704770
EOF
RUN

# arm_be-be8-thumb-reloc.o as LE with 0x5 02 -> 01, 0x10 00 -> 01, 0x11 01 -> 00, 0x12 00 -> 28, 0x13 28 -> 00, 0x14 00 -> 01, 0x17 01 -> 00, 0x20 00 -> a0, 0x21 00 -> 01, 0x22 01 -> 00, 0x23 a0 -> 00, 0x24 05 -> 00, 0x25 80 -> 00, 0x27 00 -> 05, 0x28 00 -> 34, 0x29 34 -> 00, 0x2e 00 -> 28, 0x2f 28 -> 00, 0x30 00 -> 09, 0x31 09 -> 00, 0x32 00 -> 08, 0x33 08 -> 00, 0x51 00 -> 1c, 0x54 1c -> 00, 0x5b 01 -> 00, 0x5e 00 -> 01, 0x8e 00 -> 01, 0x8f 01 -> 00, 0x9e 00 -> 03, 0x9f 03 -> 00, 0xae 00 -> 04, 0xaf 04 -> 00, 0xbe 00 -> 05, 0xbf 05 -> 00, 0xc0 00 -> 01, 0xc3 01 -> 00, 0xce ff -> f1, 0xcf f1 -> ff, 0xd0 00 -> 08, 0xd3 08 -> 00, 0xde 00 -> 01, 0xdf 01 -> 00, 0xe0 00 -> 0b, 0xe3 0b -> 00, 0xee 00 -> 03, 0xef 03 -> 00, 0xf0 00 -> 0e, 0xf3 0e -> 00, 0xfe 00 -> 03, 0xff 03 -> 00, 0x100 00 -> 13, 0x103 13 -> 00, 0x104 00 -> 01, 0x107 01 -> 00, 0x10e 00 -> 01, 0x10f 01 -> 00, 0x110 00 -> 12, 0x113 12 -> 00, 0x114 00 -> 17, 0x117 17 -> 00, 0x11e 00 -> 01, 0x11f 01 -> 00, 0x13c 00 -> 2f, 0x13d 00 -> 0a, 0x13e 0a -> 00, 0x13f 2f -> 00, 0x140 00 -> 04, 0x143 04 -> 00, 0x144 00 -> 30, 0x145 00 -> 0a, 0x146 0a -> 00, 0x147 30 -> 00, 0x148 00 -> 08, 0x14b 08 -> 00, 0x14c 00 -> 33, 0x14d 00 -> 0a, 0x14e 0a -> 00, 0x14f 33 -> 00, 0x150 00 -> 0c, 0x153 0c -> 00, 0x154 00 -> 2f, 0x155 00 -> 08, 0x156 08 -> 00, 0x157 2f -> 00, 0x158 00 -> 10, 0x15b 10 -> 00, 0x15c 00 -> 30, 0x15d 00 -> 08, 0x15e 08 -> 00, 0x15f 30 -> 00, 0x1c8 00 -> 1f, 0x1cb 1f -> 00, 0x1cc 00 -> 01, 0x1cf 01 -> 00, 0x1d0 00 -> 06, 0x1d3 06 -> 00, 0x1d8 00 -> 34, 0x1db 34 -> 00, 0x1dc 00 -> 18, 0x1df 18 -> 00, 0x1e8 00 -> 02, 0x1eb 02 -> 00, 0x1f0 00 -> 1b, 0x1f3 1b -> 00, 0x1f4 00 -> 09, 0x1f7 09 -> 00, 0x1f8 00 -> 40, 0x1fb 40 -> 00, 0x200 00 -> 38, 0x201 00 -> 01, 0x202 01 -> 00, 0x203 38 -> 00, 0x204 00 -> 28, 0x207 28 -> 00, 0x208 00 -> 06, 0x20b 06 -> 00, 0x20c 00 -> 01, 0x20f 01 -> 00, 0x210 00 -> 04, 0x213 04 -> 00, 0x214 00 -> 08, 0x217 08 -> 00, 0x218 00 -> 25, 0x21b 25 -> 00, 0x21c 00 -> 01, 0x21f 01 -> 00, 0x220 00 -> 03, 0x223 03 -> 00, 0x228 00 -> 4c, 0x22b 4c -> 00, 0x22c 00 -> 04, 0x22f 04 -> 00, 0x238 00 -> 01, 0x23b 01 -> 00, 0x240 00 -> 2b, 0x243 2b -> 00, 0x244 00 -> 08, 0x247 08 -> 00, 0x248 00 -> 03, 0x24b 03 -> 00, 0x250 00 -> 50, 0x253 50 -> 00, 0x260 00 -> 01, 0x263 01 -> 00, 0x268 00 -> 30, 0x26b 30 -> 00, 0x26c 70 -> 03, 0x26f 03 -> 70, 0x278 00 -> 50, 0x27b 50 -> 00, 0x27c 00 -> 1d, 0x27f 1d -> 00, 0x288 00 -> 01, 0x28b 01 -> 00, 0x290 00 -> 01, 0x293 01 -> 00, 0x294 00 -> 02, 0x297 02 -> 00, 0x2a0 00 -> 70, 0x2a3 70 -> 00, 0x2a4 00 -> b0, 0x2a7 b0 -> 00, 0x2a8 00 -> 07, 0x2ab 07 -> 00, 0x2ac 00 -> 08, 0x2af 08 -> 00, 0x2b0 00 -> 04, 0x2b3 04 -> 00, 0x2b4 00 -> 10, 0x2b7 10 -> 00, 0x2b8 00 -> 09, 0x2bb 09 -> 00, 0x2bc 00 -> 03, 0x2bf 03 -> 00, 0x2c8 00 -> 20, 0x2c9 00 -> 01, 0x2ca 01 -> 00, 0x2cb 20 -> 00, 0x2cc 00 -> 15, 0x2cf 15 -> 00, 0x2d8 00 -> 01, 0x2db 01 -> 00, 0x2e0 00 -> 11, 0x2e3 11 -> 00, 0x2e4 00 -> 03, 0x2e7 03 -> 00, 0x2f0 00 -> 60, 0x2f1 00 -> 01, 0x2f2 01 -> 00, 0x2f3 60 -> 00, 0x2f4 00 -> 40, 0x2f7 40 -> 00, 0x300 00 -> 01, 0x303 01 -> 00; a hex:// image because its relocations are applied at file load (bin.relocs.apply), which malloc:// + wff + wx does not give
NAME=ARM LE ET_REL: thumb movw/movt and jump19 relocs keep little-endian halfwords
FILE=hex://7f454c4601010100000000000000000001002800010000000000000000000000a00100000000000534000000000028000900080040f20000c0f200003ff4feaf40f20001c0f200017047704700000000411c000000616561626900000000011205372d4100060a07410801090200000000000000000000000000000000000000000000000000000000000000030001000000000000000000000000000300030000000000000000000000000003000400000000000000000000000000030005000100000000000000000000000400f1ff080000000000000000000000000001000b0000000000000000000000000003000e000000000000000000000010000300130000000100000000000000120001001200000017000000000000001200010000743162652e6f0024740024640064617400746600000000000000002f0a000004000000300a000008000000330a00000c0000002f0800001000000030080000002e73796d746162002e737472746162002e7368737472746162002e72656c2e74657874002e64617461002e627373002e41524d2e6174747269627574657300000000000000000000000000000000000000000000000000000000000000000000000000000000001f0000000100000006000000000000003400000018000000000000000000000002000000000000001b000000090000004000000000000000380100002800000006000000010000000400000008000000250000000100000003000000000000004c00000004000000000000000000000001000000000000002b00000008000000030000000000000050000000000000000000000000000000010000000000000030000000030000700000000000000000500000001d000000000000000000000001000000000000000100000002000000000000000000000070000000b0000000070000000800000004000000100000000900000003000000000000000000000020010000150000000000000000000000010000000000000011000000030000000000000000000000600100004000000000000000000000000100000000000000
ARGS=-e bin.relocs.apply=true
CMDS=<<EOF
p8 0x18 @ 0x08000034
pi 4 @ 0x08000034
EOF
EXPECT=<<EOF
40f24b00c0f6000000f0058040f24c01c0f6000170477047
movw r0, 0x4b
movt r0, 0x800
beq.w sym.tf
movw r1, 0x4c
EOF
RUN

# arm_be-be8-thumb-movw.o as LE with 0x5 02 -> 01, 0x10 00 -> 01, 0x11 01 -> 00, 0x12 00 -> 28, 0x13 28 -> 00, 0x14 00 -> 01, 0x17 01 -> 00, 0x20 00 -> 48, 0x21 00 -> 02, 0x22 02 -> 00, 0x23 48 -> 00, 0x24 05 -> 00, 0x25 80 -> 00, 0x27 00 -> 05, 0x28 00 -> 34, 0x29 34 -> 00, 0x2e 00 -> 28, 0x2f 28 -> 00, 0x30 00 -> 0d, 0x31 0d -> 00, 0x32 00 -> 0c, 0x33 0c -> 00, 0x59 00 -> 1c, 0x5c 1c -> 00, 0x63 01 -> 00, 0x66 00 -> 01, 0x9a 00 -> 01, 0x9b 01 -> 00, 0xaa 00 -> 03, 0xab 03 -> 00, 0xba 00 -> 04, 0xbb 04 -> 00, 0xca 00 -> 05, 0xcb 05 -> 00, 0xda 00 -> 07, 0xdb 07 -> 00, 0xea 00 -> 08, 0xeb 08 -> 00, 0xec 00 -> 01, 0xef 01 -> 00, 0xfa ff -> f1, 0xfb f1 -> ff, 0xfc 00 -> 0c, 0xff 0c -> 00, 0x10a 00 -> 01, 0x10b 01 -> 00, 0x10c 00 -> 0f, 0x10f 0f -> 00, 0x11a 00 -> 05, 0x11b 05 -> 00, 0x11c 00 -> 12, 0x11f 12 -> 00, 0x12a ff -> f1, 0x12b f1 -> ff, 0x12c 00 -> 0f, 0x12f 0f -> 00, 0x13a 00 -> 08, 0x13b 08 -> 00, 0x13c 00 -> 1f, 0x13f 1f -> 00, 0x140 00 -> 01, 0x143 01 -> 00, 0x14a 00 -> 01, 0x14b 01 -> 00, 0x14c 00 -> 1c, 0x14f 1c -> 00, 0x15a 00 -> 05, 0x15b 05 -> 00, 0x15c 00 -> 1e, 0x15f 1e -> 00, 0x160 00 -> 0c, 0x163 0c -> 00, 0x16a 00 -> 05, 0x16b 05 -> 00, 0x16c 00 -> 21, 0x16f 21 -> 00, 0x17a 00 -> 08, 0x17b 08 -> 00, 0x17c 00 -> 23, 0x17f 23 -> 00, 0x180 00 -> 13, 0x183 13 -> 00, 0x18a 00 -> 01, 0x18b 01 -> 00, 0x1b8 00 -> 2f, 0x1b9 00 -> 0e, 0x1ba 0e -> 00, 0x1bb 2f -> 00, 0x1bc 00 -> 04, 0x1bf 04 -> 00, 0x1c0 00 -> 30, 0x1c1 00 -> 0e, 0x1c2 0e -> 00, 0x1c3 30 -> 00, 0x1c4 00 -> 08, 0x1c7 08 -> 00, 0x1c8 00 -> 33, 0x1c9 00 -> 10, 0x1ca 10 -> 00, 0x1cb 33 -> 00, 0x1cc 00 -> 0c, 0x1cf 0c -> 00, 0x1d0 00 -> 33, 0x1d1 00 -> 0e, 0x1d2 0e -> 00, 0x1d3 33 -> 00, 0x1d8 00 -> 2b, 0x1d9 00 -> 0e, 0x1da 0e -> 00, 0x1db 2b -> 00, 0x1dc 00 -> 04, 0x1df 04 -> 00, 0x1e0 00 -> 2c, 0x1e1 00 -> 0e, 0x1e2 0e -> 00, 0x1e3 2c -> 00, 0x1e8 00 -> 28, 0x1eb 28 -> 00, 0x270 00 -> 1f, 0x273 1f -> 00, 0x274 00 -> 01, 0x277 01 -> 00, 0x278 00 -> 06, 0x27b 06 -> 00, 0x280 00 -> 34, 0x283 34 -> 00, 0x284 00 -> 14, 0x287 14 -> 00, 0x290 00 -> 02, 0x293 02 -> 00, 0x298 00 -> 1b, 0x29b 1b -> 00, 0x29c 00 -> 09, 0x29f 09 -> 00, 0x2a0 00 -> 40, 0x2a3 40 -> 00, 0x2a8 00 -> b4, 0x2a9 00 -> 01, 0x2aa 01 -> 00, 0x2ab b4 -> 00, 0x2ac 00 -> 20, 0x2af 20 -> 00, 0x2b0 00 -> 0a, 0x2b3 0a -> 00, 0x2b4 00 -> 01, 0x2b7 01 -> 00, 0x2b8 00 -> 04, 0x2bb 04 -> 00, 0x2bc 00 -> 08, 0x2bf 08 -> 00, 0x2c0 00 -> 25, 0x2c3 25 -> 00, 0x2c4 00 -> 01, 0x2c7 01 -> 00, 0x2c8 00 -> 03, 0x2cb 03 -> 00, 0x2d0 00 -> 48, 0x2d3 48 -> 00, 0x2e0 00 -> 01, 0x2e3 01 -> 00, 0x2e8 00 -> 2b, 0x2eb 2b -> 00, 0x2ec 00 -> 08, 0x2ef 08 -> 00, 0x2f0 00 -> 03, 0x2f3 03 -> 00, 0x2f8 00 -> 48, 0x2fb 48 -> 00, 0x308 00 -> 01, 0x30b 01 -> 00, 0x310 00 -> 34, 0x313 34 -> 00, 0x314 00 -> 01, 0x317 01 -> 00, 0x318 00 -> 06, 0x31b 06 -> 00, 0x320 00 -> 48, 0x323 48 -> 00, 0x324 00 -> 10, 0x327 10 -> 00, 0x330 00 -> 04, 0x333 04 -> 00, 0x338 00 -> 30, 0x33b 30 -> 00, 0x33c 00 -> 09, 0x33f 09 -> 00, 0x340 00 -> 40, 0x343 40 -> 00, 0x348 00 -> d4, 0x349 00 -> 01, 0x34a 01 -> 00, 0x34b d4 -> 00, 0x34c 00 -> 10, 0x34f 10 -> 00, 0x350 00 -> 0a, 0x353 0a -> 00, 0x354 00 -> 05, 0x357 05 -> 00, 0x358 00 -> 04, 0x35b 04 -> 00, 0x35c 00 -> 08, 0x35f 08 -> 00, 0x360 00 -> 3e, 0x363 3e -> 00, 0x364 70 -> 03, 0x367 03 -> 70, 0x370 00 -> 58, 0x373 58 -> 00, 0x374 00 -> 1d, 0x377 1d -> 00, 0x380 00 -> 01, 0x383 01 -> 00, 0x388 00 -> 52, 0x38b 52 -> 00, 0x38c 00 -> 01, 0x38f 01 -> 00, 0x390 00 -> 06, 0x393 06 -> 00, 0x398 00 -> 78, 0x39b 78 -> 00, 0x39c 00 -> 04, 0x39f 04 -> 00, 0x3a8 00 -> 04, 0x3ab 04 -> 00, 0x3b0 00 -> 4e, 0x3b3 4e -> 00, 0x3b4 00 -> 09, 0x3b7 09 -> 00, 0x3b8 00 -> 40, 0x3bb 40 -> 00, 0x3c0 00 -> e4, 0x3c1 00 -> 01, 0x3c2 01 -> 00, 0x3c3 e4 -> 00, 0x3c4 00 -> 08, 0x3c7 08 -> 00, 0x3c8 00 -> 0a, 0x3cb 0a -> 00, 0x3cc 00 -> 08, 0x3cf 08 -> 00, 0x3d0 00 -> 04, 0x3d3 04 -> 00, 0x3d4 00 -> 08, 0x3d7 08 -> 00, 0x3d8 00 -> 01, 0x3db 01 -> 00, 0x3dc 00 -> 02, 0x3df 02 -> 00, 0x3e8 00 -> 7c, 0x3eb 7c -> 00, 0x3ec 00 -> 10, 0x3ed 00 -> 01, 0x3ee 01 -> 00, 0x3ef 10 -> 00, 0x3f0 00 -> 0b, 0x3f3 0b -> 00, 0x3f4 00 -> 0c, 0x3f7 0c -> 00, 0x3f8 00 -> 04, 0x3fb 04 -> 00, 0x3fc 00 -> 10, 0x3ff 10 -> 00, 0x400 00 -> 09, 0x403 09 -> 00, 0x404 00 -> 03, 0x407 03 -> 00, 0x410 00 -> 8c, 0x411 00 -> 01, 0x412 01 -> 00, 0x413 8c -> 00, 0x414 00 -> 26, 0x417 26 -> 00, 0x420 00 -> 01, 0x423 01 -> 00, 0x428 00 -> 11, 0x42b 11 -> 00, 0x42c 00 -> 03, 0x42f 03 -> 00, 0x438 00 -> ec, 0x439 00 -> 01, 0x43a 01 -> 00, 0x43b ec -> 00, 0x43c 00 -> 5b, 0x43f 5b -> 00, 0x448 00 -> 01, 0x44b 01 -> 00; a hex:// image because its relocations are applied at file load (bin.relocs.apply), which malloc:// + wff + wx does not give
NAME=ARM LE ET_REL: arm movw/movt relocs keep little-endian words
FILE=hex://7f454c4601010100000000000000000001002800010000000000000000000000480200000000000534000000000028000d000c0040f20001c0f200013ff4feaf3ff4feaf70477047002000e3002040e31eff2fe11eff2fe1411c000000616561626900000000011205372d4100060a0741080109020000001eff2fe1000000000000000000000000000000000000000000000000000000000300010000000000000000000000000003000300000000000000000000000000030004000000000000000000000000000300050000000000000000000000000003000700000000000000000000000000030008000100000000000000000000000400f1ff0c0000000000000000000000000001000f0000000000000000000000000005001200000000000000000000000400f1ff0f0000000000000000000000000008001f0000000100000000000000120001001c0000000000000000000000120005001e0000000c00000000000000120005002100000000000000000000001200080023000000130000000000000012000100006265382d626533322e6f0024740024610076342d626533322e6f00670061660068007466000000000000002f0e000004000000300e000008000000331000000c000000330e0000000000002b0e0000040000002c0e00000000000028000000002e73796d746162002e737472746162002e7368737472746162002e72656c2e74657874002e64617461002e627373002e72656c2e746578742e61726d002e41524d2e61747472696275746573002e72656c2e746578742e76340000000000000000000000000000000000000000000000000000000000000000000000000000000000001f0000000100000006000000000000003400000014000000000000000000000002000000000000001b000000090000004000000000000000b4010000200000000a000000010000000400000008000000250000000100000003000000000000004800000000000000000000000000000001000000000000002b0000000800000003000000000000004800000000000000000000000000000001000000000000003400000001000000060000000000000048000000100000000000000000000000040000000000000030000000090000004000000000000000d4010000100000000a0000000500000004000000080000003e000000030000700000000000000000580000001d00000000000000000000000100000000000000520000000100000006000000000000007800000004000000000000000000000004000000000000004e000000090000004000000000000000e4010000080000000a000000080000000400000008000000010000000200000000000000000000007c000000100100000b0000000c0000000400000010000000090000000300000000000000000000008c010000260000000000000000000000010000000000000011000000030000000000000000000000ec0100005b00000000000000000000000100000000000000
ARGS=-e bin.relocs.apply=true
CMDS=<<EOF
p8 8 @ 0x08000048
e asm.bits=32
pi 2 @ 0x08000048
EOF
EXPECT=<<EOF
542000e3002840e3
movw r2, 0x54
movt r2, 0x800
EOF
RUN

# arm_be-be8-thumb-reloc.o as LE with 0x5 02 -> 01, 0x10 00 -> 01, 0x11 01 -> 00, 0x12 00 -> 28, 0x13 28 -> 00, 0x14 00 -> 01, 0x17 01 -> 00, 0x20 00 -> a0, 0x21 00 -> 01, 0x22 01 -> 00, 0x23 a0 -> 00, 0x24 05 -> 00, 0x25 80 -> 00, 0x27 00 -> 05, 0x28 00 -> 34, 0x29 34 -> 00, 0x2e 00 -> 28, 0x2f 28 -> 00, 0x30 00 -> 09, 0x31 09 -> 00, 0x32 00 -> 08, 0x33 08 -> 00, 0x48 70 -> 10, 0x49 47 -> 00, 0x4a 70 -> 00, 0x4b 47 -> 00, 0x51 00 -> 1c, 0x54 1c -> 00, 0x5b 01 -> 00, 0x5e 00 -> 01, 0x8e 00 -> 01, 0x8f 01 -> 00, 0x9e 00 -> 03, 0x9f 03 -> 00, 0xae 00 -> 04, 0xaf 04 -> 00, 0xbe 00 -> 05, 0xbf 05 -> 00, 0xc0 00 -> 01, 0xc3 01 -> 00, 0xce ff -> f1, 0xcf f1 -> ff, 0xd0 00 -> 08, 0xd3 08 -> 00, 0xde 00 -> 01, 0xdf 01 -> 00, 0xe0 00 -> 0b, 0xe3 0b -> 00, 0xee 00 -> 03, 0xef 03 -> 00, 0xf0 00 -> 0e, 0xf3 0e -> 00, 0xfe 00 -> 03, 0xff 03 -> 00, 0x100 00 -> 13, 0x103 13 -> 00, 0x104 00 -> 01, 0x107 01 -> 00, 0x10e 00 -> 01, 0x10f 01 -> 00, 0x110 00 -> 12, 0x113 12 -> 00, 0x114 00 -> 17, 0x117 17 -> 00, 0x11e 00 -> 01, 0x11f 01 -> 00, 0x13c 00 -> 2f, 0x13d 00 -> 0a, 0x13e 0a -> 00, 0x13f 2f -> 00, 0x140 00 -> 04, 0x143 04 -> 00, 0x144 00 -> 30, 0x145 00 -> 0a, 0x146 0a -> 00, 0x147 30 -> 00, 0x148 00 -> 08, 0x14b 08 -> 00, 0x14c 00 -> 33, 0x14d 00 -> 0a, 0x14e 0a -> 00, 0x14f 33 -> 00, 0x150 00 -> 0c, 0x153 0c -> 00, 0x154 00 -> 2f, 0x155 00 -> 08, 0x156 08 -> 00, 0x157 2f -> 00, 0x158 00 -> 14, 0x15b 10 -> 00, 0x15c 00 -> 02, 0x15d 00 -> 08, 0x15e 08 -> 00, 0x15f 30 -> 00, 0x1c8 00 -> 1f, 0x1cb 1f -> 00, 0x1cc 00 -> 01, 0x1cf 01 -> 00, 0x1d0 00 -> 06, 0x1d3 06 -> 00, 0x1d8 00 -> 34, 0x1db 34 -> 00, 0x1dc 00 -> 18, 0x1df 18 -> 00, 0x1e8 00 -> 02, 0x1eb 02 -> 00, 0x1f0 00 -> 1b, 0x1f3 1b -> 00, 0x1f4 00 -> 09, 0x1f7 09 -> 00, 0x1f8 00 -> 40, 0x1fb 40 -> 00, 0x200 00 -> 38, 0x201 00 -> 01, 0x202 01 -> 00, 0x203 38 -> 00, 0x204 00 -> 28, 0x207 28 -> 00, 0x208 00 -> 06, 0x20b 06 -> 00, 0x20c 00 -> 01, 0x20f 01 -> 00, 0x210 00 -> 04, 0x213 04 -> 00, 0x214 00 -> 08, 0x217 08 -> 00, 0x218 00 -> 25, 0x21b 25 -> 00, 0x21c 00 -> 01, 0x21f 01 -> 00, 0x220 00 -> 03, 0x223 03 -> 00, 0x228 00 -> 4c, 0x22b 4c -> 00, 0x22c 00 -> 04, 0x22f 04 -> 00, 0x238 00 -> 01, 0x23b 01 -> 00, 0x240 00 -> 2b, 0x243 2b -> 00, 0x244 00 -> 08, 0x247 08 -> 00, 0x248 00 -> 03, 0x24b 03 -> 00, 0x250 00 -> 50, 0x253 50 -> 00, 0x260 00 -> 01, 0x263 01 -> 00, 0x268 00 -> 30, 0x26b 30 -> 00, 0x26c 70 -> 03, 0x26f 03 -> 70, 0x278 00 -> 50, 0x27b 50 -> 00, 0x27c 00 -> 1d, 0x27f 1d -> 00, 0x288 00 -> 01, 0x28b 01 -> 00, 0x290 00 -> 01, 0x293 01 -> 00, 0x294 00 -> 02, 0x297 02 -> 00, 0x2a0 00 -> 70, 0x2a3 70 -> 00, 0x2a4 00 -> b0, 0x2a7 b0 -> 00, 0x2a8 00 -> 07, 0x2ab 07 -> 00, 0x2ac 00 -> 08, 0x2af 08 -> 00, 0x2b0 00 -> 04, 0x2b3 04 -> 00, 0x2b4 00 -> 10, 0x2b7 10 -> 00, 0x2b8 00 -> 09, 0x2bb 09 -> 00, 0x2bc 00 -> 03, 0x2bf 03 -> 00, 0x2c8 00 -> 20, 0x2c9 00 -> 01, 0x2ca 01 -> 00, 0x2cb 20 -> 00, 0x2cc 00 -> 15, 0x2cf 15 -> 00, 0x2d8 00 -> 01, 0x2db 01 -> 00, 0x2e0 00 -> 11, 0x2e3 11 -> 00, 0x2e4 00 -> 03, 0x2e7 03 -> 00, 0x2f0 00 -> 60, 0x2f1 00 -> 01, 0x2f2 01 -> 00, 0x2f3 60 -> 00, 0x2f4 00 -> 40, 0x2f7 40 -> 00, 0x300 00 -> 01, 0x303 01 -> 00; a hex:// image because its relocations are applied at file load (bin.relocs.apply), which malloc:// + wff + wx does not give
NAME=ARM LE ET_REL: data reloc reads its addend and writes little-endian
FILE=hex://7f454c4601010100000000000000000001002800010000000000000000000000a00100000000000534000000000028000900080040f20000c0f200003ff4feaf40f20001c0f200011000000000000000411c000000616561626900000000011205372d4100060a07410801090200000000000000000000000000000000000000000000000000000000000000030001000000000000000000000000000300030000000000000000000000000003000400000000000000000000000000030005000100000000000000000000000400f1ff080000000000000000000000000001000b0000000000000000000000000003000e000000000000000000000010000300130000000100000000000000120001001200000017000000000000001200010000743162652e6f0024740024640064617400746600000000000000002f0a000004000000300a000008000000330a00000c0000002f0800001400000002080000002e73796d746162002e737472746162002e7368737472746162002e72656c2e74657874002e64617461002e627373002e41524d2e6174747269627574657300000000000000000000000000000000000000000000000000000000000000000000000000000000001f0000000100000006000000000000003400000018000000000000000000000002000000000000001b000000090000004000000000000000380100002800000006000000010000000400000008000000250000000100000003000000000000004c00000004000000000000000000000001000000000000002b00000008000000030000000000000050000000000000000000000000000000010000000000000030000000030000700000000000000000500000001d000000000000000000000001000000000000000100000002000000000000000000000070000000b0000000070000000800000004000000100000000900000003000000000000000000000020010000150000000000000000000000010000000000000011000000030000000000000000000000600100004000000000000000000000000100000000000000
ARGS=-e bin.relocs.apply=true
CMDS=<<EOF
p8 4 @ 0x08000048
EOF
EXPECT=<<EOF
5c000008
EOF
RUN

# arm_be-be8-thumb-movw.o as LE with 0x5 02 -> 01, 0x10 00 -> 01, 0x11 01 -> 00, 0x12 00 -> 28, 0x13 28 -> 00, 0x14 00 -> 01, 0x17 01 -> 00, 0x20 00 -> 48, 0x21 00 -> 02, 0x22 02 -> 00, 0x23 48 -> 00, 0x24 05 -> 00, 0x25 80 -> 00, 0x27 00 -> 05, 0x28 00 -> 34, 0x29 34 -> 00, 0x2e 00 -> 28, 0x2f 28 -> 00, 0x30 00 -> 0d, 0x31 0d -> 00, 0x32 00 -> 0c, 0x33 0c -> 00, 0x48 00 -> fe, 0x49 20 -> ff, 0x4a 00 -> ff, 0x4b e3 -> eb, 0x4c 00 -> fe, 0x4d 20 -> ff, 0x4e 40 -> ff, 0x4f e3 -> ea, 0x59 00 -> 1c, 0x5c 1c -> 00, 0x63 01 -> 00, 0x66 00 -> 01, 0x9a 00 -> 01, 0x9b 01 -> 00, 0xaa 00 -> 03, 0xab 03 -> 00, 0xba 00 -> 04, 0xbb 04 -> 00, 0xca 00 -> 05, 0xcb 05 -> 00, 0xda 00 -> 07, 0xdb 07 -> 00, 0xea 00 -> 08, 0xeb 08 -> 00, 0xec 00 -> 01, 0xef 01 -> 00, 0xfa ff -> f1, 0xfb f1 -> ff, 0xfc 00 -> 0c, 0xff 0c -> 00, 0x10a 00 -> 01, 0x10b 01 -> 00, 0x10c 00 -> 0f, 0x10f 0f -> 00, 0x11a 00 -> 05, 0x11b 05 -> 00, 0x11c 00 -> 12, 0x11f 12 -> 00, 0x12a ff -> f1, 0x12b f1 -> ff, 0x12c 00 -> 0f, 0x12f 0f -> 00, 0x13a 00 -> 08, 0x13b 08 -> 00, 0x13c 00 -> 1f, 0x13f 1f -> 00, 0x140 00 -> 01, 0x143 01 -> 00, 0x14a 00 -> 01, 0x14b 01 -> 00, 0x14c 00 -> 1c, 0x14f 1c -> 00, 0x15a 00 -> 05, 0x15b 05 -> 00, 0x15c 00 -> 1e, 0x15f 1e -> 00, 0x160 00 -> 0c, 0x163 0c -> 00, 0x16a 00 -> 05, 0x16b 05 -> 00, 0x16c 00 -> 21, 0x16f 21 -> 00, 0x17a 00 -> 08, 0x17b 08 -> 00, 0x17c 00 -> 23, 0x17f 23 -> 00, 0x180 00 -> 13, 0x183 13 -> 00, 0x18a 00 -> 01, 0x18b 01 -> 00, 0x1b8 00 -> 2f, 0x1b9 00 -> 0e, 0x1ba 0e -> 00, 0x1bb 2f -> 00, 0x1bc 00 -> 04, 0x1bf 04 -> 00, 0x1c0 00 -> 30, 0x1c1 00 -> 0e, 0x1c2 0e -> 00, 0x1c3 30 -> 00, 0x1c4 00 -> 08, 0x1c7 08 -> 00, 0x1c8 00 -> 33, 0x1c9 00 -> 10, 0x1ca 10 -> 00, 0x1cb 33 -> 00, 0x1cc 00 -> 0c, 0x1cf 0c -> 00, 0x1d0 00 -> 33, 0x1d1 00 -> 0e, 0x1d2 0e -> 00, 0x1d3 33 -> 00, 0x1d8 00 -> 1c, 0x1d9 00 -> 0e, 0x1da 0e -> 00, 0x1db 2b -> 00, 0x1dc 00 -> 04, 0x1df 04 -> 00, 0x1e0 00 -> 1d, 0x1e1 00 -> 0e, 0x1e2 0e -> 00, 0x1e3 2c -> 00, 0x1e8 00 -> 28, 0x1eb 28 -> 00, 0x270 00 -> 1f, 0x273 1f -> 00, 0x274 00 -> 01, 0x277 01 -> 00, 0x278 00 -> 06, 0x27b 06 -> 00, 0x280 00 -> 34, 0x283 34 -> 00, 0x284 00 -> 14, 0x287 14 -> 00, 0x290 00 -> 02, 0x293 02 -> 00, 0x298 00 -> 1b, 0x29b 1b -> 00, 0x29c 00 -> 09, 0x29f 09 -> 00, 0x2a0 00 -> 40, 0x2a3 40 -> 00, 0x2a8 00 -> b4, 0x2a9 00 -> 01, 0x2aa 01 -> 00, 0x2ab b4 -> 00, 0x2ac 00 -> 20, 0x2af 20 -> 00, 0x2b0 00 -> 0a, 0x2b3 0a -> 00, 0x2b4 00 -> 01, 0x2b7 01 -> 00, 0x2b8 00 -> 04, 0x2bb 04 -> 00, 0x2bc 00 -> 08, 0x2bf 08 -> 00, 0x2c0 00 -> 25, 0x2c3 25 -> 00, 0x2c4 00 -> 01, 0x2c7 01 -> 00, 0x2c8 00 -> 03, 0x2cb 03 -> 00, 0x2d0 00 -> 48, 0x2d3 48 -> 00, 0x2e0 00 -> 01, 0x2e3 01 -> 00, 0x2e8 00 -> 2b, 0x2eb 2b -> 00, 0x2ec 00 -> 08, 0x2ef 08 -> 00, 0x2f0 00 -> 03, 0x2f3 03 -> 00, 0x2f8 00 -> 48, 0x2fb 48 -> 00, 0x308 00 -> 01, 0x30b 01 -> 00, 0x310 00 -> 34, 0x313 34 -> 00, 0x314 00 -> 01, 0x317 01 -> 00, 0x318 00 -> 06, 0x31b 06 -> 00, 0x320 00 -> 48, 0x323 48 -> 00, 0x324 00 -> 10, 0x327 10 -> 00, 0x330 00 -> 04, 0x333 04 -> 00, 0x338 00 -> 30, 0x33b 30 -> 00, 0x33c 00 -> 09, 0x33f 09 -> 00, 0x340 00 -> 40, 0x343 40 -> 00, 0x348 00 -> d4, 0x349 00 -> 01, 0x34a 01 -> 00, 0x34b d4 -> 00, 0x34c 00 -> 10, 0x34f 10 -> 00, 0x350 00 -> 0a, 0x353 0a -> 00, 0x354 00 -> 05, 0x357 05 -> 00, 0x358 00 -> 04, 0x35b 04 -> 00, 0x35c 00 -> 08, 0x35f 08 -> 00, 0x360 00 -> 3e, 0x363 3e -> 00, 0x364 70 -> 03, 0x367 03 -> 70, 0x370 00 -> 58, 0x373 58 -> 00, 0x374 00 -> 1d, 0x377 1d -> 00, 0x380 00 -> 01, 0x383 01 -> 00, 0x388 00 -> 52, 0x38b 52 -> 00, 0x38c 00 -> 01, 0x38f 01 -> 00, 0x390 00 -> 06, 0x393 06 -> 00, 0x398 00 -> 78, 0x39b 78 -> 00, 0x39c 00 -> 04, 0x39f 04 -> 00, 0x3a8 00 -> 04, 0x3ab 04 -> 00, 0x3b0 00 -> 4e, 0x3b3 4e -> 00, 0x3b4 00 -> 09, 0x3b7 09 -> 00, 0x3b8 00 -> 40, 0x3bb 40 -> 00, 0x3c0 00 -> e4, 0x3c1 00 -> 01, 0x3c2 01 -> 00, 0x3c3 e4 -> 00, 0x3c4 00 -> 08, 0x3c7 08 -> 00, 0x3c8 00 -> 0a, 0x3cb 0a -> 00, 0x3cc 00 -> 08, 0x3cf 08 -> 00, 0x3d0 00 -> 04, 0x3d3 04 -> 00, 0x3d4 00 -> 08, 0x3d7 08 -> 00, 0x3d8 00 -> 01, 0x3db 01 -> 00, 0x3dc 00 -> 02, 0x3df 02 -> 00, 0x3e8 00 -> 7c, 0x3eb 7c -> 00, 0x3ec 00 -> 10, 0x3ed 00 -> 01, 0x3ee 01 -> 00, 0x3ef 10 -> 00, 0x3f0 00 -> 0b, 0x3f3 0b -> 00, 0x3f4 00 -> 0c, 0x3f7 0c -> 00, 0x3f8 00 -> 04, 0x3fb 04 -> 00, 0x3fc 00 -> 10, 0x3ff 10 -> 00, 0x400 00 -> 09, 0x403 09 -> 00, 0x404 00 -> 03, 0x407 03 -> 00, 0x410 00 -> 8c, 0x411 00 -> 01, 0x412 01 -> 00, 0x413 8c -> 00, 0x414 00 -> 26, 0x417 26 -> 00, 0x420 00 -> 01, 0x423 01 -> 00, 0x428 00 -> 11, 0x42b 11 -> 00, 0x42c 00 -> 03, 0x42f 03 -> 00, 0x438 00 -> ec, 0x439 00 -> 01, 0x43a 01 -> 00, 0x43b ec -> 00, 0x43c 00 -> 5b, 0x43f 5b -> 00, 0x448 00 -> 01, 0x44b 01 -> 00; a hex:// image because its relocations are applied at file load (bin.relocs.apply), which malloc:// + wff + wx does not give
NAME=ARM LE ET_REL: arm call/jump24 relocs keep little-endian words
FILE=hex://7f454c4601010100000000000000000001002800010000000000000000000000480200000000000534000000000028000d000c0040f20001c0f200013ff4feaf3ff4feaf70477047feffffebfeffffea1eff2fe11eff2fe1411c000000616561626900000000011205372d4100060a0741080109020000001eff2fe1000000000000000000000000000000000000000000000000000000000300010000000000000000000000000003000300000000000000000000000000030004000000000000000000000000000300050000000000000000000000000003000700000000000000000000000000030008000100000000000000000000000400f1ff0c0000000000000000000000000001000f0000000000000000000000000005001200000000000000000000000400f1ff0f0000000000000000000000000008001f0000000100000000000000120001001c0000000000000000000000120005001e0000000c00000000000000120005002100000000000000000000001200080023000000130000000000000012000100006265382d626533322e6f0024740024610076342d626533322e6f00670061660068007466000000000000002f0e000004000000300e000008000000331000000c000000330e0000000000001c0e0000040000001d0e00000000000028000000002e73796d746162002e737472746162002e7368737472746162002e72656c2e74657874002e64617461002e627373002e72656c2e746578742e61726d002e41524d2e61747472696275746573002e72656c2e746578742e76340000000000000000000000000000000000000000000000000000000000000000000000000000000000001f0000000100000006000000000000003400000014000000000000000000000002000000000000001b000000090000004000000000000000b4010000200000000a000000010000000400000008000000250000000100000003000000000000004800000000000000000000000000000001000000000000002b0000000800000003000000000000004800000000000000000000000000000001000000000000003400000001000000060000000000000048000000100000000000000000000000040000000000000030000000090000004000000000000000d4010000100000000a0000000500000004000000080000003e000000030000700000000000000000580000001d00000000000000000000000100000000000000520000000100000006000000000000007800000004000000000000000000000004000000000000004e000000090000004000000000000000e4010000080000000a000000080000000400000008000000010000000200000000000000000000007c000000100100000b0000000c0000000400000010000000090000000300000000000000000000008c010000260000000000000000000000010000000000000011000000030000000000000000000000ec0100005b00000000000000000000000100000000000000
ARGS=-e bin.relocs.apply=true
CMDS=<<EOF
p8 8 @ 0x08000048
e asm.bits=32
pi 2 @ 0x08000048
EOF
EXPECT=<<EOF
010000eb000000ea
bl sym.af
b sym.af
EOF
RUN

# arm_be-be8-thumb-movw.o as LE with 0x5 02 -> 01, 0x10 00 -> 01, 0x11 01 -> 00, 0x12 00 -> 28, 0x13 28 -> 00, 0x14 00 -> 01, 0x17 01 -> 00, 0x20 00 -> 48, 0x21 00 -> 02, 0x22 02 -> 00, 0x23 48 -> 00, 0x24 05 -> 00, 0x25 80 -> 00, 0x27 00 -> 05, 0x28 00 -> 34, 0x29 34 -> 00, 0x2e 00 -> 28, 0x2f 28 -> 00, 0x30 00 -> 0d, 0x31 0d -> 00, 0x32 00 -> 0c, 0x33 0c -> 00, 0x59 00 -> 1c, 0x5c 1c -> 00, 0x63 01 -> 00, 0x66 00 -> 01, 0x9a 00 -> 01, 0x9b 01 -> 00, 0xaa 00 -> 03, 0xab 03 -> 00, 0xba 00 -> 04, 0xbb 04 -> 00, 0xca 00 -> 05, 0xcb 05 -> 00, 0xda 00 -> 07, 0xdb 07 -> 00, 0xea 00 -> 08, 0xeb 08 -> 00, 0xec 00 -> 01, 0xef 01 -> 00, 0xfa ff -> f1, 0xfb f1 -> ff, 0xfc 00 -> 0c, 0xff 0c -> 00, 0x10a 00 -> 01, 0x10b 01 -> 00, 0x10c 00 -> 0f, 0x10f 0f -> 00, 0x11a 00 -> 05, 0x11b 05 -> 00, 0x11c 00 -> 12, 0x11f 12 -> 00, 0x12a ff -> f1, 0x12b f1 -> ff, 0x12c 00 -> 0f, 0x12f 0f -> 00, 0x13a 00 -> 08, 0x13b 08 -> 00, 0x13c 00 -> 1f, 0x13f 1f -> 00, 0x140 00 -> 01, 0x143 01 -> 00, 0x14a 00 -> 01, 0x14b 01 -> 00, 0x14c 00 -> 1c, 0x14f 1c -> 00, 0x15a 00 -> 05, 0x15b 05 -> 00, 0x15c 00 -> 1e, 0x15f 1e -> 00, 0x160 00 -> 0c, 0x163 0c -> 00, 0x16a 00 -> 05, 0x16b 05 -> 00, 0x16c 00 -> 21, 0x16f 21 -> 00, 0x17a 00 -> 08, 0x17b 08 -> 00, 0x17c 00 -> 23, 0x17f 23 -> 00, 0x180 00 -> 13, 0x183 13 -> 00, 0x18a 00 -> 01, 0x18b 01 -> 00, 0x1b8 00 -> 2f, 0x1b9 00 -> 0e, 0x1ba 0e -> 00, 0x1bb 2f -> 00, 0x1bc 00 -> 04, 0x1bf 04 -> 00, 0x1c0 00 -> 30, 0x1c1 00 -> 0e, 0x1c2 0e -> 00, 0x1c3 30 -> 00, 0x1c4 00 -> 08, 0x1c7 08 -> 00, 0x1c8 00 -> 33, 0x1c9 00 -> 10, 0x1ca 10 -> 00, 0x1cb 33 -> 00, 0x1cc 00 -> 0c, 0x1cf 0c -> 00, 0x1d0 00 -> 33, 0x1d1 00 -> 0e, 0x1d2 0e -> 00, 0x1d3 33 -> 00, 0x1d8 00 -> 2d, 0x1d9 00 -> 0e, 0x1da 0e -> 00, 0x1db 2b -> 00, 0x1dc 00 -> 04, 0x1df 04 -> 00, 0x1e0 00 -> 2e, 0x1e1 00 -> 0e, 0x1e2 0e -> 00, 0x1e3 2c -> 00, 0x1e8 00 -> 28, 0x1eb 28 -> 00, 0x270 00 -> 1f, 0x273 1f -> 00, 0x274 00 -> 01, 0x277 01 -> 00, 0x278 00 -> 06, 0x27b 06 -> 00, 0x280 00 -> 34, 0x283 34 -> 00, 0x284 00 -> 14, 0x287 14 -> 00, 0x290 00 -> 02, 0x293 02 -> 00, 0x298 00 -> 1b, 0x29b 1b -> 00, 0x29c 00 -> 09, 0x29f 09 -> 00, 0x2a0 00 -> 40, 0x2a3 40 -> 00, 0x2a8 00 -> b4, 0x2a9 00 -> 01, 0x2aa 01 -> 00, 0x2ab b4 -> 00, 0x2ac 00 -> 20, 0x2af 20 -> 00, 0x2b0 00 -> 0a, 0x2b3 0a -> 00, 0x2b4 00 -> 01, 0x2b7 01 -> 00, 0x2b8 00 -> 04, 0x2bb 04 -> 00, 0x2bc 00 -> 08, 0x2bf 08 -> 00, 0x2c0 00 -> 25, 0x2c3 25 -> 00, 0x2c4 00 -> 01, 0x2c7 01 -> 00, 0x2c8 00 -> 03, 0x2cb 03 -> 00, 0x2d0 00 -> 48, 0x2d3 48 -> 00, 0x2e0 00 -> 01, 0x2e3 01 -> 00, 0x2e8 00 -> 2b, 0x2eb 2b -> 00, 0x2ec 00 -> 08, 0x2ef 08 -> 00, 0x2f0 00 -> 03, 0x2f3 03 -> 00, 0x2f8 00 -> 48, 0x2fb 48 -> 00, 0x308 00 -> 01, 0x30b 01 -> 00, 0x310 00 -> 34, 0x313 34 -> 00, 0x314 00 -> 01, 0x317 01 -> 00, 0x318 00 -> 06, 0x31b 06 -> 00, 0x320 00 -> 48, 0x323 48 -> 00, 0x324 00 -> 10, 0x327 10 -> 00, 0x330 00 -> 04, 0x333 04 -> 00, 0x338 00 -> 30, 0x33b 30 -> 00, 0x33c 00 -> 09, 0x33f 09 -> 00, 0x340 00 -> 40, 0x343 40 -> 00, 0x348 00 -> d4, 0x349 00 -> 01, 0x34a 01 -> 00, 0x34b d4 -> 00, 0x34c 00 -> 10, 0x34f 10 -> 00, 0x350 00 -> 0a, 0x353 0a -> 00, 0x354 00 -> 05, 0x357 05 -> 00, 0x358 00 -> 04, 0x35b 04 -> 00, 0x35c 00 -> 08, 0x35f 08 -> 00, 0x360 00 -> 3e, 0x363 3e -> 00, 0x364 70 -> 03, 0x367 03 -> 70, 0x370 00 -> 58, 0x373 58 -> 00, 0x374 00 -> 1d, 0x377 1d -> 00, 0x380 00 -> 01, 0x383 01 -> 00, 0x388 00 -> 52, 0x38b 52 -> 00, 0x38c 00 -> 01, 0x38f 01 -> 00, 0x390 00 -> 06, 0x393 06 -> 00, 0x398 00 -> 78, 0x39b 78 -> 00, 0x39c 00 -> 04, 0x39f 04 -> 00, 0x3a8 00 -> 04, 0x3ab 04 -> 00, 0x3b0 00 -> 4e, 0x3b3 4e -> 00, 0x3b4 00 -> 09, 0x3b7 09 -> 00, 0x3b8 00 -> 40, 0x3bb 40 -> 00, 0x3c0 00 -> e4, 0x3c1 00 -> 01, 0x3c2 01 -> 00, 0x3c3 e4 -> 00, 0x3c4 00 -> 08, 0x3c7 08 -> 00, 0x3c8 00 -> 0a, 0x3cb 0a -> 00, 0x3cc 00 -> 08, 0x3cf 08 -> 00, 0x3d0 00 -> 04, 0x3d3 04 -> 00, 0x3d4 00 -> 08, 0x3d7 08 -> 00, 0x3d8 00 -> 01, 0x3db 01 -> 00, 0x3dc 00 -> 02, 0x3df 02 -> 00, 0x3e8 00 -> 7c, 0x3eb 7c -> 00, 0x3ec 00 -> 10, 0x3ed 00 -> 01, 0x3ee 01 -> 00, 0x3ef 10 -> 00, 0x3f0 00 -> 0b, 0x3f3 0b -> 00, 0x3f4 00 -> 0c, 0x3f7 0c -> 00, 0x3f8 00 -> 04, 0x3fb 04 -> 00, 0x3fc 00 -> 10, 0x3ff 10 -> 00, 0x400 00 -> 09, 0x403 09 -> 00, 0x404 00 -> 03, 0x407 03 -> 00, 0x410 00 -> 8c, 0x411 00 -> 01, 0x412 01 -> 00, 0x413 8c -> 00, 0x414 00 -> 26, 0x417 26 -> 00, 0x420 00 -> 01, 0x423 01 -> 00, 0x428 00 -> 11, 0x42b 11 -> 00, 0x42c 00 -> 03, 0x42f 03 -> 00, 0x438 00 -> ec, 0x439 00 -> 01, 0x43a 01 -> 00, 0x43b ec -> 00, 0x43c 00 -> 5b, 0x43f 5b -> 00, 0x448 00 -> 01, 0x44b 01 -> 00; a hex:// image because its relocations are applied at file load (bin.relocs.apply), which malloc:// + wff + wx does not give
NAME=ARM LE ET_REL: arm movw/movt prel relocs keep little-endian words
FILE=hex://7f454c4601010100000000000000000001002800010000000000000000000000480200000000000534000000000028000d000c0040f20001c0f200013ff4feaf3ff4feaf70477047002000e3002040e31eff2fe11eff2fe1411c000000616561626900000000011205372d4100060a0741080109020000001eff2fe1000000000000000000000000000000000000000000000000000000000300010000000000000000000000000003000300000000000000000000000000030004000000000000000000000000000300050000000000000000000000000003000700000000000000000000000000030008000100000000000000000000000400f1ff0c0000000000000000000000000001000f0000000000000000000000000005001200000000000000000000000400f1ff0f0000000000000000000000000008001f0000000100000000000000120001001c0000000000000000000000120005001e0000000c00000000000000120005002100000000000000000000001200080023000000130000000000000012000100006265382d626533322e6f0024740024610076342d626533322e6f00670061660068007466000000000000002f0e000004000000300e000008000000331000000c000000330e0000000000002d0e0000040000002e0e00000000000028000000002e73796d746162002e737472746162002e7368737472746162002e72656c2e74657874002e64617461002e627373002e72656c2e746578742e61726d002e41524d2e61747472696275746573002e72656c2e746578742e76340000000000000000000000000000000000000000000000000000000000000000000000000000000000001f0000000100000006000000000000003400000014000000000000000000000002000000000000001b000000090000004000000000000000b4010000200000000a000000010000000400000008000000250000000100000003000000000000004800000000000000000000000000000001000000000000002b0000000800000003000000000000004800000000000000000000000000000001000000000000003400000001000000060000000000000048000000100000000000000000000000040000000000000030000000090000004000000000000000d4010000100000000a0000000500000004000000080000003e000000030000700000000000000000580000001d00000000000000000000000100000000000000520000000100000006000000000000007800000004000000000000000000000004000000000000004e000000090000004000000000000000e4010000080000000a000000080000000400000008000000010000000200000000000000000000007c000000100100000b0000000c0000000400000010000000090000000300000000000000000000008c010000260000000000000000000000010000000000000011000000030000000000000000000000ec0100005b00000000000000000000000100000000000000
ARGS=-e bin.relocs.apply=true
CMDS=<<EOF
p8 8 @ 0x08000048
e asm.bits=32
pi 2 @ 0x08000048
EOF
EXPECT=<<EOF
0c2000e3002040e3
movw r2, 0xc
movt r2, 0
EOF
RUN

# arm_be-be8-thumb-movw.o as LE with 0x5 02 -> 01, 0x10 00 -> 01, 0x11 01 -> 00, 0x12 00 -> 28, 0x13 28 -> 00, 0x14 00 -> 01, 0x17 01 -> 00, 0x20 00 -> 48, 0x21 00 -> 02, 0x22 02 -> 00, 0x23 48 -> 00, 0x24 05 -> 00, 0x25 80 -> 00, 0x27 00 -> 05, 0x28 00 -> 34, 0x29 34 -> 00, 0x2e 00 -> 28, 0x2f 28 -> 00, 0x30 00 -> 0d, 0x31 0d -> 00, 0x32 00 -> 0c, 0x33 0c -> 00, 0x3c 3f -> ff, 0x3d f4 -> f7, 0x3f af -> ff, 0x59 00 -> 1c, 0x5c 1c -> 00, 0x63 01 -> 00, 0x66 00 -> 01, 0x9a 00 -> 01, 0x9b 01 -> 00, 0xaa 00 -> 03, 0xab 03 -> 00, 0xba 00 -> 04, 0xbb 04 -> 00, 0xca 00 -> 05, 0xcb 05 -> 00, 0xda 00 -> 07, 0xdb 07 -> 00, 0xea 00 -> 08, 0xeb 08 -> 00, 0xec 00 -> 01, 0xef 01 -> 00, 0xfa ff -> f1, 0xfb f1 -> ff, 0xfc 00 -> 0c, 0xff 0c -> 00, 0x10a 00 -> 01, 0x10b 01 -> 00, 0x10c 00 -> 0f, 0x10f 0f -> 00, 0x11a 00 -> 05, 0x11b 05 -> 00, 0x11c 00 -> 12, 0x11f 12 -> 00, 0x12a ff -> f1, 0x12b f1 -> ff, 0x12c 00 -> 0f, 0x12f 0f -> 00, 0x13a 00 -> 08, 0x13b 08 -> 00, 0x13c 00 -> 1f, 0x13f 1f -> 00, 0x140 00 -> 01, 0x143 01 -> 00, 0x14a 00 -> 01, 0x14b 01 -> 00, 0x14c 00 -> 1c, 0x14f 1c -> 00, 0x15a 00 -> 05, 0x15b 05 -> 00, 0x15c 00 -> 1e, 0x15f 1e -> 00, 0x160 00 -> 0c, 0x163 0c -> 00, 0x16a 00 -> 05, 0x16b 05 -> 00, 0x16c 00 -> 21, 0x16f 21 -> 00, 0x17a 00 -> 08, 0x17b 08 -> 00, 0x17c 00 -> 23, 0x17f 23 -> 00, 0x180 00 -> 13, 0x183 13 -> 00, 0x18a 00 -> 01, 0x18b 01 -> 00, 0x1b8 00 -> 2f, 0x1b9 00 -> 0e, 0x1ba 0e -> 00, 0x1bb 2f -> 00, 0x1bc 00 -> 04, 0x1bf 04 -> 00, 0x1c0 00 -> 30, 0x1c1 00 -> 0e, 0x1c2 0e -> 00, 0x1c3 30 -> 00, 0x1c4 00 -> 08, 0x1c7 08 -> 00, 0x1c8 00 -> 0a, 0x1c9 00 -> 10, 0x1ca 10 -> 00, 0x1cb 33 -> 00, 0x1cc 00 -> 0c, 0x1cf 0c -> 00, 0x1d0 00 -> 33, 0x1d1 00 -> 0e, 0x1d2 0e -> 00, 0x1d3 33 -> 00, 0x1d8 00 -> 2b, 0x1d9 00 -> 0e, 0x1da 0e -> 00, 0x1db 2b -> 00, 0x1dc 00 -> 04, 0x1df 04 -> 00, 0x1e0 00 -> 2c, 0x1e1 00 -> 0e, 0x1e2 0e -> 00, 0x1e3 2c -> 00, 0x1e8 00 -> 28, 0x1eb 28 -> 00, 0x270 00 -> 1f, 0x273 1f -> 00, 0x274 00 -> 01, 0x277 01 -> 00, 0x278 00 -> 06, 0x27b 06 -> 00, 0x280 00 -> 34, 0x283 34 -> 00, 0x284 00 -> 14, 0x287 14 -> 00, 0x290 00 -> 02, 0x293 02 -> 00, 0x298 00 -> 1b, 0x29b 1b -> 00, 0x29c 00 -> 09, 0x29f 09 -> 00, 0x2a0 00 -> 40, 0x2a3 40 -> 00, 0x2a8 00 -> b4, 0x2a9 00 -> 01, 0x2aa 01 -> 00, 0x2ab b4 -> 00, 0x2ac 00 -> 20, 0x2af 20 -> 00, 0x2b0 00 -> 0a, 0x2b3 0a -> 00, 0x2b4 00 -> 01, 0x2b7 01 -> 00, 0x2b8 00 -> 04, 0x2bb 04 -> 00, 0x2bc 00 -> 08, 0x2bf 08 -> 00, 0x2c0 00 -> 25, 0x2c3 25 -> 00, 0x2c4 00 -> 01, 0x2c7 01 -> 00, 0x2c8 00 -> 03, 0x2cb 03 -> 00, 0x2d0 00 -> 48, 0x2d3 48 -> 00, 0x2e0 00 -> 01, 0x2e3 01 -> 00, 0x2e8 00 -> 2b, 0x2eb 2b -> 00, 0x2ec 00 -> 08, 0x2ef 08 -> 00, 0x2f0 00 -> 03, 0x2f3 03 -> 00, 0x2f8 00 -> 48, 0x2fb 48 -> 00, 0x308 00 -> 01, 0x30b 01 -> 00, 0x310 00 -> 34, 0x313 34 -> 00, 0x314 00 -> 01, 0x317 01 -> 00, 0x318 00 -> 06, 0x31b 06 -> 00, 0x320 00 -> 48, 0x323 48 -> 00, 0x324 00 -> 10, 0x327 10 -> 00, 0x330 00 -> 04, 0x333 04 -> 00, 0x338 00 -> 30, 0x33b 30 -> 00, 0x33c 00 -> 09, 0x33f 09 -> 00, 0x340 00 -> 40, 0x343 40 -> 00, 0x348 00 -> d4, 0x349 00 -> 01, 0x34a 01 -> 00, 0x34b d4 -> 00, 0x34c 00 -> 10, 0x34f 10 -> 00, 0x350 00 -> 0a, 0x353 0a -> 00, 0x354 00 -> 05, 0x357 05 -> 00, 0x358 00 -> 04, 0x35b 04 -> 00, 0x35c 00 -> 08, 0x35f 08 -> 00, 0x360 00 -> 3e, 0x363 3e -> 00, 0x364 70 -> 03, 0x367 03 -> 70, 0x370 00 -> 58, 0x373 58 -> 00, 0x374 00 -> 1d, 0x377 1d -> 00, 0x380 00 -> 01, 0x383 01 -> 00, 0x388 00 -> 52, 0x38b 52 -> 00, 0x38c 00 -> 01, 0x38f 01 -> 00, 0x390 00 -> 06, 0x393 06 -> 00, 0x398 00 -> 78, 0x39b 78 -> 00, 0x39c 00 -> 04, 0x39f 04 -> 00, 0x3a8 00 -> 04, 0x3ab 04 -> 00, 0x3b0 00 -> 4e, 0x3b3 4e -> 00, 0x3b4 00 -> 09, 0x3b7 09 -> 00, 0x3b8 00 -> 40, 0x3bb 40 -> 00, 0x3c0 00 -> e4, 0x3c1 00 -> 01, 0x3c2 01 -> 00, 0x3c3 e4 -> 00, 0x3c4 00 -> 08, 0x3c7 08 -> 00, 0x3c8 00 -> 0a, 0x3cb 0a -> 00, 0x3cc 00 -> 08, 0x3cf 08 -> 00, 0x3d0 00 -> 04, 0x3d3 04 -> 00, 0x3d4 00 -> 08, 0x3d7 08 -> 00, 0x3d8 00 -> 01, 0x3db 01 -> 00, 0x3dc 00 -> 02, 0x3df 02 -> 00, 0x3e8 00 -> 7c, 0x3eb 7c -> 00, 0x3ec 00 -> 10, 0x3ed 00 -> 01, 0x3ee 01 -> 00, 0x3ef 10 -> 00, 0x3f0 00 -> 0b, 0x3f3 0b -> 00, 0x3f4 00 -> 0c, 0x3f7 0c -> 00, 0x3f8 00 -> 04, 0x3fb 04 -> 00, 0x3fc 00 -> 10, 0x3ff 10 -> 00, 0x400 00 -> 09, 0x403 09 -> 00, 0x404 00 -> 03, 0x407 03 -> 00, 0x410 00 -> 8c, 0x411 00 -> 01, 0x412 01 -> 00, 0x413 8c -> 00, 0x414 00 -> 26, 0x417 26 -> 00, 0x420 00 -> 01, 0x423 01 -> 00, 0x428 00 -> 11, 0x42b 11 -> 00, 0x42c 00 -> 03, 0x42f 03 -> 00, 0x438 00 -> ec, 0x439 00 -> 01, 0x43a 01 -> 00, 0x43b ec -> 00, 0x43c 00 -> 5b, 0x43f 5b -> 00, 0x448 00 -> 01, 0x44b 01 -> 00; a hex:// image because its relocations are applied at file load (bin.relocs.apply), which malloc:// + wff + wx does not give
NAME=ARM LE ET_REL: thumb pc22 reloc keeps little-endian halfwords
FILE=hex://7f454c4601010100000000000000000001002800010000000000000000000000480200000000000534000000000028000d000c0040f20001c0f20001fff7feff3ff4feaf70477047002000e3002040e31eff2fe11eff2fe1411c000000616561626900000000011205372d4100060a0741080109020000001eff2fe1000000000000000000000000000000000000000000000000000000000300010000000000000000000000000003000300000000000000000000000000030004000000000000000000000000000300050000000000000000000000000003000700000000000000000000000000030008000100000000000000000000000400f1ff0c0000000000000000000000000001000f0000000000000000000000000005001200000000000000000000000400f1ff0f0000000000000000000000000008001f0000000100000000000000120001001c0000000000000000000000120005001e0000000c00000000000000120005002100000000000000000000001200080023000000130000000000000012000100006265382d626533322e6f0024740024610076342d626533322e6f00670061660068007466000000000000002f0e000004000000300e0000080000000a1000000c000000330e0000000000002b0e0000040000002c0e00000000000028000000002e73796d746162002e737472746162002e7368737472746162002e72656c2e74657874002e64617461002e627373002e72656c2e746578742e61726d002e41524d2e61747472696275746573002e72656c2e746578742e76340000000000000000000000000000000000000000000000000000000000000000000000000000000000001f0000000100000006000000000000003400000014000000000000000000000002000000000000001b000000090000004000000000000000b4010000200000000a000000010000000400000008000000250000000100000003000000000000004800000000000000000000000000000001000000000000002b0000000800000003000000000000004800000000000000000000000000000001000000000000003400000001000000060000000000000048000000100000000000000000000000040000000000000030000000090000004000000000000000d4010000100000000a0000000500000004000000080000003e000000030000700000000000000000580000001d00000000000000000000000100000000000000520000000100000006000000000000007800000004000000000000000000000004000000000000004e000000090000004000000000000000e4010000080000000a000000080000000400000008000000010000000200000000000000000000007c000000100100000b0000000c0000000400000010000000090000000300000000000000000000008c010000260000000000000000000000010000000000000011000000030000000000000000000000ec0100005b00000000000000000000000100000000000000
ARGS=-e bin.relocs.apply=true
CMDS=<<EOF
p8 4 @ 0x0800003c
pi 1 @ 0x0800003c
EOF
EXPECT=<<EOF
00f003f8
bl sym.tf
EOF
RUN
