From 1a86a78db283864a864bb76f211c6a9210fe819b Mon Sep 17 00:00:00 2001 From: bad Date: Tue, 9 Jan 2001 18:37:46 +0000 Subject: On a.out systems link shared libraries against c++rt0.o only if there actually are CTORS/DTORS in the objects that go into the library. This makes pkgsrc under 1.3.x not blow up on C libraries that were built with libtool. E.g. everything that linked against -lintl would dump core. --- devel/libtool/patches/patch-aa | 66 ++++++++++++++++++++++++++++++++++-------- devel/libtool/patches/patch-ab | 18 +++++++++--- 2 files changed, 68 insertions(+), 16 deletions(-) diff --git a/devel/libtool/patches/patch-aa b/devel/libtool/patches/patch-aa index 295a76a4112..4c3f3431c86 100644 --- a/devel/libtool/patches/patch-aa +++ b/devel/libtool/patches/patch-aa @@ -1,20 +1,34 @@ -$NetBSD: patch-aa,v 1.19 2000/12/28 17:55:38 wiz Exp $ +$NetBSD: patch-aa,v 1.20 2001/01/09 18:37:46 bad Exp $ --- ltconfig.in.orig Sat May 27 03:58:57 2000 -+++ ltconfig.in -@@ -1194,11 +1194,17 @@ ++++ ltconfig.in Tue Jan 9 19:21:16 2001 +@@ -1095,6 +1095,13 @@ + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. ++cpprt0= ++# C++ startup code. ++cppopts= ++# option to archive_cmds that causes cpprt0 to be linked in ++ctor_check_cmd='$NM $libobjs | grep '\''___[CD]TOR_LIST__'\'' >/dev/null 2>&1' ++ ++ + + case "$host_os" in + cygwin* | mingw*) +@@ -1194,11 +1201,17 @@ netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' -+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' ++ archive_cmds='$LD -Bshareable -o $lib $cppopts $libobjs $deplibs $linkopts' + wlarc= + # Add in C++ constructor/destructor support + if test -f ${PREFIX}/lib/c++rt0/c++rt0.o.PIC; then -+ archive_cmds="$archive_cmds ${PREFIX}/lib/c++rt0/c++rt0.o.PIC" ++ cpprt0="${PREFIX}/lib/c++rt0/c++rt0.o.PIC" + elif test -f /usr/lib/c++rt0.o; then -+ archive_cmds="$archive_cmds /usr/lib/c++rt0.o" ++ cpprt0="/usr/lib/c++rt0.o" + fi else - archive_cmds='$LD -Bshareable $libobjs $deplibs $linkopts -o $lib' @@ -24,17 +38,17 @@ $NetBSD: patch-aa,v 1.19 2000/12/28 17:55:38 wiz Exp $ fi ;; -@@ -1392,11 +1398,19 @@ +@@ -1392,11 +1405,19 @@ netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' # a.out -+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' ++ archive_cmds='$LD -Bshareable -o $lib $cppopts $libobjs $deplibs $linkopts' + # Add in C++ constructor/destructor support + if test -f ${PREFIX}/lib/c++rt0/c++rt0.o.PIC; then -+ archive_cmds="$archive_cmds ${PREFIX}/lib/c++rt0/c++rt0.o.PIC" ++ cpprt0="${PREFIX}/lib/c++rt0/c++rt0.o.PIC" + elif test -f /usr/lib/c++rt0.o; then -+ archive_cmds="$archive_cmds /usr/lib/c++rt0.o" ++ cpprt0="/usr/lib/c++rt0.o" + fi else + # I don't think there are any ELF toolchains with non-gnu ld. @@ -46,7 +60,7 @@ $NetBSD: patch-aa,v 1.19 2000/12/28 17:55:38 wiz Exp $ hardcode_direct=yes hardcode_shlibpath_var=no ;; -@@ -2007,14 +2021,23 @@ +@@ -2007,14 +2028,23 @@ netbsd*) version_type=sunos @@ -70,7 +84,7 @@ $NetBSD: patch-aa,v 1.19 2000/12/28 17:55:38 wiz Exp $ fi shlibpath_var=LD_LIBRARY_PATH ;; -@@ -2069,7 +2092,7 @@ +@@ -2069,7 +2099,7 @@ ;; solaris*) @@ -79,3 +93,31 @@ $NetBSD: patch-aa,v 1.19 2000/12/28 17:55:38 wiz Exp $ need_lib_prefix=no need_version=no library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' +@@ -2706,6 +2736,7 @@ + old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds postuninstall_cmds \ + file_magic_cmd export_symbols_cmds deplibs_check_method allow_undefined_flag no_undefined_flag \ + finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ ++ ctor_check_cmd \ + hardcode_libdir_flag_spec hardcode_libdir_separator \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do +@@ -2715,6 +2746,7 @@ + old_postinstall_cmds | old_postuninstall_cmds | \ + export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ + postinstall_cmds | postuninstall_cmds | \ ++ ctor_check_cmd | \ + finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" +@@ -3017,6 +3049,11 @@ + + # Symbols that must always be exported. + include_expsyms=$include_expsyms ++ ++# C++ startup code ++cpprt0="$cpprt0" ++cppopts= ++ctor_check_cmd=$ctor_check_cmd + + EOF + diff --git a/devel/libtool/patches/patch-ab b/devel/libtool/patches/patch-ab index a62c0c132cf..226e57355ec 100644 --- a/devel/libtool/patches/patch-ab +++ b/devel/libtool/patches/patch-ab @@ -1,7 +1,7 @@ -$NetBSD: patch-ab,v 1.12 2000/11/26 11:22:40 mycroft Exp $ +$NetBSD: patch-ab,v 1.13 2001/01/09 18:37:46 bad Exp $ ---- ltmain.in.orig Sat May 27 01:53:15 2000 -+++ ltmain.in Sun Nov 26 11:19:57 2000 +--- ltmain.in.orig0 Sat May 27 03:53:15 2000 ++++ ltmain.in Tue Jan 9 19:21:17 2001 @@ -819,6 +819,7 @@ old_convenience= deplibs= @@ -55,11 +55,21 @@ $NetBSD: patch-ab,v 1.12 2000/11/26 11:22:40 mycroft Exp $ *) # Add libc to deplibs on all other systems. deplibs="$deplibs -lc" -@@ -2146,6 +2169,7 @@ +@@ -2146,6 +2169,17 @@ if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linkopts="$linkopts $flag" + wllinkopts="$wllinkopts $wl$flag" ++ fi ++ ++ # Check whether we need to link in c++rt0.o on a.out because of ++ # constructors/destructors ++ if test -n "$ctor_check_cmd"; then ++ eval cmd=\"$ctor_check_cmd\" ++ #$show "$cmd" ++ if $run eval "$cmd" ; then ++ cppopts="$cpprt0" ++ fi fi # Do each of the archive commands. -- cgit v1.2.3