Skip to content

gccrs: Initial implementation of hotpatching rustc-lib - #4924

Open
Polygonalr wants to merge 1 commit into
Rust-GCC:masterfrom
Polygonalr:extract-if
Open

Polygonalr wants to merge 1 commit into
Rust-GCC:masterfrom
Polygonalr:extract-if

Conversation

@Polygonalr

@Polygonalr Polygonalr commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Closes #4835 (?)

ngl I feel icky about this implementation, making this PR to receive opinions on how to move #4835 forward, as it likely requires either backporting the feature to core, or bumping our target core version to 1.72, the latter being less than ideal. Patch file for #4835 is not done yet, just patching CStr as an example first.

I'm also not too sure about the stance of including .patch files in the gcc repo, since the root .gitignore ignores .patch files.

PR finalization edit: I kept both the implementations of CStr and ExtractIf minimal for now because I find it too tedious to test the compilation of the full suite of impl-s (especially so for CStr) when we are still unable to compile core. When more impl-s are discovered to be required, we can either add them as additional patch files or modify the existing ones.

@powerboat9

Copy link
Copy Markdown
Collaborator

You could try naming the file 0001-core-ffi-c-str.patch.keep

@CohenArthur

CohenArthur commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

or maybe something even clearer since this is just for the kernel like 0001-core-ffi-c-str.rfl-patch? 0001-core-ffi-c-str.kernel-patch?

@CohenArthur CohenArthur left a comment •

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.

the Python code looks good to me but I'm really not good at Python :P for the README, I think it would be good to have a section on how to generate these patches and to re-iterate that these should only be present if they are NEEDED by the KERNEL to compile. this makes it clearer that we do intend to not patch core, but also want to start experimenting with the kernel and have to make some adjustments and concessions in that specific case

@Polygonalr
Polygonalr force-pushed the extract-if branch 3 times, most recently from 105bd97 to 3307946 Compare September 22, 2026 14:37
@powerboat9

powerboat9 commented Sep 22, 2026 •

Copy link
Copy Markdown
Collaborator

I'm writing a script to update the vendored libraries you might want to integrate this with in some way. I'll have a PR up shortly.

Edit: #4934

@Polygonalr

Copy link
Copy Markdown
Contributor Author

@powerboat9 Hmmm not too sure what's there to change in my PR besides updating the patch files manually when we do a core version bump

Addresses Rust-GCC#4835

libgrust/ChangeLog:

	* rustc-lib-patches/patches/0001-core-ffi-c-str.for-rfl-patch: Backported patch to
	support CStr parsing.
	* rustc-lib-patches/patches/0002-alloc-vec-extract-if.for-rfl-patch: Backported vec's
	implementation of extract_if.
	* rustc-lib-patches/rustc-lib-patch.py: Script to apply the patch files to rustc-lib.
	* rustc-lib-patches/README.md: the README file for this dir.

Signed-off-by: Yap Zhi Heng <yapzhhg@gmail.com>
@Polygonalr
Polygonalr marked this pull request as ready for review September 27, 2026 03:40

This branch has not been deployed

No deployments
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.

Implement ExtractIf/extract_if feature

3 participants