Defaulting to stabs debug output from AS Cygwin64

Hans-Bernhard Bröker
Tue May 15 21:18:00 GMT 2018

Am 15.05.2018 um 19:17 schrieb Michael Enright:

> The GCC driver uses -gdwarf2 if you do 'gcc -g' on a .s file. Using
> -gdwarf2 with assembly code manually or through gcc is successful in
> producing a Cygwin64 executable that Cygwin64 GDB can work with. This
> combination of circumstances led me to wonder how stabs was chosen for
> Cygwin64.

Basically because it was not chosen.  It's not even actually supported, 
as evidenced by those relocation failures: not how those occurred in the 
.stab section.

"The" default of Cygwin is whatever the compiler uses, i.e. Dwarf2, and 
was indeed chosen, because none of the older formats stand a chance of 
really handling the amount and complexity of debug information needed 
for modern-day C++.

On to of that, making '-gdwarf-2' the default -g mode for 'as' would be 
an exercise in futility anyway, because that option is essentially a 
no-op.  That's because Dwarf-2 debug information is _not_ actually 
created by the -g flag to begin with: it's spelled out by the compiler 
as reams of data and reloc statements, to go into specially named 
sections like '.debug_info'.  GCC doesn't even pass any '-g' flag to the 
assembler in its default -gdwarf-2 mode.

It makes sense that "as -g" equals "as -gstabs" because unlike the other 
ones, that one at least does something: it causes .def pseudo-ops to put 
data into the .stab section, which also is automatically created by that 

In a nutshell: you don't want to use either of "as -g" or "as -gstabs"

Problem reports:
Unsubscribe info:

More information about the Cygwin mailing list