Make std functions patchable on unsupported platforms #140451
Labels
C-discussion
Category: Discussion or questions that doesn't represent real issues.
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
Currently std generates dummy functions and panics on unsupported platforms. using binary patch to replace dummy functions is a practical way to implement support externally. but since dummy functions are currently inlined and optimized away, this is not possible.
Make dummy functions more patch-friendly would be helpful to ecosystem. I did some experimentation to prove this is possible. see #140440
The main motivation for this change is to support std time on wasm without intrusive dependencies. see #48564
This does not require std to guarantee the stability of dummy functions, and it is always the responsibility of the person doing the binary patch to check that the patch is correct.
There are still some unresolved issues
inline(never)
is not enough to prevent all optimizations, other compiler flags are needed to prevent places whereInstant::now()
is used from being optimized away.File
type is actually!
on unsupported platforms.cc @bjorn3 @ChrisDenton
The text was updated successfully, but these errors were encountered: