Skip to content

Github: Enforce expected amount of cxa_atexit registrations#5235

Open
Sonicadvance1 wants to merge 5 commits intoFEX-Emu:mainfrom
Sonicadvance1:59
Open

Github: Enforce expected amount of cxa_atexit registrations#5235
Sonicadvance1 wants to merge 5 commits intoFEX-Emu:mainfrom
Sonicadvance1:59

Conversation

@Sonicadvance1
Copy link
Copy Markdown
Member

On top of the previous PRs.

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.

Comment thread .github/workflows/ccpp.yml Outdated
@Sonicadvance1 Sonicadvance1 force-pushed the 59 branch 2 times, most recently from 68faf8b to 7ce6dda Compare January 14, 2026 20:37
@Sonicadvance1
Copy link
Copy Markdown
Member Author

Looks like the bash implementation doesn't work. I don't know bash well enough to know what's wrong. 🤷

Comment thread .github/workflows/ccpp.yml Outdated
Comment on lines +240 to +244
COUNT = `llvm-objdump -D ${{runner.workspace}}/build/Bin/FEX | grep "__cxa_atexit@plt>$" | wc -l`
if [ $COUNT -eq 1 ]
echo "Expected 1 atexit handlers, found $COUNT"
exit 1
fi
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
COUNT = `llvm-objdump -D ${{runner.workspace}}/build/Bin/FEX | grep "__cxa_atexit@plt>$" | wc -l`
if [ $COUNT -eq 1 ]
echo "Expected 1 atexit handlers, found $COUNT"
exit 1
fi
COUNT=`llvm-objdump -D ${{runner.workspace}}/build/Bin/FEX | grep '__cxa_atexit@plt>\\$' | wc -l`
if [ $COUNT -ne 1 ]
echo "Expected 1 atexit handlers, found $COUNT"
exit 1
fi

Something to this effect should be good. Otherwise you might need to open a terminal and run it once to find the last typo.

@Sonicadvance1 Sonicadvance1 force-pushed the 59 branch 2 times, most recently from 9e813de to 905df53 Compare January 14, 2026 21:04
Comment thread .github/workflows/ccpp.yml Outdated
Copy link
Copy Markdown
Member

@neobrain neobrain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(pending on the other PRs that are stalled; marking as "requesting changes" to help distinguish this from active PRs in our crowded PR list)

…ic object

Just a little bit of late initialization to this pmr object using
placement new.

Removes an `atexit` registration that contributes to crashing on exit.
Even though we leak `Alloc64` on shutdown, that isn't good enough to
avoid the `atexit` handler deallocating memory. So we need to use a raw
pointer and leak it.

Removes an `atexit` registration that contributes to crashing on exit.
These need to be late initialized because they allocate memory and
register an `atexit` handler to deallocate.

Removes an `atexit` registration that contributes to crashing on exit.
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`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants