public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* G++ creates unusable executable with -gdwarf-5 -Og, without any diagnostic issued
@ 2020-03-26  8:40 Tim Van Holder
  0 siblings, 0 replies; only message in thread
From: Tim Van Holder @ 2020-03-26  8:40 UTC (permalink / raw)
  To: cygwin

Relevant package versions (all the current latest):


  *   Cygwin: 3.1.4
  *   binutils: 2.43+1git.de9c1b7cfe-1
  *   gcc-core, gcc-g++, libgcc1, libstdc++6: 9.3.0-1

Sample program (foo.cc):

#include <iostream>

using namespace std;

int
main(void)
{
  cout << "OK" << endl;
  return 0;
}

With a plain g++ foo.cc -o foo, I get a foo.exe that prints "OK".

However, with g++ -gdwarf-5 -Og foo.cc -o foo, I get a binary that reports
 -bash: ./foo.exe: cannot execute binary file: Exec format error
when run.
GDB can load the binary and show symbols just fine, but trying to run results in:
  Error creating process /cygdrive/.../foo.exe, (error 193).

Using -gdwarf-4 instead of -gdwarf-5 or dropping -Og makes the problem go away.
It also seems to be c++-specific; a C version of the sample program resulted in a working program
(could just be because a C++ program with iostream pulls in more, triggering the issue).

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-03-26  8:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-26  8:40 G++ creates unusable executable with -gdwarf-5 -Og, without any diagnostic issued Tim Van Holder

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).