gccrs: Implement hotpatching for rustc-lib
gccrs introduces initial support for hotpatching rustc-lib by backporting core Rust library patches.
gccrs has implemented an initial version of hotpatching for rustc-lib, a component that provides Rust library functionality within GCC. This is achieved by backporting specific patches from the Rust core library, including functionality for CStr parsing (core/ffi/c-str.for-rfl-patch) and Vec::extract_if (alloc/vec-extract-if.for-rfl-patch). A Python script is included to apply these patches to rustc-lib, along with a README file explaining the process.
In Details
This commit lays the groundwork for hotpatching rustc-lib within gccrs. It backports two key patches: one for core::ffi::CStr support and another for alloc::vec::extract_if. These patches are essential for enhancing gccrs's compatibility with the Rust standard library ecosystem. A Python script (rustc-lib-patch.py) is provided to automate the application of these patches to the relevant rustc-lib source files, enabling gccrs to leverage these standard library features more effectively. This addresses Rust-GCC/gccrs#4835.
- hotpatching
- A technique for modifying a running program or library without restarting it. In this context, it refers to applying patches to
rustc-libto update its functionality. - rustc-lib
- A component used by
gccrsthat provides Rust standard library functionalities. It aims to emulate the behavior of Rust's standard library within the GCC compilation environment. - CStr
- A Rust type representing a borrowed C-style string slice (a null-terminated sequence of bytes).
- Vec::extract_if
- A method on Rust's
Vec(vector) type that removes and returns elements satisfying a predicate, modifying the vector in place. - backporting
- The process of taking a patch or feature from a newer version of software and applying it to an older version.