On Tue, 2006-06-20 at 12:12 -0500, Albert Chin wrote: > On Sun, Jun 11, 2006 at 01:14:23AM -0500, Albert Chin wrote: > > On Sat, Jun 10, 2006 at 07:12:34PM -0500, Albert Chin wrote: > > > On Sun, Jun 11, 2006 at 01:04:17AM +0200, Ralf Wildenhues wrote: > > > > * Albert Chin wrote on Sat, Jun 10, 2006 at 08:49:29PM CEST: > > > > > On Sat, Jun 10, 2006 at 08:29:44PM +0200, Ralf Wildenhues wrote: > > > > > > * Albert Chin wrote on Sat, Jun 10, 2006 at 08:08:15PM CEST: > > > > > > > Any reason we don't use -bexpall to support -export-dynamic on > > > > > > > AIX? > > > > > > > > > > I'm thinking of a patch along the lines of the one below. What do you > > think? > > Well, this has some problems. First, if only export_dynamic_flag_spec > is set, the new export list code is wrong. Fixed in the patch below.
Albert and I have talked about this a little off-list. There are a couple of issues with Albert's patch. We really need to export all symbols from the executable, so we need to add static libraries and convenience archives too. Since the $convenience variable is not set at the time export_dynamic is checked, I moved this much closer to the program link stage. Then I could build and run irssi on aix with perl support. > The second problem is when libtool is passed multiple source files, > rather than object files to create the executable. This method totally > fails then. What to do in this case? I don't think this is supported, it works "by accident" because unknown things are simply added to $compile_command, the source files get added to the compile command and the compiler does the right thing. If you try this when building a library, it will fail: $ libtool --mode=link gcc -o libfoo.la libfoo.c ar cru .libs/libfoo.a ...empty archive created. Albert also questioned the documentation: > On some operating systems, a program symbol must be specially > declared > in order to be dynamically resolved with the `dlsym' (or equivalent) > function. > > Libtool provides the `-export-dynamic' and `-module' link flags > (*note Link mode::), which do this declaration. You need to use > these > flags if you are linking an application program that dlopens other > modules or a libtool library that will also be dlopened. > > Should the last sentence above end with ", respectively"? I think this is a documentation bug. -export-dynamic does not imply -module, there is a line of code in ltmain that adds dlname to the .la file if either -module or -export-dynamic was specified, but this only "works" if modules and libraries are otherwise equivalent, so it should probably be removed and the documentation adjusted for HEAD, thoughts? Either way this patch does not affect that behavior at all. Here are patches against branch-1-5 and HEAD, okay (with apropriate ChangeLog, of course)? Peter
Index: libtool.m4 =================================================================== RCS file: /cvsroot/libtool/libtool/Attic/libtool.m4,v retrieving revision 1.314.2.159 diff -u -3 -p -u -r1.314.2.159 libtool.m4 --- libtool.m4 24 Jun 2006 05:00:22 -0000 1.314.2.159 +++ libtool.m4 2 Jul 2006 13:39:17 -0000 @@ -2908,11 +2908,17 @@ case $host_os in done ;; esac - exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + _LT_AC_TAGVAR(export_dynamic_symbols_cmds, $1)='$NM -Bpg $objs $old_deplibs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_dynamic_symbols_cmds, $1)='$NM -BCpg $objs $old_deplibs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)="\${wl}$exp_sym_flag:\$export_symbols" + # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to @@ -3950,6 +3956,7 @@ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)= _LT_AC_TAGVAR(allow_undefined_flag, $1)= _LT_AC_TAGVAR(always_export_symbols, $1)=no _LT_AC_TAGVAR(archive_expsym_cmds, $1)= +_LT_AC_TAGVAR(export_dynamic_symbols_cmds, $1)= _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= @@ -4185,6 +4192,7 @@ if test -f "$ltmain"; then _LT_AC_TAGVAR(lt_prog_compiler_pic, $1) \ _LT_AC_TAGVAR(lt_prog_compiler_static, $1) \ _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) \ + _LT_AC_TAGVAR(export_dynamic_symbols_cmds, $1) \ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1) \ _LT_AC_TAGVAR(thread_safe_flag_spec, $1) \ _LT_AC_TAGVAR(whole_archive_flag_spec, $1) \ @@ -4219,6 +4227,7 @@ if test -f "$ltmain"; then _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) | \ _LT_AC_TAGVAR(archive_cmds, $1) | \ _LT_AC_TAGVAR(archive_expsym_cmds, $1) | \ + _LT_AC_TAGVAR(export_dynamic_symbols_cmds, $1) | \ _LT_AC_TAGVAR(module_cmds, $1) | \ _LT_AC_TAGVAR(module_expsym_cmds, $1) | \ _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) | \ @@ -4431,6 +4440,7 @@ link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_ no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) # Compiler flag to allow reflexive dlopens. +export_dynamic_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_dynamic_symbols_cmds, $1) export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1) # Compiler flag to generate shared objects directly from archives. @@ -5456,6 +5466,7 @@ ifelse([$1],[CXX],[ _LT_AC_TAGVAR(archive_expsym_cmds, $1)= _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= + _LT_AC_TAGVAR(export_dynamic_symbols_cmds, $1)= _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= @@ -5760,13 +5771,6 @@ _LT_EOF exp_sym_flag='-Bexport' no_entry_flag="" else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - else - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal @@ -5781,11 +5785,21 @@ _LT_EOF done ;; esac - exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + _LT_AC_TAGVAR(export_dynamic_symbols_cmds, $1)='$NM -Bpg $objs $old_deplibs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + _LT_AC_TAGVAR(export_dynamic_symbols_cmds, $1)='$NM -BCpg $objs $old_deplibs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)="\${wl}$exp_sym_flag:\$export_symbols" + fi + # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to Index: ltmain.in =================================================================== RCS file: /cvsroot/libtool/libtool/Attic/ltmain.in,v retrieving revision 1.334.2.132 diff -u -3 -p -u -r1.334.2.132 ltmain.in --- ltmain.in 12 Jun 2006 05:25:26 -0000 1.334.2.132 +++ ltmain.in 2 Jul 2006 13:39:18 -0000 @@ -1992,13 +1992,6 @@ EOF $echo "$help" 1>&2 exit $EXIT_FAILURE fi - - if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then - eval arg=\"$export_dynamic_flag_spec\" - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - fi - oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` @@ -4377,6 +4370,36 @@ EOF fi fi + if test "$export_dynamic" = yes && + { test -n "$export_dynamic_symbols_cmds" || + test -n "$export_dynamic_flag_spec"; }; then + if test -n "$export_dynamic_symbols_cmds"; then + $show "generating symbol list for \`$output'" + export_symbols="$output.exp" + $run $rm $export_symbols + cmds=$export_dynamic_symbols_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + if len=`expr "X$cmd" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + $show "$cmd" + $run eval "$cmd" || exit $? + skipped_export=false + else + $echo "$modename: warning: Unable to export symbols for -export-dynamic - command line too long." 1>&2 + fi + done + IFS="$save_ifs" + fi + + eval arg=\"$export_dynamic_flag_spec\" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + + case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework @@ -4780,6 +4803,12 @@ static const void *lt_preloaded_setup() $run $rm "$output_objdir/${outputname}S.${objext}" fi + if test "$export_dynamic" = yes && + test -n "$export_dynamic_symbols_cmds" && + test -f "$export_symbols"; then + $run $rm $export_symbols + fi + exit $exit_status fi
Index: libltdl/config/ltmain.m4sh =================================================================== RCS file: /cvsroot/libtool/libtool/libltdl/config/ltmain.m4sh,v retrieving revision 1.49 diff -u -3 -p -u -r1.49 ltmain.m4sh --- libltdl/config/ltmain.m4sh 8 Jun 2006 16:54:44 -0000 1.49 +++ libltdl/config/ltmain.m4sh 2 Jul 2006 13:39:41 -0000 @@ -3048,12 +3048,6 @@ func_mode_link () test -n "$prev" && \ func_fatal_help "the \`$prevarg' option requires an argument" - if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then - eval arg=\"$export_dynamic_flag_spec\" - func_append compile_command " $arg" - func_append finalize_command " $arg" - fi - oldlibs= # calculate the name of the file, without its directory func_basename "$output" @@ -5532,6 +5526,32 @@ EOF && test "$dlopen_self_static" = unknown && \ func_warning "\`LT_INIT([[dlopen]])' not used. Assuming no dlopen support." + if test "$export_dynamic" = yes && + { test -n "$export_dynamic_symbols_cmds" || + test -n "$export_dynamic_flag_spec"; }; then + if test -n "$export_dynamic_symbols_cmds"; then + func_echo "generating symbol list for \`$output'" + export_symbols="$output.exp" + func_show_eval "$RM $export_symbols" + cmds=$export_dynamic_symbols_cmd + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + if len=`expr "X$cmd" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + func_show_eval "$cmd" 'exit $?' + else + func_warning "Unable to export symbols for -export-dynamic - command line too long" + fi + done + IFS="$save_ifs" + fi + eval arg=\"$export_dynamic_flag_spec\" + func_append compile_command " $arg" + func_append finalize_command " $arg" + fi + case $host in *-*-rhapsody* | *-*-darwin1.[[012]]) # On Rhapsody replace the C library is the System framework @@ -5727,6 +5747,12 @@ EOF func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' fi + if test "$export_dynamic" = yes && + test -n "$export_dynamic_symbols_cmds" && + test -f "$export_symbols"; then + func_show_eval "$RM $export_symbols" + fi + exit $exit_status fi Index: libltdl/m4/libtool.m4 =================================================================== RCS file: /cvsroot/libtool/libtool/libltdl/m4/libtool.m4,v retrieving revision 1.75 diff -u -3 -p -u -r1.75 libtool.m4 --- libltdl/m4/libtool.m4 24 Jun 2006 04:58:58 -0000 1.75 +++ libltdl/m4/libtool.m4 2 Jul 2006 13:39:43 -0000 @@ -3944,8 +3944,10 @@ m4_if([$1], [CXX], [ # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + _LT_TAGVAR(export_dynamic_symbols_cmds, $1)='$NM -Bpg $objs $old_deplibs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + _LT_TAGVAR(export_dynamic_symbols_cmds, $1)='$NM -BCpg $objs $old_deplibs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) @@ -3965,6 +3967,7 @@ m4_if([$1], [CXX], [ _LT_TAGVAR(archive_cmds, $1)= _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + _LT_TAGVAR(export_dynamic_symbols_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(hardcode_automatic, $1)=no @@ -4285,13 +4288,6 @@ _LT_EOF exp_sym_flag='-Bexport' no_entry_flag="" else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - else - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal @@ -4310,6 +4306,15 @@ _LT_EOF exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + _LT_TAGVAR(export_dynamic_symbols_cmds, $1)='$NM -Bpg $objs $old_deplibs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + _LT_TAGVAR(export_dynamic_symbols_cmds, $1)='$NM -BCpg $objs $old_deplibs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library @@ -4952,6 +4957,8 @@ _LT_TAGDECL([allow_libtool_libs_with_sta [Whether or not to disallow shared libs when runtime libs are static]) _LT_TAGDECL([], [export_dynamic_flag_spec], [1], [Compiler flag to allow reflexive dlopens]) +_LT_TAGDECL([].[export_dynamic_symbols_cmds], [1], + [Commands to allow reflexive dlopens]) _LT_TAGDECL([], [whole_archive_flag_spec], [1], [Compiler flag to generate shared objects directly from archives]) _LT_TAGDECL([], [old_archive_from_new_cmds], [2], @@ -5143,6 +5150,7 @@ _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(export_dynamic_symbols_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no @@ -6402,6 +6410,7 @@ _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(export_dynamic_symbols_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no @@ -6543,6 +6552,7 @@ _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(export_dynamic_symbols_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no
signature.asc
Description: This is a digitally signed message part
_______________________________________________ http://lists.gnu.org/mailman/listinfo/libtool