You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just wanted to make an announcement that I created a new branch: https://github.com/rusnikola/shim which enables native DLL compilation and completely removes any dependencies on gnu-efi, libgcc, etc. I added all required library functions (printf, memcpy, memset, StrCpy, StrCat, etc), changed Makefiles to use clang to compile PE/COFF DLLs. Then I also included the FwImage tool which I have ported long time ago from Windows to Linux/POSIX which converts DLL to EFI.
I have tested compilation for X64 and IA32; ARM/AArch64 should probably be OK. I have done some testing on X64.
One of the biggest advantages is that it uses official TianoCore headers rather than gnu-efi. Also, file sizes are greatly reduced now. Compiled files are truly PE/COFF per UEFI spec rather than ELFs hidden inside PE/COFF stubs. Compiled shim is now ~425Kb (instead of 1Mb) due to much better elimination of unused OpenSSL code during linking!
See all distinctive features below. If there is any interest to merge changes in one way or another to the main (official) branch, please let me know. (e.g., creating shim-experimental or something like this)
Make sure to use clang 7.0 or higher. Edit Makefiles accordingly to specify correct paths to clang and lld-link.
Note: It uses EFIAPI / MS ABI calling convention for all platforms other than IA32. For IA32, it uses -mregparm=3 -mrtd for internal functions and EFIAPI for external ones. To preserve backward compatibility when overriding security policy, it uses SysV calling convention for X64 for those 3 exported functions only.
Distinctive Features:
Completely standalone, i.e. does not require the gnu-efi library. To access
UEFI interfaces, it is using official Edk2/TianoCore headers.
Native UEFI PE/COFF (DLL) compilation using out-of-box clang/llvm
(or, potentially, the mingw-gcc cross-compiler) instead of creating
internally relocatable ELF objects with PE/COFF wrapper stubs (gnu-efi).
The Edk's FwImage tool (which I ported from Windows to Linux/POSIX)
converts DLL to EFI.
Using smarter linking with llvm's PE/COFF lld-link to prune all unused
functions/objects in the OpenSSL library.
Added own printf, string, memory, etc implementations to substitute
functions previously imported from gnu-efi.
As the result, substantially reduced footprints of EFI files
(e.g., 425Kb vs 1Mb for shimx64.efi compiled with -Os).
Fixed some bugs, removed a lot of copy&paste code from TianoCore
(official TianoCore headers are now used anyway) and added other
improvements to the code.
Requirements:
clang/llvm/lld 7.0.0+ (needs the -mno-stack-arg-probe flag)
Official binaries for various Linux distributions are available at http://releases.llvm.org/download.html
Ruslan Nikolaev
The text was updated successfully, but these errors were encountered:
rusnikola
changed the title
SHIM fork with native DLL compilation
SHIM fork for native DLL compilation
Oct 30, 2018
Hi
Just wanted to make an announcement that I created a new branch: https://github.com/rusnikola/shim which enables native DLL compilation and completely removes any dependencies on gnu-efi, libgcc, etc. I added all required library functions (printf, memcpy, memset, StrCpy, StrCat, etc), changed Makefiles to use clang to compile PE/COFF DLLs. Then I also included the FwImage tool which I have ported long time ago from Windows to Linux/POSIX which converts DLL to EFI.
I have tested compilation for X64 and IA32; ARM/AArch64 should probably be OK. I have done some testing on X64.
One of the biggest advantages is that it uses official TianoCore headers rather than gnu-efi. Also, file sizes are greatly reduced now. Compiled files are truly PE/COFF per UEFI spec rather than ELFs hidden inside PE/COFF stubs. Compiled shim is now ~425Kb (instead of 1Mb) due to much better elimination of unused OpenSSL code during linking!
See all distinctive features below. If there is any interest to merge changes in one way or another to the main (official) branch, please let me know. (e.g., creating shim-experimental or something like this)
Make sure to use clang 7.0 or higher. Edit Makefiles accordingly to specify correct paths to clang and lld-link.
Note: It uses EFIAPI / MS ABI calling convention for all platforms other than IA32. For IA32, it uses -mregparm=3 -mrtd for internal functions and EFIAPI for external ones. To preserve backward compatibility when overriding security policy, it uses SysV calling convention for X64 for those 3 exported functions only.
Distinctive Features:
UEFI interfaces, it is using official Edk2/TianoCore headers.
(or, potentially, the mingw-gcc cross-compiler) instead of creating
internally relocatable ELF objects with PE/COFF wrapper stubs (gnu-efi).
converts DLL to EFI.
functions/objects in the OpenSSL library.
functions previously imported from gnu-efi.
(e.g., 425Kb vs 1Mb for shimx64.efi compiled with -Os).
(official TianoCore headers are now used anyway) and added other
improvements to the code.
Requirements:
clang/llvm/lld 7.0.0+ (needs the -mno-stack-arg-probe flag)
Official binaries for various Linux distributions are available at
http://releases.llvm.org/download.html
The text was updated successfully, but these errors were encountered: