NAME=uncached err
FILE=bins/rel/d_profileNP.rel
ARGS=-e bin.relocs.apply=false
CMDS=
EXPECT_ERR=<<EOF
INFO: REL module ID 00000001
INFO: REL version 3
WARN: Relocs has not been applied. Please use `-e bin.relocs.apply=true` or `-e bin.cache=true` next time
EOF
RUN

NAME=sections
FILE=bins/rel/d_profileNP.rel
ARGS=-e bin.relocs.apply=true -B 0x80500000
CMDS=iS
EXPECT=<<EOF
nth paddr       size vaddr       vsize perm flags type name
-----------------------------------------------------------
0   0x000000d0  0xa0 0x805000d0   0xa0 -rwx 0x0   ---- text_1
1   0x00000170   0x4 0x80500170    0x4 -rw- 0x0   ---- data_2
2   0x00000174   0x4 0x80500174    0x4 -rw- 0x0   ---- data_3
3   0x00000178  0x34 0x80500178   0x34 -rw- 0x0   ---- data_4
4   0x00000000   0x4 0x80500380    0x4 -rw- 0x0   ---- bss
EOF
RUN

NAME=dump relocs
FILE=bins/rel/d_profileNP.rel
ARGS=-e bin.relocs.apply=true -B 0x80500000 -e log.level=5
CMDS=
EXPECT_ERR=<<EOF
DEBUG: RCoreCmd: =!
INFO: REL module ID 00000001
INFO: REL version 3
DEBUG: imp 0: 2 relocs
DEBUG: imp 1: 2 relocs
DEBUG: imp 2: 2 relocs
DEBUG: imp 3: 2 relocs
DEBUG: imp 4: 2 relocs
DEBUG: imp 5: 2 relocs
DEBUG: imp 6: 7 relocs
DEBUG: imp 7: 16 relocs
DEBUG: bin object have no information
ERROR: Imports from other REL (00000002) not yet implemented
ERROR: Imports from other REL (00000003) not yet implemented
ERROR: Imports from other REL (00000004) not yet implemented
ERROR: Imports from other REL (00000005) not yet implemented
ERROR: Imports from other REL (00000006) not yet implemented
ERROR: Imports from other REL (00000007) not yet implemented
DEBUG: SLOW: cloning symbols list into a vec
DEBUG: RCoreCmd: =!
DEBUG: RCoreCmd: ieq
EOF
RUN

NAME=R_PPC_ADDR16
FILE=bins/rel/d_profileNP.rel
ARGS=-e bin.relocs.apply=true -B 0x80500000
CMDS=pd 3 @0x80500144
EXPECT=<<EOF
            0x80500144      3c608024       lis r3, -0x7fdc             ; RELOC 16 
            0x80500148      38840178       addi r4, r4, 0x178          ; RELOC 16 
            0x8050014c      9083ae10       stw r4, -0x51f0(r3)         ; RELOC 16 
EOF
RUN

NAME=R_PPC_REL24
FILE=bins/rel/d_profileNP.rel
ARGS=-e bin.relocs.apply=true -B 0x80500000
CMDS=pd 1 @0x805000e4
EXPECT=<<EOF
            0x805000e4      4bb1acbd       bl 0x8001ada0               ; RELOC 32 
EOF
RUN

NAME=R_PPC_ADDR32
FILE=bins/rel/d_profileNP.rel
ARGS=-e bin.relocs.apply=true -B 0x80500000
CMDS=pxW 16 @0x80500180
EXPECT=<<EOF
0x80500180 0x8023a588
0x80500184 0x8023a590
0x80500188 0x8023a598
0x8050018c 0x8023a5b0
EOF
RUN
