From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id D40613871029 for ; Mon, 16 Mar 2020 21:01:03 +0000 (GMT) Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 02GL0tUt024641 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 16 Mar 2020 17:01:00 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 02GL0tUt024641 Received: from [10.0.0.11] (unknown [192.222.164.54]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 5F9C21E5FD; Mon, 16 Mar 2020 17:00:55 -0400 (EDT) Subject: Re: [PATCH 6/7] gdb: select "Cygwin" OS ABI for Cygwin binaries To: Jon Turney Cc: gdb-patches@sourceware.org References: <20200316170845.184386-1-simon.marchi@polymtl.ca> <20200316170845.184386-7-simon.marchi@polymtl.ca> From: Simon Marchi Message-ID: Date: Mon, 16 Mar 2020 17:00:54 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US-large Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Mon, 16 Mar 2020 21:00:55 +0000 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, 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: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Mar 2020 21:01:04 -0000 On 2020-03-16 3:03 p.m., Jon Turney wrote: >> +bool >> +is_linked_with_cygwin_dll (bfd *abfd) >> +{ >> + /* The list of DLLs a PE is linked to is in the .idata section. See: >> + >> + https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#the-idata-section >> + */ >> + asection *idata_section = bfd_get_section_by_name (abfd, ".idata"); >> + if (idata_section == nullptr) >> + return false; > > I'm fine with this as-is, but FTR I think this only happens to work > because binutils ld (which is probably the only way to currently build a > cygwin executable) puts the import table in the .idata section. > > The strictly correct way to locate the import table is to use the data > directory (as pe_print_idata() does) > > (See > https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#optional-header-data-directories-image-only) > > (Notwithstanding the MS documentation you linked, I believe MS tools can > put the import table in .rdata) > After clarification with Jon on IRC, the current code is sufficient for the moment. I've pushed the series, thanks. Simon