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(a)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,"")
GNU dlltool outputs the DELAY_IMPORT_DESCRIPTOR of delay import libs in
a .text$2 section, which is then merged into .text and changes its flags
to add the DATA flag.
This is incorrect and breaks some DRMs, which are then validating that
.text sections doesn't have the IMAGE_SCN_CNT_INITIALIZED_DATA flag set.
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com>
---
This is actually more some kind of RFC, as I'm not sure at all what this
change really implies and why the descriptor has to be in .text in the
first place. It seems like some GNU specific thing, as it seems from
internet comments that MSVC places the descriptor in .data section?
As far as I could test, this works fine and removes the incorrect
IMAGE_SCN_CNT_INITIALIZED_DATA flag from .text section of DLLs with
delay imports. Also, changing instead the .text$2 section flags to mark
it as code instead doesn't work.
In Proton we have some post-processing step to remove that flag, and I
think it was required by Forza Horizon 4 DRM.
tools/winebuild/import.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/tools/winebuild/import.c b/tools/winebuild/import.c
index bba87b1e02c..1a7b59e6678 100644
--- a/tools/winebuild/import.c
+++ b/tools/winebuild/import.c
@@ -1665,6 +1665,15 @@ static void build_windows_import_lib( const char *lib_name, DLLSPEC *spec )
}
spawn( args );
+
+ if (strendswith( lib_name, ".delay.a" ))
+ {
+ args = find_tool( "objcopy", NULL );
+ strarray_add( &args, "--rename-section" );
+ strarray_add( &args, ".text$2=.data$2" );
+ strarray_add( &args, lib_name );
+ spawn( args );
+ }
}
/* create a Unix-style import library */
--
2.33.0