Rename ldemul_create_output_section_statements
Renames `ldemul_create_output_section_statements` to `after_open_output` for clarity, as the function does not create sections.
Alan Modra proposes renaming the linker emulation function ldemul_create_output_section_statements to after_open_output. The change is motivated by the observation that this function’s actual purpose is not to create output sections, but rather to perform actions after the output file has been opened. This rename aims to improve code clarity and accuracy by better reflecting the function’s role in the linking process. The patch updates multiple emulation files and documentation.
- proposer
Proposes renaming a linker emulation function from `create_output_section_statements` to `after_open_output` for clarity.
“This function was poorly named. As was noted in ldint.texi, now deleted, "nobody creates output sections here". Apart from the ldint.texi change this patch simply substitutes all occurences of create_output_section_statements with after_open_output, both lower and upper case.”
In Details
This patch focuses on improving the naming convention within the GNU linker's emulation template files (.em). The function currently named ldemul_create_output_section_statements is being renamed to ldemul_after_open_output. The rationale is that the function's logic executes after the output file has been opened and its basic structure determined, but it does not actively create sections itself. This renaming aims to eliminate confusion and better align the function name with its actual behavior during the linking process, specifically in the context of target-specific linker emulation…
- ldemul
- Refers to linker emulation, which allows the linker to support various target-specific behaviors and object file formats.
- emulation template
- A file (often with a
.emextension) used in the GNU linker to define common behaviors for a family of target architectures or object file formats. - Linker
- A program that combines object files and libraries into an executable file or a shared library.
- Output file
- The final binary file (executable or shared library) produced by the linker.