You have a GCC patch and want to test it using RTEMS source builder (RSB)? There are multiple options.
Note: This started as a Discord discussion.
I usually use the first method (Hacking in a Patch in RSB). I didn’t personally test the second method. If someone has a better method: Let me know.
Hacking in a Patch in RSB
One possibility is to just add it as a patch in RSB. This is a quick and dirty solution.
- Create the gcc patch. Add it to RSB as
rtems/patches/my-gcc-patch.patch(with a better name). Note that you have to force-add a file there if you want to have it commited because this directory is usually ignored by a.gitignorefile. - Calculate the sha512 hash of the patch. You can use the script in
source-builder/sha512-base64for that. - Search for the config for your GCC version. For example
rtems/config/tools/rtems-gcc-13.3-newlib-head.cfg. Add a patch line to that like follows:%patch add gcc -p1 file://my-gcc-patch.patch %hash sha512 my-gcc-patch.patch z4PhNX7vuL3xVChQ1m2AB9Yg5AULVxXcg/SpIdNs6c5H0NE8XYXysP+DGNKHfuwvY7kxvUdBeoGlODJ6+SfaPg==
Now rebuild your toolchain using the patched RSB.
Using RSB macro maps
You can add a RSB macro map configuration file similar to the following to achieve a similar goal:
The patch is tested. What’s next?
- Create a MR in the RTEMS fork of GCC to discuss the change.
- After the discussion: Contribute the patch to the upstream GCC and hope that it will be accepted there.
- Either wait till a GCC release picks the patch up. Or add a patch to RSB that pulls the patch from the discussion in our gitlab or from the gcc commit. You can do that also parallel to bringing the patch upstream.