-
Notifications
You must be signed in to change notification settings - Fork 274
Allow static
attribute to be stripped from symbols
#4409
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
if(WIN32) | ||
set(is_windows true) | ||
else() | ||
set(is_windows false) | ||
endif() | ||
|
||
add_test_pl_tests( | ||
"${CMAKE_CURRENT_SOURCE_DIR}/chain.sh $<TARGET_FILE:goto-cc> $<TARGET_FILE:goto-instrument> $<TARGET_FILE:cbmc> ${is_windows}" | ||
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Invoke one or more CPROVER tools depending on arguments | ||
# | ||
# Author: Kareem Khazem <[email protected]> | ||
|
||
is_in() | ||
{ | ||
[[ "$2" =~ $1 ]] && return 0 || return 1 | ||
} | ||
|
||
ALL_ARGS="$@" | ||
OUT_FILE="" | ||
|
||
if is_in suffix "$ALL_ARGS"; then | ||
suffix="--mangle-suffix custom_suffix" | ||
else | ||
suffix="" | ||
fi | ||
|
||
goto_cc=$1 | ||
goto_instrument=$2 | ||
cbmc=$3 | ||
is_windows=$4 | ||
|
||
for src in *.c; do | ||
base=${src%.c} | ||
OUT_FILE="${base}.gb" | ||
|
||
if [[ "${is_windows}" == "true" ]]; then | ||
"${goto_cc}" \ | ||
/export-function-local-symbols \ | ||
/verbosity 10 \ | ||
${suffix} \ | ||
/c"${base}.c" \ | ||
/Fo"${OUT_FILE}" | ||
|
||
elif [[ "${is_windows}" == "false" ]]; then | ||
"${goto_cc}" \ | ||
--export-function-local-symbols \ | ||
--verbosity 10 \ | ||
${suffix} \ | ||
-c "${base}.c" \ | ||
-o "${OUT_FILE}" | ||
else | ||
(>&2 echo "\$is_windows should be true or false (got '" "${is_windows}" "')") | ||
exit 1 | ||
fi | ||
done | ||
|
||
if is_in final-link "$ALL_ARGS"; then | ||
OUT_FILE=final-link.gb | ||
if [[ "${is_windows}" == "true" ]]; then | ||
"${goto_cc}" \ | ||
/export-function-local-symbols \ | ||
/verbosity 10 \ | ||
${suffix} \ | ||
./*.gb \ | ||
/Fe "${OUT_FILE}" | ||
|
||
elif [[ "${is_windows}" == "false" ]]; then | ||
"${goto_cc}" \ | ||
--export-function-local-symbols \ | ||
--verbosity 10 \ | ||
${suffix} \ | ||
./*.gb \ | ||
-o "${OUT_FILE}" | ||
fi | ||
fi | ||
|
||
if is_in show-symbol-table "$ALL_ARGS"; then | ||
"${goto_instrument}" --show-symbol-table "${OUT_FILE}" | ||
fi | ||
|
||
if is_in assertion-check "$ALL_ARGS"; then | ||
"${cbmc}" "${OUT_FILE}" | ||
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
static int foo() | ||
{ | ||
assert(0); | ||
return 1; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
int __CPROVER_file_local_foo_c_foo(); | ||
|
||
int main() | ||
{ | ||
int x = __CPROVER_file_local_foo_c_foo(); | ||
} |
13 changes: 13 additions & 0 deletions
13
regression/goto-cc-file-local/result-multi-file-bad/test.desc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
CORE | ||
main.c | ||
final-link assertion-check | ||
|
||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^VERIFICATION FAILED$ | ||
-- | ||
^warning: ignoring | ||
^\*\*\*\* WARNING: no body for function | ||
-- | ||
Check that CBMC symbolically executes a static function in a different | ||
file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
static int foo() | ||
{ | ||
return 1; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
int __CPROVER_file_local_foo_c_foo(); | ||
|
||
int main() | ||
{ | ||
int x = __CPROVER_file_local_foo_c_foo(); | ||
} |
13 changes: 13 additions & 0 deletions
13
regression/goto-cc-file-local/result-multi-file-good/test.desc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
CORE | ||
main.c | ||
final-link assertion-check | ||
|
||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^VERIFICATION SUCCESSFUL$ | ||
-- | ||
^warning: ignoring | ||
^\*\*\*\* WARNING: no body for function | ||
-- | ||
Check that CBMC symbolically executes a static function in a different | ||
file |
10 changes: 10 additions & 0 deletions
10
regression/goto-cc-file-local/result-multi-file-transitive/foo.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
static int bar() | ||
{ | ||
assert(0); | ||
return 1; | ||
} | ||
|
||
static int foo() | ||
{ | ||
return bar(); | ||
} |
6 changes: 6 additions & 0 deletions
6
regression/goto-cc-file-local/result-multi-file-transitive/main.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
int __CPROVER_file_local_foo_c_foo(); | ||
|
||
int main() | ||
{ | ||
int x = __CPROVER_file_local_foo_c_foo(); | ||
} |
14 changes: 14 additions & 0 deletions
14
regression/goto-cc-file-local/result-multi-file-transitive/test.desc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
CORE | ||
main.c | ||
final-link assertion-check | ||
|
||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^VERIFICATION FAILED$ | ||
-- | ||
^warning: ignoring | ||
^\*\*\*\* WARNING: no body for function | ||
-- | ||
Check that CBMC symbolically executes static functions in a different | ||
file. Ensure that static functions are transitively called. Function | ||
calls don't need to be manually mangled in the same file. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
static int foo() | ||
{ | ||
assert(0); | ||
return 1; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
int __CPROVER_file_local_foo_c_custom_suffix_foo(); | ||
|
||
int main() | ||
{ | ||
int x = __CPROVER_file_local_foo_c_custom_suffix_foo(); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
CORE | ||
main.c | ||
final-link assertion-check suffix | ||
|
||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^VERIFICATION FAILED$ | ||
-- | ||
^warning: ignoring | ||
^\*\*\*\* WARNING: no body for function | ||
-- | ||
Check that CBMC symbolically executes a static function in a different | ||
file. Use a suffix. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
static int foo() | ||
{ | ||
return 3; | ||
} | ||
|
||
int main() | ||
{ | ||
int x = foo(); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
CORE | ||
main.c | ||
show-symbol-table | ||
|
||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^Symbol......: __CPROVER_file_local_main_c_foo$ | ||
-- | ||
^warning: ignoring | ||
^\*\*\*\* WARNING: no body for function | ||
-- | ||
This is similar to check-symbol-fully-linked, except that we're not | ||
linking the binary (we're using -c and not subsequently not using it). | ||
Check that we still keep the file-local implementations. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
static int foo() | ||
{ | ||
return 3; | ||
} | ||
|
||
int main() | ||
{ | ||
int x = foo(); | ||
} |
10 changes: 10 additions & 0 deletions
10
regression/goto-cc-file-local/symbol-fully-linked/test.desc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
CORE | ||
main.c | ||
final-link show-symbol-table | ||
|
||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^Symbol......: __CPROVER_file_local_main_c_foo$ | ||
-- | ||
^warning: ignoring | ||
^\*\*\*\* WARNING: no body for function |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
static int foo() | ||
{ | ||
return 3; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
int foo(); | ||
|
||
int main() | ||
{ | ||
int x = foo(); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
CORE | ||
main.c | ||
final-link show-symbol-table | ||
|
||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^Symbol......: __CPROVER_file_local_foo_c_foo$ | ||
-- | ||
^warning: ignoring | ||
^\*\*\*\* WARNING: no body for function | ||
-- | ||
Check that a static function in a different file appears in the symbol | ||
table of the fully-linked binary |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.