LoongArch: Enable shared library and PIE for loongarch*-elf
Enables shared library and PIE support for LoongArch bare-metal targets.
This patch enables shared library and PIE (Position Independent Executable) support for loongarch*-elf targets by modifying the emulparams files. Previously, these features were explicitly disabled for LoongArch bare-metal, a restriction inherited from RISC-V without clear justification. Enabling these features is necessary for building UEFI applications on these platforms and aligns with the capabilities provided to other bare-metal ELF targets.
- proposer
Enables shared library and PIE support for LoongArch bare-metal targets by modifying emulparams.
“loongarch*-elf withholds GENERATE_SHLIB_SCRIPT and GENERATE_PIE_SCRIPT, so ld refuses -shared and -pie for it. The exclusion arrived with the original LoongArch ld port, copied from the RISC-V emulparams, and no reason was recorded for it either. loongarch*-elf does not set EMBEDDED. The rationale is the one given for the RISC-V patch in this series; it applies here unchanged.”
In Details
This patch modifies the linker emulation parameters for LoongArch bare-metal targets (loongarch*-elf). It removes specific exclusions for GENERATE_SHLIB_SCRIPT and GENERATE_PIE_SCRIPT that were present in the emulparams files. These exclusions, inherited from RISC-V, prevented the use of -shared and -pie flags, which are now enabled unconditionally. This is motivated by the need to build UEFI applications on these targets.
- LoongArch
- A family of instruction set architectures developed by Loongson Technology for China.
- loongarch*-elf
- A target triple specifying the LoongArch architecture, generic ELF object format, and no operating system (bare-metal).
- GENERATE_SHLIB_SCRIPT
- A linker configuration option that controls whether scripts for building shared libraries are generated.
- GENERATE_PIE_SCRIPT
- A linker configuration option that controls whether scripts for building Position Independent Executables are generated.
- EMBEDDED
- A configuration flag or target type indicating that the build is for an embedded system with specific constraints.