[Bug binutils/31527] gdb is not working for UNC path
Kévin Le Gouguec
legouguec@adacore.com
Tue Apr 9 15:29:20 GMT 2024
Heya! Bringing this to the list, since the PR in the subject line is
marked "RESOLVED". Let me know if there is a better way to follow-up.
In a nutshell, since:
2024-04-05 "Add support for Windows network paths to the UNC support
in _bfd_real_open()." (eac88f32984)
Building GDB on Windows fails at link-time with:
[…]x86_64-w64-mingw32/bin/ld.exe: ../bfd/.libs/libbfd.a(bfdio.o):bfdio.c:(.text+0x30b): undefined reference to `__imp_PathIsNetworkPathA'
collect2.exe: error: ld returned 1 exit status
AFAIU this depends on the specifics of the Python configuration picked
up by the configurey; see Simon's analysis and suggested solutions
below.
"simon.cook at embecosm dot com" <sourceware-bugzilla@sourceware.org>
writes:
> https://sourceware.org/bugzilla/show_bug.cgi?id=31527
>
> --- Comment #8 from Simon Cook <simon.cook at embecosm dot com> ---
> The definition is there (I have the header file), this was a linking issue (and
> to confirm we are using the same tools to build).
>
> I've looked through the Makefile/config.status files for my build, and what
> seems to be going on is you're able to build GDB because you're building
> against the python in that environment, and that requires pulling in the
> shlwapi library:
>
> S["PYTHON_LIBS"]="-lpython3.11 -lversion -lshlwapi -lpathcch -lbcrypt -lm
> -Wl,--stack,2000000"
>
> If I configure GDB without python support, then like gas and binutils the
> __imp_PathIsNetworkPathA symbol is not found.
>
> In order to resolve the link issue, I think there are a couple of solutions.
>
> 1. Always link anything using libbfd against shlwapi - that feels a bit
> intrusive for one small change?
> 2. Implement an alternative to using PathIsNetworkPathA. From its description,
> I think it might be possible to substitute that call for something like
> `is_network_path = strncmp(filename, "//", 2) == 0 || strncmp(filename, "\\\\",
> 2) == 0` since I think that's the behaviour we actually care about.
>
> Any thoughts?
More information about the Binutils
mailing list