Skip to content

Commit

Permalink
Use DWARF 4 debug information when building using mingw
Browse files Browse the repository at this point in the history
See this bug for more information:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101377

Fixes #6139

(cherry picked from commit f18fae4)
  • Loading branch information
slouken committed Oct 4, 2022
1 parent 3652437 commit a1d1946
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
36 changes: 36 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -22773,6 +22773,41 @@ printf "%s\n" "$have_clang_objc_arc" >&6; }
fi
}

CheckGDwarf4()
{
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -gdwarf-4 option" >&5
printf %s "checking for GCC -gdwarf-4 option... " >&6; }
have_gcc_gdwarf4=no

save_CFLAGS="$CFLAGS"
CFLAGS="$save_CFLAGS -gdwarf-4"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */

int x = 0;

int
main (void)
{

;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
have_gcc_gdwarf4=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_gdwarf4" >&5
printf "%s\n" "$have_gcc_gdwarf4" >&6; }
CFLAGS="$save_CFLAGS"

if test x$have_gcc_gdwarf4 = xyes; then
EXTRA_CFLAGS="$EXTRA_CFLAGS -gdwarf-4"
fi
}

CheckVisibilityHidden()
{
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -fvisibility=hidden option" >&5
Expand Down Expand Up @@ -28502,6 +28537,7 @@ printf "%s\n" "#define SDL_TIMER_UNIX 1" >>confdefs.h
if test x$enable_loadso = xyes; then
have_loadso=yes
fi
CheckGDwarf4
CheckDeclarationAfterStatement
CheckDummyVideo
CheckOffscreenVideo
Expand Down
21 changes: 21 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1515,6 +1515,26 @@ CheckObjectiveCARC()
fi
}

dnl See if GCC's -gdwarf-4 is supported
dnl See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101377 for why this is needed on Windows
CheckGDwarf4()
{
AC_MSG_CHECKING(for GCC -gdwarf-4 option)
have_gcc_gdwarf4=no

save_CFLAGS="$CFLAGS"
CFLAGS="$save_CFLAGS -gdwarf-4"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
int x = 0;
]],[])], [have_gcc_gdwarf4=yes],[])
AC_MSG_RESULT($have_gcc_gdwarf4)
CFLAGS="$save_CFLAGS"

if test x$have_gcc_gdwarf4 = xyes; then
EXTRA_CFLAGS="$EXTRA_CFLAGS -gdwarf-4"
fi
}

dnl See if GCC's -fvisibility=hidden is supported (gcc4 and later, usually).
dnl Details of this flag are here: http://gcc.gnu.org/wiki/Visibility
CheckVisibilityHidden()
Expand Down Expand Up @@ -3968,6 +3988,7 @@ case "$host" in
if test x$enable_loadso = xyes; then
have_loadso=yes
fi
CheckGDwarf4
CheckDeclarationAfterStatement
CheckDummyVideo
CheckOffscreenVideo
Expand Down

0 comments on commit a1d1946

Please sign in to comment.