From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9730 invoked by alias); 10 May 2018 21:27:57 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 9721 invoked by uid 89); 10 May 2018 21:27:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=H*r:sk:mail.me, viewers, dwarf2, images X-HELO: out1-smtp.messagingengine.com Received: from out1-smtp.messagingengine.com (HELO out1-smtp.messagingengine.com) (66.111.4.25) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 10 May 2018 21:27:55 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 0C2362255B for ; Thu, 10 May 2018 17:27:54 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Thu, 10 May 2018 17:27:54 -0400 X-ME-Sender: Received: from [192.168.1.102] (host86-160-189-108.range86-160.btcentralplus.com [86.160.189.108]) by mail.messagingengine.com (Postfix) with ESMTPA id 88C4810261 for ; Thu, 10 May 2018 17:27:53 -0400 (EDT) Subject: Re: Defective "portable executables" distributed/created by Cygwin To: The Cygwin Mailing List References: <1F441795A2584E7684AEFE3C6038B78E@W340> From: Jon Turney Message-ID: <149505a0-1221-15e4-95e1-9e7e5e1fc236@dronecode.org.uk> Date: Thu, 10 May 2018 21:46:00 -0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-SW-Source: 2018-05/txt/msg00133.txt.bz2 On 10/05/2018 21:29, Marco Atzeri wrote: > On 5/10/2018 8:30 PM, Stefan Kanthak wrote: >> Hi @ll, >> >> the "portable executables" distributed by Cygwin (and of course those >> created with Cygwin's GCC toolchain too) have INVALID/ILLEGAL headers: >> >> 0. Microsoft's DUMPBIN.EXE alias LINK.EXE /DUMP aborts with >>     "access violation" (see below) on almost all Cygwin binaries! > > A program should never fail in such way. It seems the program is NOT > validating properly its input and it is probably expecting the > organization of the data as used by Microsoft Visual Studio 2010. > As it fails probably you can not fully trust its output > for program built from other compilers. > > >> 1. they use INVALID/ILLEGAL section names like "/4" or "/14", upon >>     which Microsoft's DUMPBIN.EXE alias LINK.EXE /DUMP stops enumerating >>     the section headers (see below)! > > It seems Cygwin tools disagree with such interpretation This deviation is deliberate, and is discussed in the ld manpage for the option which controls it: --enable-long-section-names --disable-long-section-names The PE variants of the COFF object format add an extension that permits the use of section names longer than eight characters, the normal limit for COFF. By default, these names are only allowed in object files, as fully-linked executable images do not carry the COFF string table required to support the longer names. As a GNU extension, it is possible to allow their use in executable images as well, or to (probably pointlessly!) disallow it in object files, by using these two options. Executable images generated with these long section names are slightly non-standard, carrying as they do a string table, and may generate confusing output when examined with non-GNU PE-aware tools, such as file viewers and dumpers. However, GDB relies on the use of PE long section names to find Dwarf-2 debug information sections in an executable image at runtime, and so if neither option is specified on the command- line, ld will enable long section names, overriding the default and technically correct behaviour, when it finds the presence of debug information while linking an executable image and not stripping symbols. [This option is valid for all PE targeted ports of the linker] -- 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