libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Supporting -export-dynamic on AIX


From: Albert Chin
Subject: Re: Supporting -export-dynamic on AIX
Date: Sun, 11 Jun 2006 01:14:23 -0500
User-agent: Mutt/1.5.6i

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?
> > > > 
> > > > Yes, as commented in libtool.m4:
> > 
> > > I think this is still correct. How should I fix it?
> > 
> > Well.  In what way(s) do gaim and galculator fail, and why?
> > Is there a way to reproduce the failure without much hassle
> > such as lots of required packages, maybe even a stripped down
> > test case?  Are those packages doing something we may want
> > to allow, or is it impossible to realize portably anyway?
> > I'm sorry but I cannot answer your question without more
> > information.  (That is not to say that I could otherwise ;-)
> 
> When I say "how should I fix it", I mean what's the best way to
> implement -export-dynamic on AIX. Maybe a new export_dynamic_cmds
> command that creates the symbols ala export_symbols_cmds and then
> export_dynamic_flag_spec to add the ld flag to export the symbols from
> export_symbols_cmds to the binary?

I'm thinking of a patch along the lines of the one below. What do you
think?

-- 
albert chin (address@hidden)

-- snip snip
Index: libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/Attic/libtool.m4,v
retrieving revision 1.314.2.157
diff -u -p -r1.314.2.157 libtool.m4
--- libtool.m4  1 Jun 2006 18:46:12 -0000       1.314.2.157
+++ libtool.m4  11 Jun 2006 06:13:24 -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 | 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 | 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
@@ -3952,6 +3958,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)=
@@ -4180,6 +4187,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) \
@@ -4214,6 +4222,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) | \
@@ -4426,6 +4435,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.
@@ -5451,6 +5461,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)=
@@ -5759,8 +5770,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 | 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 | 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.131
diff -u -p -r1.334.2.131 ltmain.in
--- ltmain.in   8 Jun 2006 16:55:10 -0000       1.334.2.131
+++ ltmain.in   11 Jun 2006 06:13:25 -0000
@@ -1993,7 +1993,30 @@ EOF
       exit $EXIT_FAILURE
     fi
 
-    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; 
then
+    if test "$export_dynamic" = yes &&
+       { test -n "$export_dynamic_symbols_cmds" ||
+        test -n "$export_dynamic_flag_spec"; }; 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"
+
       eval arg=\"$export_dynamic_flag_spec\"
       compile_command="$compile_command $arg"
       finalize_command="$finalize_command $arg"
@@ -4777,6 +4800,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
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]