delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2019/07/10/18:56:02

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:from:subject:reply-to:to:references:message-id
:date:mime-version:in-reply-to:content-type; q=dns; s=default; b=
BHmQXBvOHQrwGBJhv0cQ8nW2j2Dx+7PYXxSMTQC4MlYt4o41wZRNabf+PRw4sQO1
9nkPU5kSADgVMBatGEnrIqtx1+A13Y6prvqW9nY3duYyYfqtFIy6U3vLBdbEYOHb
KDyLeiqYw6RL3DzSYR1cKXw1VUoFY23MW1s080Lg/2Q=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:from:subject:reply-to:to:references:message-id
:date:mime-version:in-reply-to:content-type; s=default; bh=LQ5VL
+otcZUhnjRIhsH5dtOQFGE=; b=QrbcigpibmSV5AmNeAAyaw4ahopBpP2E6x3Z0
GXOboi0xda0QnjE56+iMeF7tuwEd0UP6gsKEVuISNn++9Acn5AtWXvNE1acsBQRJ
OBE9tUQK+PeYPp4hs8yV/7WlEkhM6y8WMb+DZ29/GfiDFMD36ukhGByC4iNLAafa
foh6Lw=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-5.0 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=proprietary, spread
X-HELO: smtp-out-no.shaw.ca
From: Brian Inglis <Brian DOT Inglis AT SystematicSw DOT ab DOT ca>
Subject: Re: Question about the ldd output
Reply-To: Brian DOT Inglis AT SystematicSw DOT ab DOT ca
To: cygwin AT cygwin DOT com
References: <BN6PR09MB2227BA2644949DB75A67A6B2A5F60 AT BN6PR09MB2227 DOT namprd09 DOT prod DOT outlook DOT com> <ee7608a2-2e13-d2eb-6410-c07362d75296 AT SystematicSw DOT ab DOT ca> <e0e8c9db-bd7a-638c-0bb5-88c43c5f9d98 AT dronecode DOT org DOT uk>
Openpgp: preference=signencrypt
Message-ID: <8841099f-6294-4aa7-9615-b42eda332573@SystematicSw.ab.ca>
Date: Wed, 10 Jul 2019 16:55:04 -0600
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0
MIME-Version: 1.0
In-Reply-To: <e0e8c9db-bd7a-638c-0bb5-88c43c5f9d98@dronecode.org.uk>
X-IsSubscribed: yes

--------------817BE2C1142F03618BE050CC
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

On 2019-07-09 12:02, Jon Turney wrote:
> On 09/07/2019 17:40, Brian Inglis wrote:
>> On 2019-07-08 12:00, Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin wrote:
>>> Well, I don't think there's anything special that Cygwin does to load
>>> executables, because these are essentially Windows processes, so they are
>>> loaded by Windows, first and foremost.
>>>
>>> But it gets even weirder.  Below are two _consecutive!_ runs of ldd on the
>>> very same executable.  Why the output differs so drastically (including the
>>> unknown dlls all of a sudden)?
> 
> This is probably a 'bug'.
> 
>> Libraries may be loaded asynchronously as they are accessed, and ldd just dumps
>> the dll import table once the subprocess is ready to run.
>> Perhaps these are import entries that ldd should detect and skip or annotate in
>> some more useful way.
> 
> Please don't spread misinformation based upon guessing how Cygwin's ldd works.

The ldd(1) man page documents how it works, and how to get dll info is
documented: the guesses are about how and with what Windows populates the
dll import table, and how ldd may misinterpret it: a slightly more informative
version of "This is probably a 'bug'" ;^>

> It's not necessary, as the source code is available [1] :)
> [1]
> https://cygwin.com/git/gitweb.cgi?p=newlib-cygwin.git;a=history;f=winsup/utils/ldd.cc

Uncommented, undocumented source code with mainly Windows calls is no help to
most of us with little background in Windows development.

David Macek did some debugging and suggested a patch to ignore threads with
entry points in ntdll.dll, but I could not see any followup, response, or
similar patch in the commits or source:
"Re: Why does ldd not show cyg*.dll in its output?"
https://sourceware.org/ml/cygwin/2016-06/msg00478.html

Based on what I see and PE format docs, ldd should iterate over all the
entries in the dll import directory table, until the end or an all zeros/nulls
entry is reached, and the name pointers should all be 32 bit image base relative
addresses, but they are being handled as section relative addresses in
dump_import_directory(), which might amount to the same thing here.

The attached shows the opinions of ldd, cygcheck, and SysInternals listdlls64
run against "$ yes > /dev/null &" process, so a comparison of the first two
might help, but the latter is proprietary closed source and the process is
executing, so may show dlls dynamically loaded by other Windows dlls.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.

--------------817BE2C1142F03618BE050CC
Content-Type: text/plain; charset=UTF-8;
 name="y.txt"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename="y.txt"

JCBsZGQgL2Jpbi95ZXMKCW50ZGxsLmRsbCA9PiAvcHJvYy9jeWdkcml2ZS9j
L1dJTkRPV1MvU1lTVEVNMzIvbnRkbGwuZGxsICgweDdmZjg4ZTdhMDAwMCkK
CUtFUk5FTDMyLkRMTCA9PiAvcHJvYy9jeWdkcml2ZS9jL1dJTkRPV1MvU3lz
dGVtMzIvS0VSTkVMMzIuRExMICgweDdmZjg4YmEzMDAwMCkKCUtFUk5FTEJB
U0UuZGxsID0+IC9wcm9jL2N5Z2RyaXZlL2MvV0lORE9XUy9TeXN0ZW0zMi9L
RVJORUxCQVNFLmRsbCAoMHg3ZmY4OGIyZTAwMDApCgljeWd3aW4xL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MDAgICBDOlxXSU5ET1dTXFN5
c3RlbTMyXG1zdmNydC5kbGwKMHgwMDAwMDAwMDhjMjUwMDAwICAweDllMDAw
ICAgQzpcV0lORE9XU1xTeXN0ZW0zMlxzZWNob3N0LmRsbAoweDAwMDAwMDAw
OGQ5YTAwMDAgIDB4MTIyMDAwICBDOlxXSU5ET1dTXFN5c3RlbTMyXFJQQ1JU
NC5kbGwKMHgwMDAwMDAwMDhhMTkwMDAwICAweGMwMDAgICAgQzpcV0lORE9X
U1xTWVNURU0zMlxDUllQVEJBU0UuRExMCjB4MDAwMDAwMDA4YjY4MDAwMCAg
MHg3ZTAwMCAgIEM6XFdJTkRPV1NcU3lzdGVtMzJcYmNyeXB0UHJpbWl0aXZl
cy5kbGwKCg==


--------------817BE2C1142F03618BE050CC
Content-Type: text/plain; charset=us-ascii


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
--------------817BE2C1142F03618BE050CC--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019