Skip to content

feat(libc): implement std::_Atomic_assert - #1598

Closed
danielepoterti wants to merge 1 commit into
boykopovar:mainfrom
danielepoterti:fix/libc-atomic-assert
Closed

danielepoterti wants to merge 1 commit into
boykopovar:mainfrom
danielepoterti:fix/libc-atomic-assert

Conversation

@danielepoterti

Copy link
Copy Markdown

The import was a throwing stub in Export.cpp, kept as a dead import of Cyberpunk 2077 (no call sites) that the Windows loader resolves strictly. It now sits with the other Atomic helpers in RuntimeSupport.cpp and throws std::runtime_error carrying both string arguments, with "(null)" for a null pointer.

The mangled name gives two const char* parameters. Naming them expression and file follows the usual assert handler order (__assert_fail, _wassert); no source confirms the order for this library.

What

Implement std::_Atomic_assert (_ZSt14_Atomic_assertPKcS0_) in libc.

The export was a throwing stub in Export.cpp, kept for a dead import of Cyberpunk 2077 that the Windows loader resolves strictly. It now sits with the other _Atomic_ helpers in RuntimeSupport.cpp and throws std::runtime_error carrying both string arguments ("(null)" for a null pointer).

The mangled name gives two const char* parameters. The names expression and file follow the usual assert handler order (__assert_fail, _wassert); no source confirms the order for this library.

guest_atomic_assert checks the message for both strings and for null pointers, on every platform.

Tested

Windows 11, MinGW-w64 GCC 15.2.0 (WinLibs r7): built libc, guest_atomic_assert passes; checked that it fails with the wrong expected message. Linux not tested locally.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes

The import was a throwing stub in Export.cpp, kept as a dead import of
Cyberpunk 2077 (no call sites) that the Windows loader resolves
strictly. It now sits with the other _Atomic_ helpers in
RuntimeSupport.cpp and throws std::runtime_error carrying both string
arguments, with "(null)" for a null pointer.

The mangled name gives two const char* parameters. Naming them
expression and file follows the usual assert handler order
(__assert_fail, _wassert); no source confirms the order for this
library.
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#1498 _ZSt14_Atomic_assertPKcS0__nid_postfix

@danielepoterti

Copy link
Copy Markdown
Author

Closing in favour of #1498, which already implements std::_Atomic_assert; I missed it before opening this.

@danielepoterti
danielepoterti deleted the fix/libc-atomic-assert branch October 8, 2026 14:20
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.

1 participant