Skip to content

Commit f4eb879

Browse files
committed
Github: Enforce expected amount of cxa_atexit registrations
There is only one registration that I've not been able to track down why it happens, but it is something to do with std::ostream. This just ensures in CI that we don't ever register anymore atexit handlers so we don't regress on crashing on `exit`.
1 parent 6f4abe9 commit f4eb879

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

.github/workflows/ccpp.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,11 @@ jobs:
233233
working-directory: ${{runner.workspace}}/build
234234
run: mv ${{runner.workspace}}/build/Testing/Temporary/LastTest.log ${{runner.workspace}}/build/Testing/Temporary/LastTest_StructVerifier.log || true
235235

236+
- name: Ensure expected atexit registrations
237+
working-directory: ${{runner.workspace}}/build
238+
shell: bash
239+
run: $GITHUB_WORKSPACE/Scripts/CountInstancesOfAtExit.py ${{runner.workspace}}/build/Bin/FEX "__cxa_atexit@plt>$" 1 ; echo $?
240+
236241
- name: Truncate test results
237242
if: ${{ always() }}
238243
shell: bash

Scripts/CountInstancesOfAtExit.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/python3
2+
import sys
3+
import subprocess
4+
5+
def main():
6+
# Args: <FEX bin> <string> <count>
7+
if (len(sys.argv) < 4):
8+
sys.exit()
9+
10+
result = subprocess.run(['sh', '-c', "llvm-objdump -D {} | grep \'{}\' | wc -l".format(sys.argv[1], sys.argv[2])], stdout=subprocess.PIPE)
11+
Count = int(result.stdout.decode('ascii'))
12+
13+
if (Count != int(sys.argv[3])):
14+
sys.exit(-1)
15+
16+
return 0
17+
18+
if __name__ == "__main__":
19+
# execute only if run as a script
20+
sys.exit(main())
21+

0 commit comments

Comments
 (0)