Skip to content
Snippets Groups Projects
Commit 721d1af7 authored by Sergey Kosukhin's avatar Sergey Kosukhin Committed by Thomas Jahns
Browse files

build system: Add libtool patches to prevent implicit overlinking.

parent 685e69fd
No related branches found
No related tags found
No related merge requests found
......@@ -104,6 +104,11 @@ EXTRA_DIST = util/sunf95preproc-wrapper \
contrib/07ltmain-early-xcompile-patch/ltmain-early-xcompile-libtool-2.4.6.patch \
contrib/08ltmain-parallel-printf-patch/ltmain-parallel-printf-libtool-2.4.2.patch \
contrib/08ltmain-parallel-printf-patch/ltmain-parallel-printf-libtool-2.4.6.patch \
contrib/09debian-no-overlink-patch/README.txt \
contrib/09debian-no-overlink-patch/deplib_binary-libtool-2.4.2.patch \
contrib/09debian-no-overlink-patch/deplib_binary.patch \
contrib/09debian-no-overlink-patch/link_all_deplibs-libtool-2.4.2.patch \
contrib/09debian-no-overlink-patch/link_all_deplibs.patch \
doc/Makefile \
doc/Doxyfile.in doc/README.build doc/cfortran.doc \
doc/cfortran.html doc/cfortran.txt doc/styleguide.txt \
......
The patches are taken the Debian project:
https://sources.debian.org/patches/libtool/2.4.7-7/deplib_binary.patch
https://sources.debian.org/patches/libtool/2.4.7-7/link_all_deplibs.patch
The patches prevent overlinking.
The comment in link_all_deplibs.patch says:
## Do not link against deplibs. This is not needed for shared libs
## on atleast ELF systems since those already know which libs they
## need themself. This seems to break a few things and will be fixed
## in a better way in a future upstream version.
Index: libtool-2.4/libltdl/config/ltmain.m4sh
===================================================================
--- a/config/ltmain.sh
+++ b/config/ltmain.sh
@@ -5644,19 +5644,19 @@
# It is a libtool convenience library, so add in its objects.
func_append convenience " $ladir/$objdir/$old_library"
func_append old_convenience " $ladir/$objdir/$old_library"
+ tmp_libs=
+ for deplib in $dependency_libs; do
+ deplibs="$deplib $deplibs"
+ if $opt_preserve_dup_deps ; then
+ case "$tmp_libs " in
+ *" $deplib "*) func_append specialdeplibs " $deplib" ;;
+ esac
+ fi
+ func_append tmp_libs " $deplib"
+ done
elif test "$linkmode" != prog && test "$linkmode" != lib; then
func_fatal_error "\`$lib' is not a convenience library"
fi
- tmp_libs=
- for deplib in $dependency_libs; do
- deplibs="$deplib $deplibs"
- if $opt_preserve_dup_deps ; then
- case "$tmp_libs " in
- *" $deplib "*) func_append specialdeplibs " $deplib" ;;
- esac
- fi
- func_append tmp_libs " $deplib"
- done
continue
fi # $pass = conv
--- a/config/ltmain.sh
+++ b/config/ltmain.sh
@@ -6028,19 +6028,19 @@
# It is a libtool convenience library, so add in its objects.
func_append convenience " $ladir/$objdir/$old_library"
func_append old_convenience " $ladir/$objdir/$old_library"
+ tmp_libs=
+ for deplib in $dependency_libs; do
+ deplibs="$deplib $deplibs"
+ if $opt_preserve_dup_deps; then
+ case "$tmp_libs " in
+ *" $deplib "*) func_append specialdeplibs " $deplib" ;;
+ esac
+ fi
+ func_append tmp_libs " $deplib"
+ done
elif test prog != "$linkmode" && test lib != "$linkmode"; then
func_fatal_error "'$lib' is not a convenience library"
fi
- tmp_libs=
- for deplib in $dependency_libs; do
- deplibs="$deplib $deplibs"
- if $opt_preserve_dup_deps; then
- case "$tmp_libs " in
- *" $deplib "*) func_append specialdeplibs " $deplib" ;;
- esac
- fi
- func_append tmp_libs " $deplib"
- done
continue
fi # $pass = conv
## Do not link against deplibs. This is not needed for shared libs
## on atleast ELF systems since those already know which libs they
## need themself. This seems to break a few things and will be fixed
## in a better way in a future upstream version.
Index: libtool-2.4/libltdl/config/ltmain.m4sh
===================================================================
--- a/config/ltmain.sh
+++ b/config/ltmain.sh
@@ -5322,7 +5322,10 @@
case $pass in
dlopen) libs="$dlfiles" ;;
dlpreopen) libs="$dlprefiles" ;;
- link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
+ link)
+ libs="$deplibs %DEPLIBS%"
+ test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
+ ;;
esac
fi
if test "$linkmode,$pass" = "lib,dlpreopen"; then
Index: libtool-2.4/libltdl/m4/libtool.m4
===================================================================
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -4499,6 +4499,9 @@
;;
esac
;;
+ linux* | k*bsd*-gnu | gnu*)
+ _LT_TAGVAR(link_all_deplibs, $1)=no
+ ;;
*)
_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
;;
@@ -4562,6 +4565,9 @@
openbsd*)
with_gnu_ld=no
;;
+ linux* | k*bsd*-gnu | gnu*)
+ _LT_TAGVAR(link_all_deplibs, $1)=no
+ ;;
esac
_LT_TAGVAR(ld_shlibs, $1)=yes
@@ -4961,6 +4967,7 @@
if test "$aix_use_runtimelinking" = yes; then
shared_flag="$shared_flag "'${wl}-G'
fi
+ _LT_TAGVAR(link_all_deplibs, $1)=no
else
# not using gcc
if test "$host_cpu" = ia64; then
## Do not link against deplibs. This is not needed for shared libs
## on atleast ELF systems since those already know which libs they
## need themself. This seems to break a few things and will be fixed
## in a better way in a future upstream version.
--- a/config/ltmain.sh
+++ b/config/ltmain.sh
@@ -5706,7 +5706,10 @@
case $pass in
dlopen) libs=$dlfiles ;;
dlpreopen) libs=$dlprefiles ;;
- link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
+ link)
+ libs="$deplibs %DEPLIBS%"
+ test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
+ ;;
esac
fi
if test lib,dlpreopen = "$linkmode,$pass"; then
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -4956,6 +4956,9 @@
;;
esac
;;
+ linux* | k*bsd*-gnu | gnu*)
+ _LT_TAGVAR(link_all_deplibs, $1)=no
+ ;;
*)
_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
;;
@@ -5018,6 +5021,9 @@
openbsd* | bitrig*)
with_gnu_ld=no
;;
+ linux* | k*bsd*-gnu | gnu*)
+ _LT_TAGVAR(link_all_deplibs, $1)=no
+ ;;
esac
_LT_TAGVAR(ld_shlibs, $1)=yes
@@ -5794,6 +5800,7 @@
if test yes = "$lt_cv_irix_exported_symbol"; then
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib'
fi
+ _LT_TAGVAR(link_all_deplibs, $1)=no
else
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib'
......@@ -84,7 +84,9 @@ case "$libtoolversion" in
contrib/05macos-nagfor-patch/macos-nagfor.patch \
contrib/06ltmain_nag_pthread-patch/ltmain_nag_pthread.patch \
contrib/07ltmain-early-xcompile-patch/ltmain-early-xcompile-libtool-2.4.6.patch \
contrib/08ltmain-parallel-printf-patch/ltmain-parallel-printf-libtool-2.4.6.patch)
contrib/08ltmain-parallel-printf-patch/ltmain-parallel-printf-libtool-2.4.6.patch \
contrib/09debian-no-overlink-patch/deplib_binary.patch \
contrib/09debian-no-overlink-patch/link_all_deplibs.patch)
;;
(2.4.2)
patches=(contrib/00nagfor-libtool-patch/nagfor-libtool-2.4.2.patch \
......@@ -94,7 +96,9 @@ case "$libtoolversion" in
contrib/04ltmain-xlinker-patch/ltmain-xlinker-patch.patch \
contrib/05macos-nagfor-patch/macos-nagfor-libtool-2.4.2.patch \
contrib/06ltmain_nag_pthread-patch/ltmain_nag_pthread-libtool-2.4.2.patch \
contrib/08ltmain-parallel-printf-patch/ltmain-parallel-printf-libtool-2.4.2.patch)
contrib/08ltmain-parallel-printf-patch/ltmain-parallel-printf-libtool-2.4.2.patch \
contrib/09debian-no-overlink-patch/deplib_binary-libtool-2.4.2.patch \
contrib/09debian-no-overlink-patch/link_all_deplibs-libtool-2.4.2.patch)
;;
esac
for patch in "${patches[@]}"; do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment