From 0f847982468388aa05db84e8a42299b123d98dab Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Wed, 13 Nov 2024 16:41:36 +0100 Subject: [PATCH] configure: Use -ffunction-sections for PE targets. --- configure | 36 ++++++++++++++++++++++++++++++++++++ configure.ac | 1 + 2 files changed, 37 insertions(+) diff --git a/configure b/configure index bf0f6e8903b..d417dc41724 100755 --- a/configure +++ b/configure @@ -11403,6 +11403,42 @@ then : as_fn_append ${wine_arch}_EXTRACFLAGS " -Wenum-conversion" fi } ;; esac +fi } + { as_ac_var=`printf "%s\n" "ac_cv_${wine_arch}_cflags_-ffunction-sections" | sed "$as_sed_sh"` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -ffunction-sections" >&5 +printf %s "checking whether $CC supports -ffunction-sections... " >&6; } +if eval test \${$as_ac_var+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_wine_try_cflags_saved=$CFLAGS +ac_wine_try_cflags_saved_exeext=$ac_exeext +CFLAGS="$CFLAGS -nostdlib -nodefaultlibs -ffunction-sections" +ac_exeext=".exe" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +void *__os_arm64x_dispatch_ret = 0; +int __cdecl mainCRTStartup(void) { return 0; } +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + eval "$as_ac_var=yes" +else case e in #( + e) eval "$as_ac_var=no" ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +CFLAGS=$ac_wine_try_cflags_saved +ac_exeext=$ac_wine_try_cflags_saved_exeext ;; +esac +fi +eval ac_res=\$$as_ac_var + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } +if eval test \"x\$"$as_ac_var"\" = x"yes" +then : + as_fn_append ${wine_arch}_EXTRACFLAGS " -ffunction-sections" fi } { as_ac_var=`printf "%s\n" "ac_cv_${wine_arch}_cflags_-flarge-source-files -Wmisleading-indentation" | sed "$as_sed_sh"` diff --git a/configure.ac b/configure.ac index 8edfce44d6e..d82e338ae2b 100644 --- a/configure.ac +++ b/configure.ac @@ -961,6 +961,7 @@ This is an error since --enable-archs=$wine_arch was requested.])]) WINE_TRY_PE_CFLAGS([-Wlogical-op]) WINE_TRY_PE_CFLAGS([-Wabsolute-value]) WINE_TRY_PE_CFLAGS([-Wenum-enum-conversion],[:],WINE_TRY_PE_CFLAGS([-Wenum-conversion])) + WINE_TRY_PE_CFLAGS([-ffunction-sections]) dnl GCC can't handle large files when -Wmisleading-indentation is enabled (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89549) WINE_TRY_PE_CFLAGS([-flarge-source-files -Wmisleading-indentation],[AS_VAR_APPEND(${wine_arch}_EXTRACFLAGS,[" -Wno-misleading-indentation"])])