NAME=ELF: arm64 relocs crashing
FILE=-
CMDS=!!rz-bin -qzz bins/elf/librsjni_androix.so~?
EXPECT=<<EOF
548
EOF
RUN

NAME=ELF: arm64 relocs crashing
FILE=bins/elf/librsjni_androix.so
CMDS=ir
EXPECT=<<EOF
[Relocations]

vaddr      paddr      type   name
---------------------------------
0x0000e210 0x0000e210 SET_64 __cxa_finalize
0x0000e218 0x0000e218 SET_64 __stack_chk_fail
0x0000e220 0x0000e220 SET_64 dlopen
0x0000e228 0x0000e228 SET_64 loadSymbols(void*, dispatchTable&, int)
0x0000e230 0x0000e230 SET_64 dlerror
0x0000e238 0x0000e238 SET_64 __android_log_print
0x0000e240 0x0000e240 SET_64 dlclose
0x0000e248 0x0000e248 SET_64 loadIOSuppSyms(void*, ioSuppDT&)
0x0000e250 0x0000e250 SET_64 malloc
0x0000e258 0x0000e258 SET_64 calloc
0x0000e260 0x0000e260 SET_64 free
0x0000e268 0x0000e268 SET_64 AndroidBitmap_lockPixels
0x0000e270 0x0000e270 SET_64 AndroidBitmap_getInfo
0x0000e278 0x0000e278 SET_64 AndroidBitmap_unlockPixels
0x0000e280 0x0000e280 SET_64 memcpy
0x0000e288 0x0000e288 SET_64 memset
0x0000e290 0x0000e290 SET_64 dlsym


17 relocations
EOF
RUN

NAME=ELF: arm64 imports crashing
FILE=bins/elf/librsjni_androix.so
CMDS=ii
EXPECT=<<EOF
[Imports]
nth vaddr      bind   type lib name
-----------------------------------
1   0x0000b7c0 GLOBAL FUNC     __cxa_finalize
2   0x0000b880 GLOBAL FUNC     AndroidBitmap_getInfo
3   0x0000b870 GLOBAL FUNC     AndroidBitmap_lockPixels
4   0x0000b890 GLOBAL FUNC     AndroidBitmap_unlockPixels
5   0x0000b810 GLOBAL FUNC     __android_log_print
6   0x0000b7d0 GLOBAL FUNC     __stack_chk_fail
7   0x0000b850 GLOBAL FUNC     calloc
8   0x0000b820 GLOBAL FUNC     dlclose
9   0x0000b800 GLOBAL FUNC     dlerror
10  0x0000b7e0 GLOBAL FUNC     dlopen
11  0x0000b8c0 GLOBAL FUNC     dlsym
12  0x0000b860 GLOBAL FUNC     free
13  0x0000b840 GLOBAL FUNC     malloc
14  0x0000b8a0 GLOBAL FUNC     memcpy
15  0x0000b8b0 GLOBAL FUNC     memset

EOF
RUN

NAME=ELF: corkami elf-relro - sections
FILE=bins/elf/analysis/elf-relro
CMDS=iS~rel
EXPECT=<<EOF
9   0x0000027c    0x8 0x0804827c    0x8 -r-- .rel.dyn
10  0x00000284   0x10 0x08048284   0x10 -r-- .rel.plt
EOF
RUN

NAME=ELF: corkami elf-relro - relro enabled
FILE=bins/elf/analysis/elf-relro
CMDS=ik ***~relro
EXPECT=<<EOF
info/elf.relro=partial
EOF
RUN

NAME=ELF: imports partial
FILE=bins/elf/vim
CMDS=<<EOF
ik ***~relro
ii
EOF
EXPECT=<<EOF
info/elf.relro=full
[Imports]
nth vaddr      bind   type   lib name
-------------------------------------
2   0x00051f60 GLOBAL FUNC       __ctype_toupper_loc
3   0x00051f68 GLOBAL FUNC       __strcat_chk
4   0x00051f70 GLOBAL FUNC       getenv
5   0x00051f78 GLOBAL FUNC       utime
6   0x00051f80 GLOBAL FUNC       sigprocmask
7   0x00051f88 GLOBAL FUNC       free
8   0x00051f90 GLOBAL FUNC       putchar
9   0x00051f98 GLOBAL FUNC       is_selinux_enabled
10  0x00051fa0 GLOBAL FUNC       strcasecmp
11  0x00051fa8 GLOBAL FUNC       Gpm_Open
12  0x00051fb0 GLOBAL FUNC       localtime
13  0x00051fb8 GLOBAL FUNC       mblen
14  0x00051fc0 GLOBAL FUNC       __errno_location
15  0x00051fc8 GLOBAL FUNC       unlink
16  0x00051fd0 GLOBAL FUNC       strncpy
17  0x00051fd8 GLOBAL FUNC       strncmp
18  0x00000000 WEAK   NOTYPE     _ITM_deregisterTMCloneTable
19  0x00051fe0 GLOBAL FUNC       _exit
20  0x00051fe8 GLOBAL FUNC       strcpy
21  0x00051ff0 GLOBAL FUNC       mkdir
22  0x00051ff8 GLOBAL FUNC       tputs
23  0x00052000 GLOBAL FUNC       iconv
24  0x00052008 GLOBAL FUNC       ferror
25  0x00052010 GLOBAL FUNC       qsort
26  0x00052018 GLOBAL FUNC       isatty
27  0x00052020 GLOBAL FUNC       sigaction
28  0x00052028 GLOBAL FUNC       fread
29  0x00052030 GLOBAL FUNC       strtod
30  0x00052038 GLOBAL FUNC       exp
31  0x00052040 GLOBAL FUNC       readlink
32  0x00052048 GLOBAL FUNC       fcntl
33  0x00052050 GLOBAL FUNC       setenv
34  0x00052058 GLOBAL FUNC       write
35  0x00052060 GLOBAL FUNC       getpid
36  0x00052068 GLOBAL FUNC       textdomain
37  0x00052070 GLOBAL FUNC       atan
38  0x00052078 GLOBAL FUNC       tgoto
39  0x00052080 GLOBAL FUNC       fclose
40  0x00052088 GLOBAL FUNC       __xstat64
41  0x00052090 GLOBAL FUNC       opendir
42  0x00052098 GLOBAL FUNC       getpwuid
43  0x000520a0 GLOBAL FUNC       ctime
44  0x000520a8 GLOBAL FUNC       bindtextdomain
45  0x000520b0 GLOBAL FUNC       stpcpy
46  0x000520b8 GLOBAL FUNC       rmdir
47  0x000520c0 GLOBAL FUNC       dcgettext
48  0x000520c8 GLOBAL FUNC       strlen
49  0x000520d0 GLOBAL FUNC       chdir
50  0x000520d8 GLOBAL FUNC       __stack_chk_fail
51  0x000520e0 GLOBAL FUNC       getuid
52  0x000520e8 GLOBAL FUNC       dup2
53  0x000520f0 GLOBAL FUNC       tcflush
54  0x000520f8 GLOBAL FUNC       strchr
55  0x00052100 GLOBAL FUNC       printf
56  0x00052108 GLOBAL FUNC       rewind
57  0x00052110 GLOBAL FUNC       _IO_putc
58  0x00052118 GLOBAL FUNC       __fdelt_chk
59  0x00052120 GLOBAL FUNC       nanosleep
60  0x00052128 GLOBAL FUNC       strrchr
61  0x00052130 GLOBAL FUNC       uname
62  0x00052138 GLOBAL FUNC       dup
63  0x00052140 GLOBAL FUNC       gettimeofday
64  0x00052148 GLOBAL FUNC       __assert_fail
65  0x00052150 GLOBAL FUNC       fputs
66  0x00052158 GLOBAL FUNC       memset
67  0x00052160 GLOBAL FUNC       tgetflag
68  0x00052168 GLOBAL FUNC       pow
69  0x00052170 GLOBAL FUNC       ioctl
70  0x00052178 GLOBAL FUNC       getcwd
71  0x00052180 GLOBAL FUNC       log
72  0x00052188 GLOBAL FUNC       strncat
73  0x00052190 GLOBAL FUNC       alarm
74  0x00052198 GLOBAL FUNC       close
75  0x000521a0 GLOBAL FUNC       tgetent
76  0x000521a8 GLOBAL FUNC       pipe
77  0x000521b0 GLOBAL FUNC       setsid
78  0x000521b8 GLOBAL FUNC       fmod
79  0x000521c0 GLOBAL FUNC       closedir
80  0x000521c8 GLOBAL FUNC       cos
81  0x000521d0 GLOBAL FUNC       fputc
82  0x000521d8 GLOBAL FUNC       memchr
83  0x000521e0 GLOBAL FUNC       ftello64
84  0x000521e8 GLOBAL FUNC       acos
85  0x000521f0 GLOBAL FUNC       read
86  0x00000000 GLOBAL FUNC       __libc_start_main
87  0x000521f8 GLOBAL FUNC       srand
88  0x00052200 GLOBAL FUNC       memcmp
89  0x00052208 GLOBAL FUNC       fgets
90  0x00052210 GLOBAL FUNC       tgetnum
91  0x00052218 GLOBAL FUNC       getsockopt
92  0x00052220 GLOBAL FUNC       _setjmp
93  0x00052228 GLOBAL FUNC       acl_set_file
94  0x00052230 GLOBAL FUNC       __fxstat64
95  0x00052238 GLOBAL FUNC       strcmp
96  0x00052240 GLOBAL FUNC       signal
97  0x00052248 GLOBAL FUNC       getpwnam
98  0x00052250 GLOBAL FUNC       gethostbyname
99  0x00052258 GLOBAL FUNC       log10
100 0x00052260 GLOBAL FUNC       __memmove_chk
101 0x00052268 GLOBAL FUNC       setpwent
102 0x00052270 GLOBAL FUNC       __memcpy_chk
103 0x00052278 GLOBAL FUNC       fprintf
104 0x00052280 GLOBAL FUNC       sigemptyset
105 0x00052288 GLOBAL FUNC       ftell
106 0x00052290 GLOBAL FUNC       feof
107 0x00000000 WEAK   NOTYPE     __gmon_start__
108 0x00052298 GLOBAL FUNC       umask
109 0x000522a0 GLOBAL FUNC       fopen64
110 0x000522a8 GLOBAL FUNC       strtol
111 0x000522b0 GLOBAL FUNC       memcpy
112 0x000522b8 GLOBAL FUNC       getfilecon
113 0x000522c0 GLOBAL FUNC       getpwent
114 0x000522c8 GLOBAL FUNC       cosh
115 0x000522d0 GLOBAL FUNC       kill
116 0x000522d8 GLOBAL FUNC       time
117 0x000522e0 GLOBAL FUNC       fileno
118 0x000522e8 GLOBAL FUNC       __stpcpy_chk
119 0x000522f0 GLOBAL FUNC       getgid
120 0x000522f8 GLOBAL FUNC       iswupper
121 0x00052300 GLOBAL FUNC       select
122 0x00052308 GLOBAL FUNC       getrlimit64
123 0x00052310 GLOBAL FUNC       dlopen
124 0x00052318 GLOBAL FUNC       sync
125 0x00052320 GLOBAL FUNC       sinh
126 0x00052328 GLOBAL FUNC       pthread_getspecific
127 0x00052330 GLOBAL FUNC       malloc
128 0x00052338 GLOBAL FUNC       strncasecmp
129 0x00052340 GLOBAL FUNC       fflush
130 0x00052348 GLOBAL FUNC       _IO_getc
131 0x00052350 GLOBAL FUNC       acl_get_file
132 0x00052358 GLOBAL FUNC       nl_langinfo
133 0x00052360 GLOBAL FUNC       tan
134 0x00052368 GLOBAL FUNC       ungetc
135 0x00052370 GLOBAL FUNC       endpwent
136 0x00052378 GLOBAL FUNC       sscanf
137 0x00052380 GLOBAL FUNC       atan2
138 0x00052388 GLOBAL FUNC       strpbrk
139 0x00052390 GLOBAL FUNC       fseek
140 0x00052398 GLOBAL FUNC       fseeko64
141 0x000523a0 GLOBAL FUNC       bind_textdomain_codeset
142 0x000523a8 GLOBAL FUNC       fchdir
143 0x000523b0 GLOBAL FUNC       dlclose
144 0x000523b8 GLOBAL FUNC       setfilecon
145 0x000523c0 GLOBAL FUNC       realloc
146 0x000523c8 GLOBAL FUNC       __strcpy_chk
147 0x000523d0 GLOBAL FUNC       fdopen
148 0x000523d8 GLOBAL FUNC       mkdtemp
149 0x000523e0 GLOBAL FUNC       setlocale
150 0x000523e8 GLOBAL FUNC       iconv_close
151 0x000523f0 GLOBAL FUNC       chmod
152 0x000523f8 GLOBAL FUNC       sigset
153 0x00052400 GLOBAL FUNC       __longjmp_chk
154 0x00052408 GLOBAL FUNC       open64
155 0x00052410 GLOBAL FUNC       strftime
156 0x00052418 GLOBAL FUNC       memmove
157 0x00052420 GLOBAL FUNC       readdir64
158 0x00052428 GLOBAL FUNC       fsync
159 0x00052430 GLOBAL FUNC       Gpm_GetEvent
160 0x00052438 GLOBAL FUNC       waitpid
161 0x00052440 GLOBAL FUNC       tcgetattr
162 0x00052448 GLOBAL FUNC       tcsetattr
163 0x00052450 GLOBAL FUNC       access
164 0x00052458 GLOBAL FUNC       fchown
165 0x00052460 GLOBAL FUNC       dcngettext
166 0x00052468 GLOBAL FUNC       perror
167 0x00052470 GLOBAL FUNC       strtok
168 0x00052478 GLOBAL FUNC       sysconf
169 0x00000000 WEAK   NOTYPE     _Jv_RegisterClasses
170 0x00052480 GLOBAL FUNC       towlower
171 0x00052488 GLOBAL FUNC       rename
172 0x00052490 GLOBAL FUNC       tgetstr
173 0x00052498 GLOBAL FUNC       towupper
174 0x000524a0 GLOBAL FUNC       sin
175 0x000524a8 GLOBAL FUNC       floor
176 0x000524b0 GLOBAL FUNC       execvp
177 0x000524b8 GLOBAL FUNC       getpgid
178 0x000524c0 GLOBAL FUNC       __lxstat64
179 0x000524c8 GLOBAL FUNC       sysinfo
180 0x000524d0 GLOBAL FUNC       strcat
181 0x000524d8 GLOBAL FUNC       freecon
182 0x000524e0 GLOBAL FUNC       tanh
183 0x000524e8 GLOBAL FUNC       asin
184 0x000524f0 GLOBAL FUNC       __memset_chk
185 0x000524f8 GLOBAL FUNC       sprintf
186 0x00052500 GLOBAL FUNC       exit
187 0x00052508 GLOBAL FUNC       connect
188 0x00052510 GLOBAL FUNC       fwrite
189 0x00052518 GLOBAL FUNC       lseek64
190 0x00052520 GLOBAL FUNC       __fprintf_chk
191 0x00000000 WEAK   NOTYPE     _ITM_registerTMCloneTable
192 0x00052528 GLOBAL FUNC       sqrt
193 0x00052530 GLOBAL FUNC       sigaltstack
194 0x00052538 GLOBAL FUNC       strerror
195 0x00052540 GLOBAL FUNC       execl
196 0x00052548 GLOBAL FUNC       dlsym
197 0x00052550 GLOBAL FUNC       ceil
198 0x00052558 GLOBAL FUNC       sleep
199 0x00052560 GLOBAL FUNC       Gpm_Close
200 0x00052568 WEAK   FUNC       __cxa_finalize
201 0x00052570 GLOBAL FUNC       sigaddset
202 0x00052578 GLOBAL FUNC       fork
203 0x00052580 GLOBAL FUNC       strstr
204 0x00052588 GLOBAL FUNC       rand
205 0x00052590 GLOBAL FUNC       dlerror
206 0x00052598 GLOBAL FUNC       __ctype_tolower_loc
207 0x000525a0 GLOBAL FUNC       __ctype_b_loc
208 0x000525a8 GLOBAL FUNC       acl_free
209 0x000525b0 GLOBAL FUNC       iconv_open
210 0x000525b8 GLOBAL FUNC       __sprintf_chk
211 0x000525c0 GLOBAL FUNC       socket

EOF
RUN
