Stop using shared-ld wrapper script under Mac

We don't need to cater for gcc < 3.1 any longer and can just use
-single_module option unconditionally.

This is simpler and avoids spurious errors about "unknown option" when
using -fsanitize=xxx in LDFLAGS from the script.
This commit is contained in:
Vadim Zeitlin 2021-07-06 14:05:22 +02:00
parent a052557af3
commit e663d9af2b
2 changed files with 8 additions and 304 deletions

View File

@ -282,46 +282,11 @@ AC_DEFUN([AC_BAKEFILE_SHARED_LD],
;; ;;
*-*-darwin* ) *-*-darwin* )
AC_BAKEFILE_CREATE_FILE_SHARED_LD_SH SHARED_LD_MODULE_CC="\${CC} -bundle -single_module -headerpad_max_install_names -o"
chmod +x shared-ld-sh SHARED_LD_MODULE_CXX="\${CXX} -bundle -single_module -headerpad_max_install_names -o"
SHARED_LD_MODULE_CC="`pwd`/shared-ld-sh -bundle -headerpad_max_install_names -o" SHARED_LD_CC="\${CC} -dynamiclib -single_module -headerpad_max_install_names -o"
SHARED_LD_MODULE_CXX="CXX=\"\$(CXX)\" $SHARED_LD_MODULE_CC" SHARED_LD_CXX="\${CXX} -dynamiclib -single_module -headerpad_max_install_names -o"
dnl Most apps benefit from being fully binded (its faster and static
dnl variables initialized at startup work).
dnl This can be done either with the exe linker flag -Wl,-bind_at_load
dnl or with a double stage link in order to create a single module
dnl "-init _wxWindowsDylibInit" not useful with lazy linking solved
dnl If using newer dev tools then there is a -single_module flag that
dnl we can use to do this for dylibs, otherwise we'll need to use a helper
dnl script. Check the version of gcc to see which way we can go:
AC_CACHE_CHECK([for gcc 3.1 or later], bakefile_cv_gcc31, [
AC_TRY_COMPILE([],
[
#if (__GNUC__ < 3) || \
((__GNUC__ == 3) && (__GNUC_MINOR__ < 1))
This is old gcc
#endif
],
[
bakefile_cv_gcc31=yes
],
[
bakefile_cv_gcc31=no
]
)
])
if test "$bakefile_cv_gcc31" = "no"; then
dnl Use the shared-ld-sh helper script
SHARED_LD_CC="`pwd`/shared-ld-sh -dynamiclib -headerpad_max_install_names -o"
SHARED_LD_CXX="$SHARED_LD_CC"
else
dnl Use the -single_module flag and let the linker do it for us
SHARED_LD_CC="\${CC} -dynamiclib -single_module -headerpad_max_install_names -o"
SHARED_LD_CXX="\${CXX} -dynamiclib -single_module -headerpad_max_install_names -o"
fi
if test "x$GCC" = "xyes"; then if test "x$GCC" = "xyes"; then
PIC_FLAG="-dynamic -fPIC" PIC_FLAG="-dynamic -fPIC"
@ -869,117 +834,6 @@ EOF
dnl ===================== bk-deps ends here ===================== dnl ===================== bk-deps ends here =====================
]) ])
AC_DEFUN([AC_BAKEFILE_CREATE_FILE_SHARED_LD_SH],
[
dnl ===================== shared-ld-sh begins here =====================
dnl (Created by merge-scripts.py from shared-ld-sh
dnl file do not edit here!)
D='$'
cat <<EOF >shared-ld-sh
#!/bin/sh
#-----------------------------------------------------------------------------
#-- Name: distrib/mac/shared-ld-sh
#-- Purpose: Link a mach-o dynamic shared library for Darwin / Mac OS X
#-- Author: Gilles Depeyrot
#-- Copyright: (c) 2002 Gilles Depeyrot
#-- Licence: any use permitted
#-----------------------------------------------------------------------------
verbose=0
args=""
objects=""
linking_flag="-dynamiclib"
ldargs="-r -keep_private_externs -nostdlib"
if test "x${D}CXX" = "x"; then
CXX="c++"
fi
while test ${D}# -gt 0; do
case ${D}1 in
-v)
verbose=1
;;
-o|-compatibility_version|-current_version|-framework|-undefined|-install_name)
# collect these options and values
args="${D}{args} ${D}1 ${D}2"
shift
;;
-arch|-isysroot)
# collect these options and values
ldargs="${D}{ldargs} ${D}1 ${D}2"
shift
;;
-s|-Wl,*)
# collect these load args
ldargs="${D}{ldargs} ${D}1"
;;
-l*|-L*|-flat_namespace|-headerpad_max_install_names)
# collect these options
args="${D}{args} ${D}1"
;;
-dynamiclib|-bundle)
linking_flag="${D}1"
;;
-*)
echo "shared-ld: unhandled option '${D}1'"
exit 1
;;
*.o | *.a | *.dylib)
# collect object files
objects="${D}{objects} ${D}1"
;;
*)
echo "shared-ld: unhandled argument '${D}1'"
exit 1
;;
esac
shift
done
status=0
#
# Link one module containing all the others
#
if test ${D}{verbose} = 1; then
echo "${D}CXX ${D}{ldargs} ${D}{objects} -o master.${D}${D}.o"
fi
${D}CXX ${D}{ldargs} ${D}{objects} -o master.${D}${D}.o
status=${D}?
#
# Link the shared library from the single module created, but only if the
# previous command didn't fail:
#
if test ${D}{status} = 0; then
if test ${D}{verbose} = 1; then
echo "${D}CXX ${D}{linking_flag} master.${D}${D}.o ${D}{args}"
fi
${D}CXX ${D}{linking_flag} master.${D}${D}.o ${D}{args}
status=${D}?
fi
#
# Remove intermediate module
#
rm -f master.${D}${D}.o
exit ${D}status
EOF
dnl ===================== shared-ld-sh ends here =====================
])
AC_DEFUN([AC_BAKEFILE_CREATE_FILE_BK_MAKE_PCH], AC_DEFUN([AC_BAKEFILE_CREATE_FILE_BK_MAKE_PCH],
[ [
dnl ===================== bk-make-pch begins here ===================== dnl ===================== bk-make-pch begins here =====================

158
configure vendored
View File

@ -39399,161 +39399,11 @@ $as_echo "$bakefile_cv_prog_makeisgnu" >&6; }
;; ;;
*-*-darwin* ) *-*-darwin* )
SHARED_LD_MODULE_CC="\${CC} -bundle -single_module -headerpad_max_install_names -o"
SHARED_LD_MODULE_CXX="\${CXX} -bundle -single_module -headerpad_max_install_names -o"
D='$' SHARED_LD_CC="\${CC} -dynamiclib -single_module -headerpad_max_install_names -o"
cat <<EOF >shared-ld-sh SHARED_LD_CXX="\${CXX} -dynamiclib -single_module -headerpad_max_install_names -o"
#!/bin/sh
#-----------------------------------------------------------------------------
#-- Name: distrib/mac/shared-ld-sh
#-- Purpose: Link a mach-o dynamic shared library for Darwin / Mac OS X
#-- Author: Gilles Depeyrot
#-- Copyright: (c) 2002 Gilles Depeyrot
#-- Licence: any use permitted
#-----------------------------------------------------------------------------
verbose=0
args=""
objects=""
linking_flag="-dynamiclib"
ldargs="-r -keep_private_externs -nostdlib"
if test "x${D}CXX" = "x"; then
CXX="c++"
fi
while test ${D}# -gt 0; do
case ${D}1 in
-v)
verbose=1
;;
-o|-compatibility_version|-current_version|-framework|-undefined|-install_name)
# collect these options and values
args="${D}{args} ${D}1 ${D}2"
shift
;;
-arch|-isysroot)
# collect these options and values
ldargs="${D}{ldargs} ${D}1 ${D}2"
shift
;;
-s|-Wl,*)
# collect these load args
ldargs="${D}{ldargs} ${D}1"
;;
-l*|-L*|-flat_namespace|-headerpad_max_install_names)
# collect these options
args="${D}{args} ${D}1"
;;
-dynamiclib|-bundle)
linking_flag="${D}1"
;;
-*)
echo "shared-ld: unhandled option '${D}1'"
exit 1
;;
*.o | *.a | *.dylib)
# collect object files
objects="${D}{objects} ${D}1"
;;
*)
echo "shared-ld: unhandled argument '${D}1'"
exit 1
;;
esac
shift
done
status=0
#
# Link one module containing all the others
#
if test ${D}{verbose} = 1; then
echo "${D}CXX ${D}{ldargs} ${D}{objects} -o master.${D}${D}.o"
fi
${D}CXX ${D}{ldargs} ${D}{objects} -o master.${D}${D}.o
status=${D}?
#
# Link the shared library from the single module created, but only if the
# previous command didn't fail:
#
if test ${D}{status} = 0; then
if test ${D}{verbose} = 1; then
echo "${D}CXX ${D}{linking_flag} master.${D}${D}.o ${D}{args}"
fi
${D}CXX ${D}{linking_flag} master.${D}${D}.o ${D}{args}
status=${D}?
fi
#
# Remove intermediate module
#
rm -f master.${D}${D}.o
exit ${D}status
EOF
chmod +x shared-ld-sh
SHARED_LD_MODULE_CC="`pwd`/shared-ld-sh -bundle -headerpad_max_install_names -o"
SHARED_LD_MODULE_CXX="CXX=\"\$(CXX)\" $SHARED_LD_MODULE_CC"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcc 3.1 or later" >&5
$as_echo_n "checking for gcc 3.1 or later... " >&6; }
if ${bakefile_cv_gcc31+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
#if (__GNUC__ < 3) || \
((__GNUC__ == 3) && (__GNUC_MINOR__ < 1))
This is old gcc
#endif
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
bakefile_cv_gcc31=yes
else
bakefile_cv_gcc31=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bakefile_cv_gcc31" >&5
$as_echo "$bakefile_cv_gcc31" >&6; }
if test "$bakefile_cv_gcc31" = "no"; then
SHARED_LD_CC="`pwd`/shared-ld-sh -dynamiclib -headerpad_max_install_names -o"
SHARED_LD_CXX="$SHARED_LD_CC"
else
SHARED_LD_CC="\${CC} -dynamiclib -single_module -headerpad_max_install_names -o"
SHARED_LD_CXX="\${CXX} -dynamiclib -single_module -headerpad_max_install_names -o"
fi
if test "x$GCC" = "xyes"; then if test "x$GCC" = "xyes"; then
PIC_FLAG="-dynamic -fPIC" PIC_FLAG="-dynamic -fPIC"