Skip to content

Commit bbe059e

Browse files
authored
Merge pull request #6337 from tautschnig/fix-6330
export-file-local_symbols:: update base name and pretty name
2 parents b08632a + 1f18a3d commit bbe059e

File tree

8 files changed

+62
-2
lines changed

8 files changed

+62
-2
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
int __CPROVER_file_local_file2_c_foo(int x);
2+
3+
int main()
4+
{
5+
int x = __CPROVER_file_local_file2_c_foo(1);
6+
__CPROVER_assert(x == 2, "x == 2");
7+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
static int foo(int x)
2+
{
3+
return x + 1;
4+
}
5+
6+
static int bar(int x)
7+
{
8+
return x + 2;
9+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
CORE
2+
file1.c
3+
final-link show-symbol-table assertion-check
4+
^Base name\.\.\.: __CPROVER_file_local_.*_foo$
5+
^EXIT=0$
6+
^SIGNAL=0$
7+
--
8+
^warning: ignoring
9+
^Base name\.\.\.: foo$
10+
--
11+
The linking order must not affect the base name of the mangled symbol. See
12+
base-name-2 for a test that will yield a different linking order (while still
13+
producing the same base name).
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
static int foo(int x)
2+
{
3+
return x + 1;
4+
}
5+
6+
static int bar(int x)
7+
{
8+
return x + 2;
9+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
int __CPROVER_file_local_file1_c_foo(int x);
2+
3+
int main()
4+
{
5+
int x = __CPROVER_file_local_file1_c_foo(1);
6+
__CPROVER_assert(x == 2, "x == 2");
7+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
CORE
2+
file1.c
3+
final-link show-symbol-table assertion-check
4+
^Base name\.\.\.: __CPROVER_file_local_.*_foo$
5+
^EXIT=0$
6+
^SIGNAL=0$
7+
--
8+
^warning: ignoring
9+
^Base name\.\.\.: foo$
10+
--
11+
The linking order must not affect the base name of the mangled symbol. See
12+
base-name-1 for a test that will yield a different linking order (while still
13+
producing the same base name).

regression/goto-cc-goto-analyzer/reachable-functions-export-file-local-symbols/test.desc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
CORE
22
test.c
33
--reachable-functions
4-
^.* foo 1 4$
4+
^.* __CPROVER_file_local_project_c_foo 1 4$
55
^EXIT=0$
66
^SIGNAL=0$
77
--
8-
^.* [a-zA-Z0-9_]+foo \d+ \d+$
98
--
109
This test checks that after building the goto binary (see test.sh) with
1110
--export-file-local-symbols function "foo" is still reported as reachable. Note,

src/goto-programs/name_mangler.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ class function_name_manglert
7070
symbolt new_sym;
7171
new_sym = sym;
7272
new_sym.name = mangled;
73+
new_sym.base_name = mangled;
74+
if(new_sym.pretty_name.empty())
75+
new_sym.pretty_name = sym.base_name;
7376
new_sym.is_file_local = false;
7477

7578
new_syms.push_back(new_sym);

0 commit comments

Comments
 (0)