Why was the PE/COFF format of executables, used in MS Windows, chosen as the executable format for UEFI? The ELF format is the de-facto standard in modern UNIX-based systems, and it has good support in the compiler toolchains. Why was PE chosen instead of ELF, then?
The choice of the Portable Executable (PE) format for UEFI (Unified Extensible Firmware Interface) executables, as opposed to the ELF (Executable and Linkable Format) used in UNIX-based systems, is due to historical and practical reasons. Here are some key factors that contributed to this choice:

Legacy Compatibility: UEFI was developed as a replacement for the older BIOS system used in PC hardware. In order to maintain compatibility with existing software and drivers that were already written in the PE format for Windows, it made sense to continue using the PE format for UEFI.

Windows Dominance: Microsoft Windows is one of the most widely used operating systems in the PC world, and a large number of applications and device drivers are developed for Windows. By using the PE format, UEFI ensures that these Windows-compatible components can be easily integrated into the UEFI environment.

Familiarity and Tools: Many developers in the Windows ecosystem are already familiar with the PE format, and there are well-established tools, compilers, and development environments that work with PE executables. Leveraging these tools and knowledge made sense for UEFI development.

ABI (Application Binary Interface): The choice of executable format is often closely tied to the ABI of the platform. UEFI has its own ABI that includes specific calling conventions and system services, and these are more in line with the Windows ABI than the traditional Unix/Linux ABI.

Practical Considerations: While ELF is a widely used format in the UNIX and Linux world, it may not be as well-suited for the low-level firmware environment that UEFI operates in. The PE format is designed with certain features that are useful for system firmware, including features for the description of memory map and other system-specific information.

Vendor Support: Many hardware vendors and manufacturers that implement UEFI firmware have traditionally had close relationships with Microsoft and may have been more comfortable working with the PE format due to these relationships and existing Windows integration.

It's worth noting that the choice of PE over ELF doesn't necessarily limit the flexibility and utility of UEFI firmware. UEFI itself provides a framework for extensibility, and it's possible to create modules in various formats, including ELF, as long as they adhere to the UEFI specifications. However, the PE format was chosen as the primary executable format for the reasons mentioned above.
Thank you. That makes sense.
No problem, glad I helped you.