New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sync linker scripts and crt0 for arm/aarch64 with what the latest in shim #3087
Conversation
Mm I guess this means aarch64 is busted before this fix and all the tarballs will need to respin with it right? |
As a thought - would shim consider evicting these files into a subproject? It might easier to keep in sync with downstream projects like fwupd and grub if it's subprojected. |
Yes, that's correct. I noticed that we don't even have a SBAT section in |
I think that makes sense but will need some coordination with shim. |
Marked it as a draft since I just built tested the changes for now. |
0a07e6c
to
8a9aac1
Compare
Urgh, CI failure. Got any ideas or want me to take a look? |
Sorry, pushed some changes this morning to address the issue @vathpela mentioned yesterday but seems that broke the x86_64 builds. I’ll take a look at this later today. |
30db835
to
89fb849
Compare
Actually I only broke on Debian due I've pushed a new version that should fix the issue and also links against the |
Yay CI for catching it :) |
@martinezjavier yell when we're good for merging and backporting, but no pressure from me. |
The linker scripts used in the project were copied from the shim project, but there were a few fixes made after this original copy. Until binutils have proper pei-aarch64 support, the linker scripts should be kept in sync to make sure that the PE32+ binaries are built correctly. The fixes included in this change are the following: * Include missing .text sections in PE/COFF binary (Chris Coulson) * Put .sbat after _edata (Peter Jones) * Fix some PE headers for arm and aarch64 (Peter Jones) * Include the aligned part in SizeOfRawData of sbat for arm and aarch64 (Gary Lin) * Swizzle some sections to make old sbsign happier for arm and aarch64 (Peter Jones) * Put .rel* and .dyn* in .rodata for arm and aarch64 (Peter Jones)
Due the lack of pei-aarch64 support in binutils, the gnu-efi crt0 harcodes the PE32+ sections among other things. These crt0 aren't aware of the SBAT section and so custom ones have to be used. In the same vein as commit cfd1f2f ("uefi-capsule: Ensure SBAT metadata is added correctly") included custom linker scripts, this change add a set of crt0 for arm and aarch64 that hardcode a SBAT section in the PE headers. These are the crt0 from gnu-efi plus the following fixes from Peter Jones: * Include .sbat in section headers * Fix some PE headers * Calculate the VirtualSize of .sbat separately * Put .rel* and .dyn* in .rodata
89fb849
to
75159fe
Compare
I think it is ready to be merged now. The I didn't get access to a system that supports firmware updates so I only tested that the PE32+ binary was executed and printed the error message about no updates to process [1]. [0]:
[1]:
|
Type of pull request: