ld: Unify the directory separator on Windows.
Standardizes on forward slashes for directory separators in Windows paths handled by the linker.
This patch, a spin-off from a previous discussion, unifies the directory separator character used by the ld (linker) on Windows systems to forward slashes (’/’). The author notes that Windows has good support for forward slashes in paths and that the linker has historically used them. This change aims to simplify path handling and avoid potential inconsistencies by eliminating the use of backslashes (”).
- proposer
Proposes to unify directory separators to forward slashes on Windows in the linker.
“There is no need to use backslashes on Windows, as Windows handles forward slashes in paths quite well. Moreover, the linker has been using forward slashes on Windows for a long time.”
- reviewer
Acknowledges the patch with a simple 'Okay.'
Technical Tradeoffs
- Simplifies path handling within the linker on Windows.
- Ensures consistency with common path conventions.
In Details
The linker (ld) on Windows currently handles directory paths. This patch standardizes on using forward slashes ('/') as the directory separator, consistent with how many Unix-like systems and modern Windows applications function. Previously, backslashes ('\') might have been used or handled inconsistently. This change simplifies path manipulation within ld/ldfile.c and related test cases.
- ld
- The GNU linker, responsible for combining object files and libraries into an executable or another library.
- directory separator
- The character used in file system paths to separate directory and file names (e.g., '/' on Unix-like systems, '\' on Windows).
- Windows path handling
- The mechanisms and conventions by which the Windows operating system interprets file and directory paths. Modern Windows APIs generally support both '/' and '\' as separators, but consistency is preferred.