Skip to content

Commit

Permalink
Add more tests of calls through Procedure Linkage Table (PLT)
Browse files Browse the repository at this point in the history
These test binaries contain endbr32 and endbr64 instructions,
so this PR should be committed after RetDec has moved
to Capstone 4.0.2 (avast/retdec#1086).
  • Loading branch information
richardlford committed Jul 17, 2022
1 parent cb21b64 commit de1572b
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 0 deletions.
4 changes: 4 additions & 0 deletions features/plt/rand/call-rand.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#include <stdlib.h>
int main(int argc, char ** argv) {
return rand();
}
Binary file added features/plt/rand/call-rand.x64.clang.opt0.exe
Binary file not shown.
Binary file added features/plt/rand/call-rand.x64.clang.opt2.exe
Binary file not shown.
Binary file added features/plt/rand/call-rand.x64.gcc.opt0.exe
Binary file not shown.
Binary file added features/plt/rand/call-rand.x64.gcc.opt2.exe
Binary file not shown.
Binary file added features/plt/rand/call-rand.x86.clang.opt0.exe
Binary file not shown.
Binary file added features/plt/rand/call-rand.x86.clang.opt2.exe
Binary file not shown.
Binary file added features/plt/rand/call-rand.x86.gcc.opt0.exe
Binary file not shown.
Binary file added features/plt/rand/call-rand.x86.gcc.opt2.exe
Binary file not shown.
19 changes: 19 additions & 0 deletions features/plt/rand/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from regression_tests import *

class CommonTest(Test):
"""Output of these tests is nearly the same."""
settings = TestSettings(
input=[
'call-rand.x64.clang.opt0.exe',
'call-rand.x64.clang.opt2.exe',
'call-rand.x64.gcc.opt0.exe',
'call-rand.x64.gcc.opt2.exe',
'call-rand.x86.clang.opt0.exe',
'call-rand.x86.clang.opt2.exe',
'call-rand.x86.gcc.opt0.exe',
'call-rand.x86.gcc.opt2.exe'
])

def test_main_calls_rand(self):
main = self.out_c.funcs['main']
assert main.calls('rand')

0 comments on commit de1572b

Please sign in to comment.