Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gtirb to ir #161

Merged
merged 87 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from 86 commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
d4a9b24
Ported from gtirb directory, takes .gts file and spits out parse tree
Megatomato Jul 6, 2023
bd3b4fa
Created decoder for functionEntry in auxdata
Megatomato Jul 10, 2023
57baa51
Created visitor, about 95% finished, some bugs with memory.
Megatomato Jul 19, 2023
4eaa489
Merge remote-tracking branch 'origin' into walter-gtirb-to-ir
Megatomato Jul 19, 2023
1d196b5
Updated gtirb to IR to properly reflect jumps
Megatomato Jul 20, 2023
4fec863
Fixes Memory bugs, fiddles with proxyblocks
Megatomato Jul 20, 2023
c334112
Renamed grammar so not confusing, attempted to fix decoder but failed :(
Megatomato Jul 20, 2023
9e0fa5f
Merge branch 'main' into walter-gtirb-to-ir
Megatomato Nov 26, 2023
8e3f49e
Merge
Megatomato Nov 26, 2023
7631f95
code now works with changea made in main
Megatomato Nov 27, 2023
29dafa1
Parser creates IR, bugs in bitvectors
Megatomato Nov 30, 2023
26352da
Now prints an IR
Megatomato Dec 1, 2023
2cd1ee5
new semantics because gtirb is weird
Megatomato Dec 5, 2023
71fe88f
Changed .gts, added new decoder and function names
Megatomato Dec 7, 2023
4fc32ac
Centralised Decoders and Arguments so not bad
Megatomato Dec 7, 2023
c62cfb4
Added addresses and changed jump logic
Megatomato Dec 11, 2023
2249838
fixed function names w/ proxies
Megatomato Dec 12, 2023
91fb9b5
Updated Jump logic(again)
Megatomato Dec 13, 2023
a82e3bc
Merge remote-tracking branch 'origin' into walter-gtirb-to-ir
Megatomato Dec 13, 2023
6184518
Fixed jump logic for real and some mem issue
Megatomato Dec 18, 2023
931dd33
updated .adt so compiler issues no longer a thing
Megatomato Dec 19, 2023
d5fde22
Fixed block order + removed "_PC" calls
Megatomato Dec 19, 2023
336a638
Fixed SignExtend, ZeroExtend and Extract
Megatomato Dec 20, 2023
42e620b
Remodeled Jumps based on Gtirb labeling
Megatomato Dec 21, 2023
67110ae
Now adds extra blocks and correctly parses conditional statements
Megatomato Dec 21, 2023
e4da775
Attempted to fix mainproc and fixed ashr ZeroExtent
Megatomato Jan 3, 2024
059d60d
Created example that produces multi-else if statement
Megatomato Jan 3, 2024
ba3beac
Can now parse If-chain statements
Megatomato Jan 4, 2024
f3c1eed
now does longifs, with some small errors
Megatomato Jan 10, 2024
51915a4
Merge remote-tracking branch 'origin' into walter-gtirb-to-ir
Megatomato Jan 10, 2024
7d4a3d4
Fixed bugs with longIfs and fixed uncessesary procedure creation
Megatomato Jan 10, 2024
bfbf72f
Made var and cse names unique throughout ir
Megatomato Jan 11, 2024
63a97e4
Generates boogie file!
Megatomato Jan 12, 2024
50b9323
fixed InitialMem
Megatomato Jan 12, 2024
4f5523f
small fix to bug in jump logic
Megatomato Jan 15, 2024
ec9cfbd
Merge remote-tracking branch 'origin' into walter-gtirb-to-ir
Megatomato Jan 15, 2024
6064734
small fixes
Megatomato Jan 16, 2024
2edd934
removal of huffan encoding + adds blanket function returns
Megatomato Jan 17, 2024
0afa74e
hardcoded function arguments and results
Megatomato Jan 18, 2024
eaa11d9
Merge remote-tracking branch 'origin' into walter-gtirb-to-ir
Megatomato Jan 22, 2024
33dd826
Merge branch 'main' into il-cfg-iterator
ailrst Jan 23, 2024
a0ac204
Small fixes to BVEQ and tested some examples
Megatomato Jan 23, 2024
c6ccd66
Added GTS for (most) examples
Megatomato Jan 24, 2024
e9cc6cb
cleanup comments
ailrst Jan 24, 2024
86682d3
update expected
ailrst Jan 24, 2024
e39fe16
Merge pull request #141 from UQ-PAC/il-cfg-iterator
ailrst Jan 24, 2024
220dd2a
fiddled with some examples and did some small fixes
Megatomato Jan 25, 2024
dc008d1
Merge remote-tracking branch 'origin' into walter-gtirb-to-ir
Megatomato Jan 25, 2024
1a5d440
Updated logic so works with new main interface
Megatomato Jan 29, 2024
48554e2
Updated Documentation
Megatomato Jan 29, 2024
fcf97c6
Large unit tests begun
Megatomato Jan 29, 2024
bf5a697
split intrusive list
ailrst Jan 29, 2024
81175b2
intrusivelist.from
ailrst Jan 30, 2024
5903089
fixes handle_long_if and handle_unlifted_indirects such that they wor…
Megatomato Jan 30, 2024
e924015
removes floating blocks
Megatomato Jan 30, 2024
e655920
More work on handle_unlifted_indirects
Megatomato Jan 31, 2024
a1f0ae5
handle_long_if now detects more than one longif, and small changes
Megatomato Jan 31, 2024
3e0c0d8
removed .gts from examples folder, .gtirb from tests folder
Megatomato Feb 1, 2024
f171e74
Changed decoders to work with multiple modules and removed some more …
Megatomato Feb 4, 2024
4177a60
cntlm test, fixed lots of little errors
Megatomato Feb 5, 2024
ca16499
make GTIRB input optional instead of replacing the BAP input
Feb 5, 2024
2187686
cleanup
Feb 5, 2024
6914382
fix runutils
ailrst Feb 6, 2024
546db28
makefile lift gtirb
ailrst Feb 6, 2024
b258abe
make SystemTests more modular and split the tests into SystemTestsBAP…
Feb 6, 2024
5642e42
Adds GoTos to multiple blocks when GTIRB resolves Indirect Call
Megatomato Feb 6, 2024
bbd4147
create .gts files that work with the .relf files, remove a few unnece…
Feb 7, 2024
a36f1c2
Merge remote-tracking branch 'origin/walter-gtirb-to-ir' into walter-…
Feb 7, 2024
44669e5
fix lift.mk
Feb 7, 2024
4169ace
fix issue with base64 strings so characters are replaced uniquely and…
Feb 7, 2024
6a41387
add json files, fix make files
Feb 7, 2024
90fa7ee
Fix for get_jmp_reg and made Stmt_Tcall more robust
Megatomato Feb 8, 2024
141449b
revert changes to examples
Feb 8, 2024
7313f1b
re-add useful removed examples
Feb 12, 2024
4e1a796
big rework so now cntlm is handled
Feb 19, 2024
4136686
fix modifies propagation
Feb 19, 2024
f84c7f1
add exception messages
Feb 20, 2024
5477e6d
add labels to statements from gtirb
Feb 20, 2024
5068242
edit make files to allow so json not automatically created, gts can b…
Feb 20, 2024
102a75a
update makefiles
Feb 20, 2024
0e5489a
update gitignore
Feb 21, 2024
47a46d6
update gts files
Feb 21, 2024
929af28
remove gts & ast.json files from examples
Feb 21, 2024
ed65b60
Merge branch 'main' into walter-gtirb-to-ir
Feb 21, 2024
bd1d199
update readme a little
Feb 21, 2024
19a1047
update readme a little more
Feb 21, 2024
2416045
improve comments
Feb 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@ src/main/antlr4/.antlr
*.so
examplesold/
src/test/scala/dump/
src/test/analysis/dump/
src/test/analysis/dump/
*.gtirb
*.json
11 changes: 10 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,20 @@ lazy val root = project
libraryDependencies += scalactic,
libraryDependencies += scalaTests,
libraryDependencies += sourceCode,
libraryDependencies += mainArgs
libraryDependencies += mainArgs,
libraryDependencies += "org.scalameta" %% "munit" % "0.7.29" % Test
)

scalacOptions ++= Seq("-deprecation", "-feature")

Compile / PB.targets := Seq(
scalapb.gen() -> (Compile / sourceManaged).value / "scalapb"
)
libraryDependencies ++= Seq(
"com.thesamet.scalapb" %% "scalapb-runtime" % scalapb.compiler.Version.scalapbVersion % "protobuf"
)
libraryDependencies += "io.spray" %% "spray-json" % "1.3.6"

lazy val updateExpected = taskKey[Unit]("updates .expected for test cases")

updateExpected := {
Expand Down
951 changes: 951 additions & 0 deletions examples/clz/clz.adt

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions examples/clz/clz.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
int main(int argc, char** argv) {

return __builtin_clz(argc);

}
Binary file added examples/clz/clz.gts
Binary file not shown.
126 changes: 126 additions & 0 deletions examples/clz/clz.relf
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@

Relocation section '.rela.dyn' at offset 0x468 contains 8 entries:
Offset Info Type Symbol's Value Symbol's Name + Addend
000000000001fd88 0000000000000403 R_AARCH64_RELATIVE 710
000000000001fd90 0000000000000403 R_AARCH64_RELATIVE 6c0
000000000001fff0 0000000000000403 R_AARCH64_RELATIVE 714
0000000000020008 0000000000000403 R_AARCH64_RELATIVE 20008
000000000001ffd8 0000000400000401 R_AARCH64_GLOB_DAT 0000000000000000 _ITM_deregisterTMCloneTable + 0
000000000001ffe0 0000000500000401 R_AARCH64_GLOB_DAT 0000000000000000 __cxa_finalize@GLIBC_2.17 + 0
000000000001ffe8 0000000600000401 R_AARCH64_GLOB_DAT 0000000000000000 __gmon_start__ + 0
000000000001fff8 0000000800000401 R_AARCH64_GLOB_DAT 0000000000000000 _ITM_registerTMCloneTable + 0

Relocation section '.rela.plt' at offset 0x528 contains 4 entries:
Offset Info Type Symbol's Value Symbol's Name + Addend
000000000001ffb0 0000000300000402 R_AARCH64_JUMP_SLOT 0000000000000000 __libc_start_main@GLIBC_2.34 + 0
000000000001ffb8 0000000500000402 R_AARCH64_JUMP_SLOT 0000000000000000 __cxa_finalize@GLIBC_2.17 + 0
000000000001ffc0 0000000600000402 R_AARCH64_JUMP_SLOT 0000000000000000 __gmon_start__ + 0
000000000001ffc8 0000000700000402 R_AARCH64_JUMP_SLOT 0000000000000000 abort@GLIBC_2.17 + 0

Symbol table '.dynsym' contains 9 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000000588 0 SECTION LOCAL DEFAULT 11 .init
2: 0000000000020000 0 SECTION LOCAL DEFAULT 22 .data
3: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __libc_start_main@GLIBC_2.34 (2)
4: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_deregisterTMCloneTable
5: 0000000000000000 0 FUNC WEAK DEFAULT UND __cxa_finalize@GLIBC_2.17 (3)
6: 0000000000000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
7: 0000000000000000 0 FUNC GLOBAL DEFAULT UND abort@GLIBC_2.17 (3)
8: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_registerTMCloneTable

Symbol table '.symtab' contains 92 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000000238 0 SECTION LOCAL DEFAULT 1 .interp
2: 0000000000000254 0 SECTION LOCAL DEFAULT 2 .note.gnu.build-id
3: 0000000000000278 0 SECTION LOCAL DEFAULT 3 .note.ABI-tag
4: 0000000000000298 0 SECTION LOCAL DEFAULT 4 .gnu.hash
5: 00000000000002b8 0 SECTION LOCAL DEFAULT 5 .dynsym
6: 0000000000000390 0 SECTION LOCAL DEFAULT 6 .dynstr
7: 0000000000000424 0 SECTION LOCAL DEFAULT 7 .gnu.version
8: 0000000000000438 0 SECTION LOCAL DEFAULT 8 .gnu.version_r
9: 0000000000000468 0 SECTION LOCAL DEFAULT 9 .rela.dyn
10: 0000000000000528 0 SECTION LOCAL DEFAULT 10 .rela.plt
11: 0000000000000588 0 SECTION LOCAL DEFAULT 11 .init
12: 00000000000005a0 0 SECTION LOCAL DEFAULT 12 .plt
13: 0000000000000600 0 SECTION LOCAL DEFAULT 13 .text
14: 0000000000000730 0 SECTION LOCAL DEFAULT 14 .fini
15: 0000000000000744 0 SECTION LOCAL DEFAULT 15 .rodata
16: 0000000000000748 0 SECTION LOCAL DEFAULT 16 .eh_frame_hdr
17: 0000000000000788 0 SECTION LOCAL DEFAULT 17 .eh_frame
18: 000000000001fd88 0 SECTION LOCAL DEFAULT 18 .init_array
19: 000000000001fd90 0 SECTION LOCAL DEFAULT 19 .fini_array
20: 000000000001fd98 0 SECTION LOCAL DEFAULT 20 .dynamic
21: 000000000001ff98 0 SECTION LOCAL DEFAULT 21 .got
22: 0000000000020000 0 SECTION LOCAL DEFAULT 22 .data
23: 0000000000020010 0 SECTION LOCAL DEFAULT 23 .bss
24: 0000000000000000 0 SECTION LOCAL DEFAULT 24 .comment
25: 0000000000000000 0 SECTION LOCAL DEFAULT 25 .debug_aranges
26: 0000000000000000 0 SECTION LOCAL DEFAULT 26 .debug_info
27: 0000000000000000 0 SECTION LOCAL DEFAULT 27 .debug_abbrev
28: 0000000000000000 0 SECTION LOCAL DEFAULT 28 .debug_line
29: 0000000000000000 0 SECTION LOCAL DEFAULT 29 .debug_str
30: 0000000000000000 0 SECTION LOCAL DEFAULT 30 .debug_line_str
31: 0000000000000000 0 FILE LOCAL DEFAULT ABS Scrt1.o
32: 0000000000000278 0 NOTYPE LOCAL DEFAULT 3 $d
33: 0000000000000278 32 OBJECT LOCAL DEFAULT 3 __abi_tag
34: 0000000000000600 0 NOTYPE LOCAL DEFAULT 13 $x
35: 000000000000079c 0 NOTYPE LOCAL DEFAULT 17 $d
36: 0000000000000744 0 NOTYPE LOCAL DEFAULT 15 $d
37: 0000000000000000 0 FILE LOCAL DEFAULT ABS crti.o
38: 0000000000000634 0 NOTYPE LOCAL DEFAULT 13 $x
39: 0000000000000634 20 FUNC LOCAL DEFAULT 13 call_weak_fn
40: 0000000000000588 0 NOTYPE LOCAL DEFAULT 11 $x
41: 0000000000000730 0 NOTYPE LOCAL DEFAULT 14 $x
42: 0000000000000000 0 FILE LOCAL DEFAULT ABS crtn.o
43: 0000000000000598 0 NOTYPE LOCAL DEFAULT 11 $x
44: 000000000000073c 0 NOTYPE LOCAL DEFAULT 14 $x
45: 0000000000000000 0 FILE LOCAL DEFAULT ABS crtstuff.c
46: 0000000000000650 0 NOTYPE LOCAL DEFAULT 13 $x
47: 0000000000000650 0 FUNC LOCAL DEFAULT 13 deregister_tm_clones
48: 0000000000000680 0 FUNC LOCAL DEFAULT 13 register_tm_clones
49: 0000000000020008 0 NOTYPE LOCAL DEFAULT 22 $d
50: 00000000000006c0 0 FUNC LOCAL DEFAULT 13 __do_global_dtors_aux
51: 0000000000020010 1 OBJECT LOCAL DEFAULT 23 completed.0
52: 000000000001fd90 0 NOTYPE LOCAL DEFAULT 19 $d
53: 000000000001fd90 0 OBJECT LOCAL DEFAULT 19 __do_global_dtors_aux_fini_array_entry
54: 0000000000000710 0 FUNC LOCAL DEFAULT 13 frame_dummy
55: 000000000001fd88 0 NOTYPE LOCAL DEFAULT 18 $d
56: 000000000001fd88 0 OBJECT LOCAL DEFAULT 18 __frame_dummy_init_array_entry
57: 00000000000007b0 0 NOTYPE LOCAL DEFAULT 17 $d
58: 0000000000020010 0 NOTYPE LOCAL DEFAULT 23 $d
59: 0000000000000000 0 FILE LOCAL DEFAULT ABS example.c
60: 0000000000000714 0 NOTYPE LOCAL DEFAULT 13 $x
61: 0000000000000810 0 NOTYPE LOCAL DEFAULT 17 $d
62: 0000000000000000 0 FILE LOCAL DEFAULT ABS crtstuff.c
63: 0000000000000828 0 NOTYPE LOCAL DEFAULT 17 $d
64: 0000000000000828 0 OBJECT LOCAL DEFAULT 17 __FRAME_END__
65: 0000000000000000 0 FILE LOCAL DEFAULT ABS
66: 000000000001fd98 0 OBJECT LOCAL DEFAULT ABS _DYNAMIC
67: 0000000000000748 0 NOTYPE LOCAL DEFAULT 16 __GNU_EH_FRAME_HDR
68: 000000000001ffd0 0 OBJECT LOCAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_
69: 00000000000005a0 0 NOTYPE LOCAL DEFAULT 12 $x
70: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __libc_start_main@GLIBC_2.34
71: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_deregisterTMCloneTable
72: 0000000000020000 0 NOTYPE WEAK DEFAULT 22 data_start
73: 0000000000020010 0 NOTYPE GLOBAL DEFAULT 23 __bss_start__
74: 0000000000000000 0 FUNC WEAK DEFAULT UND __cxa_finalize@GLIBC_2.17
75: 0000000000020018 0 NOTYPE GLOBAL DEFAULT 23 _bss_end__
76: 0000000000020010 0 NOTYPE GLOBAL DEFAULT 22 _edata
77: 0000000000000730 0 FUNC GLOBAL HIDDEN 14 _fini
78: 0000000000020018 0 NOTYPE GLOBAL DEFAULT 23 __bss_end__
79: 0000000000020000 0 NOTYPE GLOBAL DEFAULT 22 __data_start
80: 0000000000000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
81: 0000000000020008 0 OBJECT GLOBAL HIDDEN 22 __dso_handle
82: 0000000000000000 0 FUNC GLOBAL DEFAULT UND abort@GLIBC_2.17
83: 0000000000000744 4 OBJECT GLOBAL DEFAULT 15 _IO_stdin_used
84: 0000000000020018 0 NOTYPE GLOBAL DEFAULT 23 _end
85: 0000000000000600 52 FUNC GLOBAL DEFAULT 13 _start
86: 0000000000020018 0 NOTYPE GLOBAL DEFAULT 23 __end__
87: 0000000000020010 0 NOTYPE GLOBAL DEFAULT 23 __bss_start
88: 0000000000000714 28 FUNC GLOBAL DEFAULT 13 main
89: 0000000000020010 0 OBJECT GLOBAL HIDDEN 22 __TMC_END__
90: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_registerTMCloneTable
91: 0000000000000588 0 FUNC GLOBAL HIDDEN 11 _init

Loading