Use --as-needed when linking libpython3.so. Closes #11347.
Patch by Arfrever Frehtes Taifersar Arahesis.
This commit is contained in:
parent
19f7ca25e5
commit
48e14d3fda
|
@ -76,6 +76,7 @@ PY_CFLAGS= $(BASECFLAGS) $(OPT) $(CONFIGURE_CFLAGS) $(CFLAGS) $(EXTRA_CFLAGS)
|
||||||
# environment variables
|
# environment variables
|
||||||
PY_CPPFLAGS= -I. -IInclude -I$(srcdir)/Include $(CONFIGURE_CPPFLAGS) $(CPPFLAGS)
|
PY_CPPFLAGS= -I. -IInclude -I$(srcdir)/Include $(CONFIGURE_CPPFLAGS) $(CPPFLAGS)
|
||||||
PY_LDFLAGS= $(CONFIGURE_LDFLAGS) $(LDFLAGS)
|
PY_LDFLAGS= $(CONFIGURE_LDFLAGS) $(LDFLAGS)
|
||||||
|
NO_AS_NEEDED= @NO_AS_NEEDED@
|
||||||
LDLAST= @LDLAST@
|
LDLAST= @LDLAST@
|
||||||
SGI_ABI= @SGI_ABI@
|
SGI_ABI= @SGI_ABI@
|
||||||
CCSHARED= @CCSHARED@
|
CCSHARED= @CCSHARED@
|
||||||
|
@ -459,7 +460,7 @@ libpython$(LDVERSION).so: $(LIBRARY_OBJS)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
libpython3.so: libpython$(LDVERSION).so
|
libpython3.so: libpython$(LDVERSION).so
|
||||||
$(BLDSHARED) -o $@ -Wl,-hl$@ $^
|
$(BLDSHARED) $(NO_AS_NEEDED) -o $@ -Wl,-h$@ $^
|
||||||
|
|
||||||
libpython$(LDVERSION).dylib: $(LIBRARY_OBJS)
|
libpython$(LDVERSION).dylib: $(LIBRARY_OBJS)
|
||||||
$(CC) -dynamiclib -Wl,-single_module $(PY_LDFLAGS) -undefined dynamic_lookup -Wl,-install_name,$(prefix)/lib/libpython$(LDVERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
|
$(CC) -dynamiclib -Wl,-single_module $(PY_LDFLAGS) -undefined dynamic_lookup -Wl,-install_name,$(prefix)/lib/libpython$(LDVERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
|
||||||
|
|
|
@ -313,6 +313,8 @@ Library
|
||||||
Build
|
Build
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
- Issue #11347: Use --as-needed when linking libpython3.so.
|
||||||
|
|
||||||
- Issue #11411: Fix 'make DESTDIR=' with a relative destination.
|
- Issue #11411: Fix 'make DESTDIR=' with a relative destination.
|
||||||
|
|
||||||
- Issue #11268: Prevent Mac OS X Installer failure if Documentation
|
- Issue #11268: Prevent Mac OS X Installer failure if Documentation
|
||||||
|
|
|
@ -668,6 +668,7 @@ BUILDEXEEXT
|
||||||
EGREP
|
EGREP
|
||||||
GREP
|
GREP
|
||||||
CPP
|
CPP
|
||||||
|
NO_AS_NEEDED
|
||||||
MAINCC
|
MAINCC
|
||||||
CXX
|
CXX
|
||||||
OBJEXT
|
OBJEXT
|
||||||
|
@ -1572,6 +1573,52 @@ fi
|
||||||
|
|
||||||
} # ac_fn_c_try_compile
|
} # ac_fn_c_try_compile
|
||||||
|
|
||||||
|
# ac_fn_c_try_link LINENO
|
||||||
|
# -----------------------
|
||||||
|
# Try to link conftest.$ac_ext, and return whether this succeeded.
|
||||||
|
ac_fn_c_try_link ()
|
||||||
|
{
|
||||||
|
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
|
||||||
|
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||||
|
if { { ac_try="$ac_link"
|
||||||
|
case "(($ac_try" in
|
||||||
|
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||||
|
*) ac_try_echo=$ac_try;;
|
||||||
|
esac
|
||||||
|
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
|
||||||
|
$as_echo "$ac_try_echo"; } >&5
|
||||||
|
(eval "$ac_link") 2>conftest.err
|
||||||
|
ac_status=$?
|
||||||
|
if test -s conftest.err; then
|
||||||
|
grep -v '^ *+' conftest.err >conftest.er1
|
||||||
|
cat conftest.er1 >&5
|
||||||
|
mv -f conftest.er1 conftest.err
|
||||||
|
fi
|
||||||
|
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||||
|
test $ac_status = 0; } && {
|
||||||
|
test -z "$ac_c_werror_flag" ||
|
||||||
|
test ! -s conftest.err
|
||||||
|
} && test -s conftest$ac_exeext && {
|
||||||
|
test "$cross_compiling" = yes ||
|
||||||
|
$as_test_x conftest$ac_exeext
|
||||||
|
}; then :
|
||||||
|
ac_retval=0
|
||||||
|
else
|
||||||
|
$as_echo "$as_me: failed program was:" >&5
|
||||||
|
sed 's/^/| /' conftest.$ac_ext >&5
|
||||||
|
|
||||||
|
ac_retval=1
|
||||||
|
fi
|
||||||
|
# Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
|
||||||
|
# created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
|
||||||
|
# interfere with the next link command; also delete a directory that is
|
||||||
|
# left behind by Apple's compiler. We do this before executing the actions.
|
||||||
|
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
|
||||||
|
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
|
||||||
|
as_fn_set_status $ac_retval
|
||||||
|
|
||||||
|
} # ac_fn_c_try_link
|
||||||
|
|
||||||
# ac_fn_c_try_cpp LINENO
|
# ac_fn_c_try_cpp LINENO
|
||||||
# ----------------------
|
# ----------------------
|
||||||
# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
|
# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
|
||||||
|
@ -1773,52 +1820,6 @@ $as_echo "$ac_res" >&6; }
|
||||||
|
|
||||||
} # ac_fn_c_check_header_compile
|
} # ac_fn_c_check_header_compile
|
||||||
|
|
||||||
# ac_fn_c_try_link LINENO
|
|
||||||
# -----------------------
|
|
||||||
# Try to link conftest.$ac_ext, and return whether this succeeded.
|
|
||||||
ac_fn_c_try_link ()
|
|
||||||
{
|
|
||||||
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
|
|
||||||
rm -f conftest.$ac_objext conftest$ac_exeext
|
|
||||||
if { { ac_try="$ac_link"
|
|
||||||
case "(($ac_try" in
|
|
||||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
|
||||||
*) ac_try_echo=$ac_try;;
|
|
||||||
esac
|
|
||||||
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
|
|
||||||
$as_echo "$ac_try_echo"; } >&5
|
|
||||||
(eval "$ac_link") 2>conftest.err
|
|
||||||
ac_status=$?
|
|
||||||
if test -s conftest.err; then
|
|
||||||
grep -v '^ *+' conftest.err >conftest.er1
|
|
||||||
cat conftest.er1 >&5
|
|
||||||
mv -f conftest.er1 conftest.err
|
|
||||||
fi
|
|
||||||
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
|
||||||
test $ac_status = 0; } && {
|
|
||||||
test -z "$ac_c_werror_flag" ||
|
|
||||||
test ! -s conftest.err
|
|
||||||
} && test -s conftest$ac_exeext && {
|
|
||||||
test "$cross_compiling" = yes ||
|
|
||||||
$as_test_x conftest$ac_exeext
|
|
||||||
}; then :
|
|
||||||
ac_retval=0
|
|
||||||
else
|
|
||||||
$as_echo "$as_me: failed program was:" >&5
|
|
||||||
sed 's/^/| /' conftest.$ac_ext >&5
|
|
||||||
|
|
||||||
ac_retval=1
|
|
||||||
fi
|
|
||||||
# Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
|
|
||||||
# created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
|
|
||||||
# interfere with the next link command; also delete a directory that is
|
|
||||||
# left behind by Apple's compiler. We do this before executing the actions.
|
|
||||||
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
|
|
||||||
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
|
|
||||||
as_fn_set_status $ac_retval
|
|
||||||
|
|
||||||
} # ac_fn_c_try_link
|
|
||||||
|
|
||||||
# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
|
# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
|
||||||
# -------------------------------------------
|
# -------------------------------------------
|
||||||
# Tests whether TYPE exists after having included INCLUDES, setting cache
|
# Tests whether TYPE exists after having included INCLUDES, setting cache
|
||||||
|
@ -4168,8 +4169,38 @@ $as_echo "$as_me: WARNING:
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# checks for UNIX variants that set C preprocessor variables
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -Wl,--no-as-needed" >&5
|
||||||
|
$as_echo_n "checking for -Wl,--no-as-needed... " >&6; }
|
||||||
|
save_LDFLAGS="$LDFLAGS"
|
||||||
|
LDFLAGS="$LDFLAGS -Wl,--no-as-needed"
|
||||||
|
|
||||||
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
|
/* end confdefs.h. */
|
||||||
|
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
if ac_fn_c_try_link "$LINENO"; then :
|
||||||
|
NO_AS_NEEDED="-Wl,--no-as-needed"
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||||
|
$as_echo "yes" >&6; }
|
||||||
|
else
|
||||||
|
NO_AS_NEEDED=""
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||||
|
$as_echo "no" >&6; }
|
||||||
|
fi
|
||||||
|
rm -f core conftest.err conftest.$ac_objext \
|
||||||
|
conftest$ac_exeext conftest.$ac_ext
|
||||||
|
LDFLAGS="$save_LDFLAGS"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# checks for UNIX variants that set C preprocessor variables
|
||||||
ac_ext=c
|
ac_ext=c
|
||||||
ac_cpp='$CPP $CPPFLAGS'
|
ac_cpp='$CPP $CPPFLAGS'
|
||||||
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||||
|
|
12
configure.in
12
configure.in
|
@ -525,6 +525,18 @@ then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
AC_MSG_CHECKING([for -Wl,--no-as-needed])
|
||||||
|
save_LDFLAGS="$LDFLAGS"
|
||||||
|
LDFLAGS="$LDFLAGS -Wl,--no-as-needed"
|
||||||
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
||||||
|
[NO_AS_NEEDED="-Wl,--no-as-needed"
|
||||||
|
AC_MSG_RESULT([yes])],
|
||||||
|
[NO_AS_NEEDED=""
|
||||||
|
AC_MSG_RESULT([no])])
|
||||||
|
LDFLAGS="$save_LDFLAGS"
|
||||||
|
AC_SUBST(NO_AS_NEEDED)
|
||||||
|
|
||||||
|
|
||||||
# checks for UNIX variants that set C preprocessor variables
|
# checks for UNIX variants that set C preprocessor variables
|
||||||
AC_USE_SYSTEM_EXTENSIONS
|
AC_USE_SYSTEM_EXTENSIONS
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue