Commit Graph

4 Commits

Author SHA1 Message Date
Michael Tautschnig fcf6fc0b37 Export-function-local-symbols name mangling: rename initial values
We previously renamed all occurrences in goto functions, but did not
consider the initial values of symbols with static lifetime, which are
stored in the symbol table. To make this reasonably efficient, make
rename_symbolt::operator() expose the return value (and document the
methods).

To test this, include the test suite in Makefile-based test set-ups
(CMake was already done), and fix the chain.sh file.
2019-05-01 11:08:28 +00:00
Kareem Khazem 236c2573e5
Mangle static functions using basename, not path
Previously, if we compiled a file called

    foo/bar/baz/main.c

containing a static function called `qux`, that function's name would be
mangled to

    __CPROVER_file_local_foo_bar_baz_main_c_qux

This commit changes the behaviour so that only the basename is used to
mangle the function name:

    __CPROVER_file_local_main_c_qux

This is so that users writing CBMC proofs for file-local functions don't
have to worry about where the goto-binary was compiled.
2019-04-29 12:23:19 +01:00
Michael Tautschnig 2e3c859d07
File-local name mangling: fix Windows tests
The command-line options to goto-cl weren't passed correctly. Also do
not use blank lines as patterns as it confuses test.pl on Windows.
2019-04-29 12:20:10 +01:00
Kareem Khazem 4438e777be
Add --export-function-local-symbols to goto-cc
This switch makes goto-cc do three things:

- retain the implementations of all static functions.
- mangle the names of all static functions.
- unset the file_local flag on all static function symbols.

This feature is intended to help users writing CBMC checks for
file-local functions (i.e., those declared as `static` in the C
language). The intended workflow is: compile the code under test with
the -fkeep-static-functions flag. Then link the code under test with
the 'harness' file, again using the flag. This allows the harness to
call into static functions in the codebase under test.
2019-04-02 08:50:53 -07:00