PR modula2/125129: Improve Modula-2 library linking on FreeBSD
Introduces a new tool and flags to manage Modula-2 library intrinsics, resolving linking failures on systems lacking specific math functions.
This commit addresses linking failures on FreeBSD for Modula-2 programs that use specific math intrinsics like csin[l], ccos[l], and ctan[l]. It introduces a new tool, mktargetsrc, which generates target-specific Modula-2 libraries, pruning missing intrinsics at compile time rather than failing at link time. Additionally, a new -fdump-builtins flag is added to aid mktargetsrc in processing built-in functions. The changes improve the build process and error handling for Modula-2 development on various platforms.
In Details
To resolve PR modula2/125129, a new tool mktargetsrc has been introduced to replace makeSystem. This tool generates target-specific Modula-2 libraries, ensuring that intrinsics like csin, ccos, and ctan are only included if supported by the target. This prevents link-time failures on systems where these functions are unavailable. The new -fdump-builtins flag assists mktargetsrc by outputting information about available built-in functions. The autogenerated SYSTEM.def files are also improved.
- Intrinsics
- Functions or subroutines that are built directly into the compiler or language, often mapping closely to specific hardware instructions. They provide a way to access low-level functionality or optimize critical code paths.
- Modula-2
- A procedural programming language designed by Niklaus Wirth as a successor to Pascal. It emphasizes modularity and strong typing.
- FreeBSD
- An open-source Unix-like operating system descended from the Berkeley Software Distribution (BSD). It is known for its robustness and performance.
- Link time
- The phase in the software build process where the linker combines object files and libraries into an executable program. Errors at this stage typically involve unresolved symbols or references.