X-Recipient: archive-cygwin@delorie.com
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com A09F7269641
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com;
 s=default; t=1583787710;
 bh=sLJHVWN/rRhJ9oJAiRnrVYVoMoEV07xMsg2MhxqKZJ4=;
 h=To:From:Message-ID:Date:MIME-Version;
 b=tdtQgcFAo2zYzafppLC3WHgonQMoAPF3JJQug9bEkqwJZdJY/ShFkLXeF5DxwRTph
 AP0fiYdY9canFPvdC82+Ns11SYv4iM+3hi/E9S5wZerDT5itZAUWDgslo6lM0gAcur
 cnpbHrzXAdatmuYMQt1D7pLEuu5qRLs5dOXAg44m4KnFBu4x6BwnWhmATHDcHJ7XBZ
 kykzTdDUBEp8beSYzlZ+lekuhMZfuyKOEUlbNKiy2BW+knoWn/bmv8n+vj2R4rXn6o
 06/FDDeCW9mDoGzySP712vtgS0zFsKaBGRz7u4P4vwxHw93SNRdLN9a2QfjoH/blfh
 r8EfrizxUqKAQ==
X-Virus-Scanned: amavisd-new at efficios.com
To: 10walls@gmail.com
References: <1adb66fe-fa05-225c-6996-7b9ba8f2a90b@gmail.com>
Subject: Re: Cygwin libtool confused about link library
In-Reply-To: <1adb66fe-fa05-225c-6996-7b9ba8f2a90b@gmail.com>
From: Simon Marchi <simon.marchi@efficios.com>
Message-ID: <7266f738-eddd-14b2-9908-846faa76290d@efficios.com>
Date: Mon, 9 Mar 2020 17:01:50 -0400
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
 Thunderbird/68.4.1
MIME-Version: 1.0
Content-Language: tl
X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00, DKIM_SIGNED,
 DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, SPF_HELO_NONE,
 SPF_PASS autolearn=ham autolearn_force=no version=3.4.2
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on
 server2.sourceware.org
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Cygwin mailing list <cygwin.cygwin.com>
List-Unsubscribe: <http://cygwin.com/mailman/options/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=unsubscribe>
List-Archive: <http://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <http://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
Cc: cygwin@cygwin.com
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cygwin-bounces@cygwin.com
Sender: "Cygwin" <cygwin-bounces@cygwin.com>

> 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
"--Problem reports:       http://cygwin.com/problems.htmlFAQ:                   http://cygwin.com/faq/Documentation:         http://cygwin.com/docs.htmlUnsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple"
