public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Jon Turney <jon.turney@dronecode.org.uk>
To: The Cygwin Mailing List <cygwin@cygwin.com>
Subject: Re: Defective "portable executables" distributed/created by Cygwin
Date: Thu, 10 May 2018 21:46:00 -0000	[thread overview]
Message-ID: <149505a0-1221-15e4-95e1-9e7e5e1fc236@dronecode.org.uk> (raw)
In-Reply-To: <ffc2e119-8af9-2d92-4639-cc1e325f719e@gmail.com>

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

      reply	other threads:[~2018-05-10 21:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-10 20:29 Stefan Kanthak
2018-05-10 20:29 ` Steve Carroll (VISUAL STUDIO) via cygwin
2018-05-10 21:27   ` Ten Tzen via cygwin
2018-05-10 23:34     ` YongKang Zhu via cygwin
2018-05-11  0:16       ` Stefan Kanthak
2018-05-10 21:26 ` Marco Atzeri
2018-05-10 21:46   ` Jon Turney [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=149505a0-1221-15e4-95e1-9e7e5e1fc236@dronecode.org.uk \
    --to=jon.turney@dronecode.org.uk \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).