Cygwin libtool confused about link library

Simon Marchi simon.marchi@efficios.com
Mon Mar 9 21:01:50 GMT 2020


> Hello libtool folks,
> Any ideas about this? Something confused the file magic command?
> dlltool --identify does show libdl.a is associated with cygwin1.dll for
> example.

Hi,

I stumbled on this and dug into libtool, here's what I found.

As part of the process of identifying the nature these libraries, libtool uses
this nm + sed snippet [1]:

	win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
	  $SED -n -e '
	    1,100{
		/ I /{
		    s|.*|import|
		    p
		    q
		}
	    }'`
	;;

The sed scripts looks for a line containing the " I " string.

With binutils < 2.34, the nm output looked like:

  /usr/lib/libdl.a[d000000.o]: libdl_dll_iname I 0000000000000000

With binutils 2.34, the corresponding line is:

  /usr/lib/libdl.a[d000000.o]: libdl_dll_iname D 0

And therefore the library is mis-identified.

The commit that introduced this regression is:

  commit a288c270991de1578ad28ac312120f4167347234
  Author: Alan Modra <amodra@gmail.com>
  Date:   Fri May 3 21:36:46 2019 +0930

      PR24511, nm should not mark symbols in .init_array as "t"

I tried building the latest commit on the binutils-2_34-branch, and the behavior
has been restored (the line shows " I " again).  The commit that restored the
behavior is:

  commit 40bfb9762747f8336b17c70a0173d10200fa62eb
  Author: Alan Modra <amodra@gmail.com>
  Date:   Thu Feb 27 17:28:47 2020 +1030

      Re: PR24511, nm should not mark symbols in .init_array as "t"

So this should all go back to normal when there is a binutils 2.34.1 release and it is
packaged by Cygwin.  In the mean time, the commit that restored the behavior could maybe
be backported in the Cygwin package, but I don't know what the habits are in Cygwin for
this kind of thing.

Simon

[1] https://github.com/autotools-mirror/libtool/blob/b9b44533fbf7c7752ffd255c3d09cc360e24183b/build-aux/ltmain.in#L3050-L3059



More information about the Cygwin mailing list