Generic-ELF: Add platform module to configure the .elf file extension

The `.elf` extension is a common convention used for embedded binaries.
Both Arm and RISC-V use the ELF file format for executables.
Configuring the `.elf` file extension is typically done incorrectly.
Most embedded developers set this in toolchain files, which is not
the correct place.
This is typically accomplished through a hack by setting the individual
language file extensions for C, CXX, and ASM.
Multiple CMake issues in the past have been opened related to this.

* #16538
* #20163
* #17880

A platform module makes it simpler and less error prone for developers
targeting these ubiquitous bare-metal platforms.
This PR attempts to solve this globally with a generic platform.
This could also be solved by using more specific platform modules, such
as one for each of bare-metal Arm and RISC-V.
This commit is contained in:
Jordan Williams
2021-10-18 10:22:18 -05:00
parent c5ae200d94
commit 3f9b40dab7
2 changed files with 8 additions and 0 deletions

View File

@@ -63,6 +63,7 @@ The following individuals and institutions are among the Contributors:
* Ilya Lavrenov <ilya.lavrenov@itseez.com>
* Insight Software Consortium <insightsoftwareconsortium.org>
* Jan Woetzel
* Jordan Williams <jordan@jwillikers.com>
* Julien Schueller
* Kelly Thompson <kgt@lanl.gov>
* Konstantin Podsvirov <konstantin@podsvirov.pro>

View File

@@ -0,0 +1,7 @@
# This is a platform definition file for platforms without
# an operating system using the ELF executable format.
# It is used when CMAKE_SYSTEM_NAME is set to "Generic-ELF"
include(Platform/Generic)
set(CMAKE_EXECUTABLE_SUFFIX .elf)