Re: [PATCH] ld: testsuite: Fix a few backslash-related issues on MinGW.

Jan Dubiec <[email protected]> Fri, 17 Jul 2026 14:16:33 +0200
Newsgroups gmane.comp.gnu.binutils
Message-ID <[email protected]>
On 17.07.2026 13:35, Maciej W. Rozycki wrote:
[...]

>   Seconded: what's the root cause, i.e. where does the backslash exactly
> come from?
 From the linker. It is invoked as follows:
/d/Works/xcomp/build-binutils-h8300-mingw/ld/ld-new    -o tmpdir/absc 
-L/d/Works/binutils/ld/testsuite/ld-archive -e ff tmpdir/abc.o 
/d/Works/binutils/ld/testsuite/ld-archive/ab.t --verbose --print-map

For each library listed in ld/testsuite/ld-archive/ab.t, the linker 
takes the library name, prepends the library search path specified with 
the -L option, inserting a "\" between them, and then attempts to open 
the resulting file. If that fails, it falls back to using the relative 
file name instead. It's all in the log:

[...]
D:\Works\xcomp\build-binutils-h8300-mingw\ld\ld-new.exe: mode h8300helf
attempt to open tmpdir/abc.o succeeded
tmpdir/abc.o
attempt to open D:/Works/binutils/ld/testsuite/ld-archive/ab.t succeeded
D:/Works/binutils/ld/testsuite/ld-archive/ab.t
opened script file D:/Works/binutils/ld/testsuite/ld-archive/ab.t
attempt to open D:/Works/binutils/ld/testsuite/ld-archive\tmpdir/a.o failed
attempt to open tmpdir/a.o succeeded
attempt to open D:/Works/binutils/ld/testsuite/ld-archive\tmpdir/b.o failed
attempt to open tmpdir/b.o succeeded
attempt to open D:/Works/binutils/ld/testsuite/ld-archive\tmpdir/x.o failed
attempt to open tmpdir/x.o succeeded
[...]

/J.D.