On Sun, Jul 02, 2006 at 10:58:23PM +0900, Peter O'Gorman wrote:
> On Tue, 2006-06-20 at 12:12 -0500, Albert Chin wrote:
>
> 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)?
Another version. Patch against branch-1-5 only. I've reordered where
--export-dynamic occurs so we don't have to worry about the above.
--
albert chin ([EMAIL PROTECTED])
Index: libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/Attic/libtool.m4,v
retrieving revision 1.314.2.162
diff -u -p -r1.314.2.162 libtool.m4
--- libtool.m4 3 Aug 2006 14:31:47 -0000 1.314.2.162
+++ libtool.m4 8 Aug 2006 13:16:45 -0000
@@ -2911,6 +2911,13 @@ case $host_os in
exp_sym_flag='-bexport'
no_entry_flag='-bnoentry'
+
+ if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+ _LT_AC_TAGVAR(export_dynamic_symbols_cmds, $1)='$NM -Bpg $objs $libobjs
$old_deplibs $old_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
$libobjs $old_deplibs $old_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"
fi
# When large executables or shared objects are built, AIX ld can
@@ -3974,6 +3981,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)=
@@ -4209,6 +4217,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) \
@@ -4243,6 +4252,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) | \
@@ -4455,6 +4465,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.
@@ -5480,6 +5491,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)=
@@ -5788,8 +5800,11 @@ _LT_EOF
# -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
$libobjs $old_deplibs $old_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
$libobjs $old_deplibs $old_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
aix_use_runtimelinking=no
Index: ltmain.in
===================================================================
RCS file: /cvsroot/libtool/libtool/Attic/ltmain.in,v
retrieving revision 1.334.2.133
diff -u -p -r1.334.2.133 ltmain.in
--- ltmain.in 7 Aug 2006 16:25:31 -0000 1.334.2.133
+++ ltmain.in 8 Aug 2006 13:16:45 -0000
@@ -1993,12 +1993,6 @@ EOF
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%^.*/%%'`
@@ -3096,6 +3090,41 @@ EOF
dlprefiles="$newdlprefiles"
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
+ # The command line is too long to execute in one step.
+ $show "using reloadable object file for export list..."
+ skipped_export=:
+ fi
+ done
+ IFS="$save_ifs"
+ fi
+
+ eval arg=\"$export_dynamic_flag_spec\"
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+
+ if test -n "$export_dynamic_symbols_cmds"; then
+ unset export_symbols
+ fi
+ fi
+
case $linkmode in
oldlib)
if test -n "$deplibs"; then
@@ -4780,6 +4809,11 @@ 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"; then
+ $run $rm $export_symbols
+ fi
+
exit $exit_status
fi
_______________________________________________
http://lists.gnu.org/mailman/listinfo/libtool