# merged: sBPF: Verify relocations are present; sBPF: imports resolve to their own first reloc site via the section pass
NAME=sBPF: Segments with custom base address 0x10000000
FILE=bins/elf/sbpf_example.so
ARGS=-B 0x10000000
CMDS=<<EOF
iSS
?e --
ir | head -10
?e --
ii
EOF
EXPECT=<<EOF
nth paddr          size vaddr         vsize perm flags type name
----------------------------------------------------------------
0   0x00000120  0x29818 0x10000120  0x29818 -r-x 0x0   MAP  LOAD0
1   0x00029938   0x4f48 0x10029938   0x4f48 -rw- 0x0   MAP  LOAD1
2   0x0002e930   0x44a8 0x1002e930   0x44a8 -r-- 0x0   MAP  LOAD2
3   0x0002e880     0xb0 0x1002e880     0xb0 -rw- 0x0   MAP  DYNAMIC
4   0x00000000     0x40 0x10000000     0x40 -rw- 0x0   MAP  ehdr
--
vaddr      paddr      type   ntype name
---------------------------------------
0x100003d0 0x000003d0 SET_64 8
0x10000408 0x00000408 SET_64 8
0x10000460 0x00000460 SET_64 8
0x10000620 0x00000620 SET_64 8
0x10000800 0x00000800 SET_64 8
0x10000838 0x00000838 SET_64 8
0x10000890 0x00000890 SET_64 8
0x10000cd8 0x00000cd8 SET_64 8
--
nth vaddr      bind   type   lib name
-------------------------------------
3   0x10002888 GLOBAL NOTYPE     abort
4   0x10004ca8 GLOBAL NOTYPE     sol_log_
5   0x10012b48 GLOBAL NOTYPE     sol_memcpy_
6   0x10017288 GLOBAL NOTYPE     sol_get_rent_sysvar
7   0x10018968 GLOBAL NOTYPE     sol_invoke_signed_rust
8   0x10018f88 GLOBAL NOTYPE     sol_memset_
9   0x1001db30 GLOBAL NOTYPE     sol_try_find_program_address
10  0x1001dbf8 GLOBAL NOTYPE     sol_log_pubkey
11  0x10020158 GLOBAL NOTYPE     sol_sha256
12  0x10028ba0 GLOBAL NOTYPE     sol_memcmp_
EOF
RUN

NAME=sBPF: v1 imports resolve to their own first reloc site via the section pass
FILE=bins/elf/sbpf_example_v1.so
ARGS=-B 0x10000000
CMDS=<<EOF
ii
EOF
EXPECT=<<EOF
nth vaddr      bind   type   lib name
-------------------------------------
3   0x10002918 GLOBAL NOTYPE     abort
4   0x10004d10 GLOBAL NOTYPE     sol_log_
5   0x10012d68 GLOBAL NOTYPE     sol_memcpy_
6   0x10017508 GLOBAL NOTYPE     sol_get_rent_sysvar
7   0x10018c30 GLOBAL NOTYPE     sol_invoke_signed_rust
8   0x10019268 GLOBAL NOTYPE     sol_memset_
9   0x1001de98 GLOBAL NOTYPE     sol_try_find_program_address
10  0x1001df68 GLOBAL NOTYPE     sol_log_pubkey
11  0x100204e0 GLOBAL NOTYPE     sol_sha256
12  0x10029178 GLOBAL NOTYPE     sol_memcmp_
EOF
RUN

NAME=sBPF: v2 imports resolve to their own first reloc site via the section pass
FILE=bins/elf/sbpf_example_v2.so
ARGS=-B 0x10000000
CMDS=<<EOF
ii
EOF
EXPECT=<<EOF
nth vaddr      bind   type   lib name
-------------------------------------
3   0x100028c0 GLOBAL NOTYPE     abort
4   0x10004c58 GLOBAL NOTYPE     sol_log_
5   0x10012f10 GLOBAL NOTYPE     sol_memcpy_
6   0x100176f0 GLOBAL NOTYPE     sol_get_rent_sysvar
7   0x10018dd8 GLOBAL NOTYPE     sol_invoke_signed_rust
8   0x10019418 GLOBAL NOTYPE     sol_memset_
9   0x1001e008 GLOBAL NOTYPE     sol_try_find_program_address
10  0x1001e0d8 GLOBAL NOTYPE     sol_log_pubkey
11  0x10020580 GLOBAL NOTYPE     sol_sha256
12  0x10029130 GLOBAL NOTYPE     sol_memcmp_
EOF
RUN
