Re: [PATCH] ld: Unify the directory separator on Windows.

Jan Beulich <[email protected]> Mon, 27 Jul 2026 08:20:27 +0200
Newsgroups gmane.comp.gnu.binutils
Message-ID <[email protected]>
On 25.07.2026 01:30, Jan Dubiec wrote:
> On 24.07.2026 08:48, Jan Beulich wrote:
>> On 22.07.2026 10:42, Jan Dubiec wrote:
>>> This patch is a spin-off of the following discussion:
>>> https://inbox.sourceware.org/binutils/[email protected]/
>>>
>>> When the linker searches for a file, it constructs the full file name by
>>> concatenating the search path, the directory separator, and the file name.
>>> As a result, on Windows users may encounter paths like this:
>>>
>>> [...]
>>> attempt to open D:/Works/binutils/ld/testsuite/ld-archive\tmpdir/a.o failed
>>> [...]
>>>
>>> or even like this:
>>>
>>> [...]
>>> D:\Works\xcomp\build-binutils-h8300-mingw\ld\ld-new.exe: cannot open linker script file D:/Works/binutils/ld/testsuite/ld-scripts\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\././././.\./././././/libpr33265-2.a: No such file or directory
>>> [...]
>>>
>>> This is a safe change, as the linker has been using forward slashes on
>>> Windows for a long time,
>>
>> I'd like to have evidence of this.
> 
> Isn't the absence of any regressions sufficient evidence? There's also a 
> simple logical argument: as you noted in another thread, "Clearly, with 
> the many slashes in the paths that you quoted, one more slash won't 
> break things".

My earlier reply looks to have been ambiguous: I was asking for evidence of
ld using slashes. And ...

>> In an earlier discussion ("ld: Skip
>> p33265-2 and pr33265-2 tests on Windows") you pointed at a piece of code
>> in the testsuite, which doesn't qualify as reference here. Is there any
>> path handling which indeed inserts slashes unconditionally (rather than
>> properly using ...
> 
> Sorry, I don't follow. The thread "ld: Skip p33265-2 and pr33265-2 tests 
> on Windows" is about a completely different issue — the MAX_PATH 
> limitation on Windows. The thread "ld: testsuite: Fix a few 
> backslash-related issues on MinGW", on the other hand, deals with 
> problems in three specific test cases caused by incomplete regular 
> expressions. The two issues are completely unrelated.

... I was trying to express that uses in the testsuite aren't a suitable
reference. 

Jan