UEFI PE linking on bare-metal targets
Discusses proper linking of PE binaries on bare-metal targets vs. enabling PIE/shared lib for UEFI.
Jan Beulich questions the approach of enabling shared library and PIE support for riscv*-elf and loongarch*-elf targets solely for UEFI application development. He suggests that directly supporting the linking of PE binaries from ELF inputs, as done on x86-64, might be a more robust solution if UEFI is the primary concern. This comes as a response to a patch series that aims to enable these features for bare-metal targets.
- reviewer
Questions enabling PIE/shared lib for UEFI on bare-metal, suggests direct PE linking support as an alternative.
“Afaik a "normal" UEFI application is an ordinary PE executable. What you describe looks to be the result of some handcrafting. Imo properly supporting the true linking of PE binaries from ELF inputs on the targets of interest (like is already possible on x86-64, for example) would be the better course of action (if UEFI applications are the sole concern here).”
In Details
This discussion revolves around the implications of enabling shared library and PIE (Position Independent Executable) support for bare-metal targets like riscv*-elf and loongarch*-elf. The core of the debate is whether this enablement, motivated by UEFI application development needs, is the most appropriate solution, or if a more direct approach to linking PE binaries from ELF inputs, akin to what exists for x86-64, would be better.
- PIE
- Position Independent Executable. An executable program that can be loaded and run at any arbitrary memory address without modification. This is crucial for security features like Address Space Layout Randomization (ASLR).
- UEFI
- Unified Extensible Firmware Interface. A standard that defines the software interface between an operating system and platform firmware. It is the successor to the BIOS.
- ET_DYN
- ELF file type indicating a dynamically linked executable. These are often used for shared libraries or position-independent executables.
- PE binary
- Portable Executable binary. The standard file format for executables, DLLs, and object code in Windows.