any news on this one ?
TIA
A+

On Mon, 4 Oct 2021 at 18:37, Eric Pouech <eric.pouech@gmail.com> wrote:
usage: configure CFLAGS="-gdwarf-4 -O2" will enable dwarf4 compilation
for ELF parts (and CROSSCFLAGS="-gdwarf-4 -O2" for PE parts)

evolution from current behavior:
- when CFLAGS contains "-gdwarf-X", -gdwarf-X option is not tested with
  WINE_TRY_CFLAGS (the option remains anyway in CFLAGS -so WINE_TRY is
  useless- and is not copied in EXTRACFLAGS) (ditto for CROSSCFLAGS)
- using CROSSCFLAGS=-gdwarf is no longer converted to Wine's preferred
  format, but is kepts as is, hence will boil down to compiler's
  preferred dwarf version

what remains undone (and could be improved):
- no test that the final configuration is suitable for Wine (ie
  if WINE_TRY_CFLAGS fails on -gdwarf-2, compilation is done with
  compilers's default format => dwarf5 on Linux)
- using CROSSDEBUG=dwarf-split will compile in dwarf-2, while
  CROSSDEBUG=split will compile in compiler's default (likely dwarf-5
  currently)

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>

---
 configure.ac |   24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/configure.ac b/configure.ac
index 913692c828a..e0ec8fd17d3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1024,21 +1024,26 @@ then

         dnl Determine debug info format
         AC_SUBST(CROSSDEBUG)
+        ac_debug_format_seen=
         if test -z "$CROSSDEBUG"
         then
           for ac_flag in $CROSSCFLAGS; do
             case $ac_flag in
-             -gdwarf*)    CROSSDEBUG=dwarf ;;
+             -gdwarf-*)   ac_debug_format_seen=yes ;;
+             -g)          ac_debug_format_seen=${ac_debug_format_seen:-default} ;;
              -gcodeview)  CROSSDEBUG=pdb ;;
-             -g)          CROSSDEBUG=${CROSSDEBUG:-dwarf} ;;
             esac
           done
         fi
         case $CROSSDEBUG in
-          *dwarf)  WINE_TRY_CROSSCFLAGS([-gdwarf-2])
-                   WINE_TRY_CROSSCFLAGS([-gstrict-dwarf]) ;;
+          *dwarf)  ac_debug_format_seen=default ;;
           pdb)     WINE_TRY_CROSSCFLAGS([-gcodeview]) ;;
         esac
+        if test "x$ac_debug_format_seen" = "xdefault"
+        then
+          WINE_TRY_CROSSCFLAGS([-gdwarf-2])
+          WINE_TRY_CROSSCFLAGS([-gstrict-dwarf])
+        fi

         WINE_TRY_CROSSCFLAGS([-fexcess-precision=standard],[AC_SUBST(EXCESS_PRECISION_CFLAGS,"-fexcess-precision=standard")])

@@ -2031,13 +2036,18 @@ char*f(const char *h,char n) {return strchr(h,n);}]])],[ac_cv_c_logicalop_noisy=
       *) EXTRACFLAGS="$EXTRACFLAGS $wine_cv_64bit_compare_swap" ;;
   esac

-  dnl Default to dwarf-2 debug info
+  dnl Determine debug info format
+  ac_debug_format_seen=
   for ac_flag in $CFLAGS; do
     case $ac_flag in
-      -g) WINE_TRY_CFLAGS([-gdwarf-2])
-          WINE_TRY_CFLAGS([-gstrict-dwarf]) ;;
+      -gdwarf-*)   ac_debug_format_seen=yes ;;
+      -g)          ac_debug_format_seen=${ac_debug_format_seen:-default} ;;
     esac
   done
+  if test "x$ac_debug_format_seen" = "xdefault"; then
+    WINE_TRY_CFLAGS([-gdwarf-2])
+    WINE_TRY_CFLAGS([-gstrict-dwarf])
+  fi

   dnl Disable gcc builtins except for Mingw
   AC_SUBST(MSVCRTFLAGS,"")



--
--
Eric Pouech