<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">Le 01/10/2021 à 20:14, Jacek Caban a
      écrit :<br>
    </div>
    <blockquote type="cite"
      cite="mid:d3d419df-d1e3-5587-ed92-bb64b17b0434@codeweavers.com">Hi
      Eric,
      <br>
      <br>
    </blockquote>
    <p>Hi Jacek, <br>
    </p>
    <p><br>
    </p>
    <p>thanks for the feedback</p>
    <p><br>
    </p>
    <p>getting back on it, I think we need to clarify the semantics
      & goals we want to achieve (I wasn't 100% clear myself), as we
      tackle different questions:</p>
    <p>- what's wine debug format by default, and how it's going to
      evolve</p>
    <p>- what flexibility is given in configuration for changing it<br>
    </p>
    <p>- what transformation logic is necessary on input parameters</p>
    <p><br>
    </p>
    <p>in the following;</p>
    <p>- when refer to items (DEBUG, CFLAGS...) related to regular
      compilation, for simplicity, it's implied that the same applies as
      well to cross compilation items (CROSSDEBUG, CROSSCFLAGS)</p>
    <p>- I let aside the choice of name between DEBUG vs DEBUGFORMAT</p>
    <p><br>
    </p>
    <p>as of today, wine's preferred debug format is "-gdwarf-2
      -gstrict-dwarf" (for both regular and cross compilation)</p>
    <p>note:</p>
    <p>- wine's preferred debug format that it is most always different
      from compiler's preferred debug format. gcc claims it's mostly
      dwarf5 on unix, (this will hold true until wine catches up on
      debug format used by default)</p>
    <p>- When enabling dwarf4, the exact format still needs from
      attention (eg: strict dwarf or not, Mac OS support to be
      clarified, see below)</p>
    <p>- as of today, the preferred debug format isn't tied to a
      compiler (it's global) (in fact we try if either option -gdwarf-2
      and -gstrict-dwarf work...)</p>
    <p>- CFLAGS defaults to -g -O2 and expects the -g to be transformed
      into wine's preferred format</p>
    - this may have to be revisited as:
    <p>    - as of today, dwarf-2 support is no longer in gcc default's
      configuration and must be explicitely enabled at configuration
      time... <br>
    </p>
    <p>    - there are cases when it's not - see for example thread on
      wine-devel on GCC11 with open suse conf where it's not, so this
      could end up as only -gstrict-dwarf -g, which will turn into
      dwarf5 :-)<br>
    </p>
    <p>    - gcc doc says that macos/darwin defaults to dwarf2. I tested
      homebrew/gcc and Xcode's clang on big sur, they both default to
      dwarf4, but I haven't tested on previous versions (may likely be
      dwarf2)<br>
    </p>
    <p><br>
    </p>
    <p>what could be done:</p>
    <p><br>
    </p>
    <p>DEBUG (when specified)<br>
    </p>
    <p>- used to choose a debug format for compiling wine</p>
    - I'd suggest a more drastic approach than what we have today: just
    append DEBUG content as it is to EXTRACFLAGS. this gives total
    flexibility on what we may want to experiment ; note: it will
    require using -gcodeview (not -gpdb nor pdb) in CROSSDEBUG<br>
    <p>- this means that no transformation logic is applied on this
      option ; this option should be for internal maintenance and
      forcing some given options</p>
    <p>- note that -g will still be present in CFLAGS, but shouldn't
      harm ; if CFLAGS has more -g* option, it may be necessary to erase
      them all<br>
    </p>
    <p><br>
    </p>
    <p>when DEBUG is not specified<br>
    </p>
    - try to elaborate debug format from CFLAGS
    <p>- several debug entries (-g*) can be present in CFLAGS</p>
    <p>- support the following transformations (it means removing all
      -g* options from CFLAGS and append to EXTRACFLAGS the result of
      their tranformation)<br>
    </p>
    <blockquote>
      <p>-g => wine's preferred debug format. (* see below)<br>
      </p>
      <p>-gdwarf => wine's preferred debug format.<br>
      </p>
      <p>-gdwarf-X => kept as is. but do we add strict dwarf or not ?
        I'd say enforce strict dwarf for dwarf2 (as we have it in
        place), and decide later on if we need it elsewhere<br>
      </p>
      <p>-gpdb => -gcodeview (synonym)<br>
      </p>
      <p>-g* => (all the other debug options) retained as is</p>
      <p><br>
      </p>
    </blockquote>
    <p>reguarding the transformation of several options, like
      CFLAGS=-gdwarf-X -g</p>
    <p>+ we need to explicit what meaning bears -g</p>
    <p>+ in gcc, it can be used either when pushing elements down the
      chain for enabling debug management, and/or to pick up default
      format when no other -g option is specified</p>
    <p>so we may have to keep the same logic:</p>
    <p>transformation of -g:</p>
    <p>- if first -g* option in CFLAGS, then transform it into wine's
      preferred debug format</p>
    <p>- if not first, keep as -g<br>
    </p>
    <br>
    <p>comments welcomed</p>
    <p><br>
    </p>
    <p>A+<br>
    </p>
    <blockquote type="cite"
      cite="mid:d3d419df-d1e3-5587-ed92-bb64b17b0434@codeweavers.com">
      <blockquote type="cite">+  AC_SUBST(DEBUGFORMAT)
        <br>
      </blockquote>
      <br>
      <br>
      AC_SUBST is not needed here, you don't use it outside configure
      script
      <br>
    </blockquote>
    I blindly copied what is done with DEBUG in configure.ac... should
    we get rid of it as well, it's not used in any of .in files ?<br>
    <br>
  </body>
</html>