Skip to content

Commit 81c3e02

Browse files
authored
Merge pull request #4645 from hannes-steffenhagen-diffblue/feature-symtab_linking
Add symtab2gb to enable linking of .json_symtab files
2 parents 0aef428 + da5fd45 commit 81c3e02

28 files changed

+10981
-0
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ set_target_properties(
141141
linking
142142
pointer-analysis
143143
solvers
144+
symtab2gb
144145
testing-utils
145146
unit
146147
util

regression/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,4 @@ add_subdirectory(contracts)
5252
add_subdirectory(goto-harness)
5353
add_subdirectory(goto-cc-file-local)
5454
add_subdirectory(linking-goto-binaries)
55+
add_subdirectory(symtab2gb)

regression/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ DIRS = cbmc \
2727
contracts \
2828
goto-cc-file-local \
2929
linking-goto-binaries \
30+
symtab2gb \
3031
# Empty last line
3132

3233
# Run all test directories in sequence

regression/symtab2gb/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
add_test_pl_tests(
2+
"${CMAKE_CURRENT_SOURCE_DIR}/chain.sh $<TARGET_FILE:symtab2gb> $<TARGET_FILE:cbmc>"
3+
)

regression/symtab2gb/Makefile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
default: tests.log
2+
3+
include ../../src/config.inc
4+
include ../../src/common
5+
6+
test:
7+
@../test.pl -e -p -c '../chain.sh $(exe) ../../../src/symtab2gb/symtab2gb ../../../src/cbmc/cbmc'
8+
9+
tests.log:
10+
@../test.pl -e -p -c '../chain.sh $(exe) ../../../src/symtab2gb/symtab2gb ../../../src/cbmc/cbmc'
11+
12+
show:
13+
@for dir in *; do \
14+
if [ -d "$$dir" ]; then \
15+
vim -o "$$dir/*.c" "$$dir/*.out"; \
16+
fi; \
17+
done;
18+
19+
clean:
20+
@for dir in *; do \
21+
$(RM) tests.log; \
22+
if [ -d "$$dir" ]; then \
23+
cd "$$dir"; \
24+
$(RM) *.out *.gb; \
25+
cd ..; \
26+
fi \
27+
done

regression/symtab2gb/chain.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
symtab2gb_exe=$1
3+
cbmc_exe=$2
4+
5+
$symtab2gb_exe "${@:3}"
6+
$cbmc_exe a.out
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
The `*.json_symtab` in this directory was created from the Ada source
2+
files `*.adb` using the
3+
[gnat2goto](https://github.com/diffblue/gnat2goto) compiler.
4+
5+
```
6+
gnat2goto user.adb # produces user.json_symtab
7+
8+
# produces library.json_symtab
9+
# and user.json_symtab
10+
# the --no-cprover-start option is to prevent
11+
# emitting a __CPROVER_start function for these modules,
12+
# as there can only be one of those in a program
13+
14+
gnat2goto --no-cprover-start library.adb
15+
gnat2goto --no-cprover-start user.adb
16+
```
17+
18+
Note that as of now, this requires the patch found in
19+
[this PR](https://github.com/diffblue/gnat2goto/pull/212)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
with User;
2+
with Library;
3+
procedure Entry_Point is
4+
begin
5+
User;
6+
Library (-5);
7+
end Entry_Point;

0 commit comments

Comments
 (0)