From f2b844307d84d34a65c8e527ff9b94bc0d7972bb Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 25 May 2025 02:25:59 +0200 Subject: [PATCH] Fix test for .symver asm directive support in configure We need to use it with the correct, i.e. existing, symbol name, which means the mangled name actually used by the linker and not just the name of the function as it appears in the source. Fix the test to actually detect lack of support for .symver when using clang with -flto. Closes #25438. --- configure | 38 +++++++++++++++++++++++++++++++++----- configure.in | 14 +++++++++++--- docs/changes.txt | 1 + 3 files changed, 45 insertions(+), 8 deletions(-) diff --git a/configure b/configure index 57a04db1f8..ff442b5c9f 100755 --- a/configure +++ b/configure @@ -33873,18 +33873,26 @@ if ${wx_cv_elf_symver_multiple+:} false; then : else echo "lib_new {}; lib_old { *; };" >conftest.sym + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include "wx/private/elfversion.h" - wxELF_SYMVER("foo","foo@lib_old") - wxELF_SYMVER("foo","foo@@lib_new") + extern "C" { + wxELF_SYMVER("_foo","_foo@lib_old") + wxELF_SYMVER("_foo","_foo@@lib_new") void foo() {} + } int main() { return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_cxx_try_link "$LINENO"; then : wx_cv_elf_symver_multiple=yes else wx_cv_elf_symver_multiple=no @@ -33892,6 +33900,12 @@ else fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + rm -f conftest.sym @@ -33909,17 +33923,25 @@ if ${wx_cv_elf_symver+:} false; then : else echo "lib_new {}; lib_old { *; };" >conftest.sym + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include "wx/private/elfversion.h" - wxELF_SYMVER("foo","foo@@lib_new") + extern "C" { + wxELF_SYMVER("_foo","_foo@@lib_new") void foo() {} + } int main() { return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_cxx_try_link "$LINENO"; then : wx_cv_elf_symver=yes else wx_cv_elf_symver=no @@ -33927,6 +33949,12 @@ else fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + rm -f conftest.sym diff --git a/configure.in b/configure.in index 610a440a0c..9e119382a8 100644 --- a/configure.in +++ b/configure.in @@ -4025,17 +4025,21 @@ if test "$wxUSE_SHARED" = "yes"; then wx_cv_elf_symver_multiple, [ echo "lib_new {}; lib_old { *; };" >conftest.sym + AC_LANG_PUSH(C++) AC_LINK_IFELSE([ AC_LANG_SOURCE([ #include "wx/private/elfversion.h" - wxELF_SYMVER("foo","foo@lib_old") - wxELF_SYMVER("foo","foo@@lib_new") + extern "C" { + wxELF_SYMVER("_foo","_foo@lib_old") + wxELF_SYMVER("_foo","_foo@@lib_new") void foo() {} + } int main() { return 0; } ])], wx_cv_elf_symver_multiple=yes, wx_cv_elf_symver_multiple=no ) + AC_LANG_POP() rm -f conftest.sym ] ) @@ -4047,16 +4051,20 @@ if test "$wxUSE_SHARED" = "yes"; then wx_cv_elf_symver, [ echo "lib_new {}; lib_old { *; };" >conftest.sym + AC_LANG_PUSH(C++) AC_LINK_IFELSE([ AC_LANG_SOURCE([ #include "wx/private/elfversion.h" - wxELF_SYMVER("foo","foo@@lib_new") + extern "C" { + wxELF_SYMVER("_foo","_foo@@lib_new") void foo() {} + } int main() { return 0; } ])], wx_cv_elf_symver=yes, wx_cv_elf_symver=no ) + AC_LANG_POP() rm -f conftest.sym ] ) diff --git a/docs/changes.txt b/docs/changes.txt index efa569222b..f76a70f491 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -255,6 +255,7 @@ Changes in behaviour which may result in build errors All (Unix): - Fix configure build with --with-flavour option broken in 3.2.8 (#25436). +- Fix configure build with clang and LTO broken in 3.2.8 (#25438). wxGTK: