[Top][All Lists]

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


From: Ralf Wildenhues
Subject: Re:
Date: Sat, 28 Feb 2009 17:02:55 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

Hello John, Tim,

* John Wolfe wrote on Thu, Feb 26, 2009 at 07:38:41PM CET:
> Happy to contribute where I can.  Sorry to not get back to you sooner:
> I actually spent an evening away from the computer.

No problem at all of course.

[ snip explanations ]
> All that is probably more than you want to know, but it does high-light the
> fact that once the object file is disassociated from its directory or  
> original name, and by implication it's .ti and .ii file, it becomes 
> impossible for any prelink run to successfully recreate an object
> module if needed  later to resolve a needed instantiation.

ACK.  Actually, thank you for the detailed explanations, they really
help.  I have one question left:

> relocatable objects:  This, like archives, must have a prelink phase forced 
> before
>                      using the linker to create a relocatable object from C++
>                      object files containing template references that may
>                      be undefined.
> So for the specific example below
> : Can you show how it would need to work?  If libtool reloads
> :   a.o b.o c.o             -> libfoo-1.o
> CC -Tprelink_objects a.o b.o c.o
> /bin/ls -r a.o b.o c.o -o libfoo-1.o
> :   d.o e.o f.o libfoo-1.o  -> libfoo-2.o
> CC -Tprelink_objects d.o e.o f.o libfoo.-1.o
>              # libfoo-1.o included allows templates already
>              # instantiated in the previous step to be seen
>              # and reused.

Is this an optimization only, or a necessary thing?  IOW, if I omit
libfoo-1.0 in this "CC -Tprelink_objects" line, would that only
pessimize link time, or could it affect the link result?

Anyway, I think the patch below should implement this (and add John to
THANKS).  Can you try it?  Thanks.

> /bin/ld d.o e.o f.o libfoo-1.o -o libfoo-2.o
> : and links
> :   g.o libfoo-2.o          ->
> CC -G g.o libfoo-2.o ...........
>              # CC will run the prelink on g.o if needed.

> I noticed that libtool.m4 has sections for the Portland Group C++ compiler.
> They like USL/SCO make use of the Edison Design Group C++ compiler frontend.
> Notice their use of the C++ compiler option "--prelink_objects".   I do not
> know the details of their implementation, but given the fact that they must
> force the template instantiation prelink phase for everything, they must not
> be doing an automatic template instantiation.   However, I strongly suspect
> that they too are FAILing the C++ template test(s) in cmdline_wrap_at.

I remember vaguely to have tested at least the normal template tests
back then; but at the time of

| commit 652709d6887c0bfaf227fdd6ec31523f5e9bd99b
| Author: Ralf Wildenhues <address@hidden>
| Date:   Thu Apr 7 17:58:26 2005 +0000
|     Improved Portland support: prelinking of C++ templates and whole_archive.

the cmdline_wrap test did not exist yet, so assuming it's broken is
sensible.  ;-)

Note to self: our testsuite should test reloadable object creation with
C++ and templates.


2009-02-28  Ralf Wildenhues  <address@hidden>

        Fix low max_cmd_len template test on UnixWare.
        * libltdl/config/ltmain.m4sh (func_mode_link): When expanding
        $reload_cmds, always put objects in $reload_objs rather than
        adding them to the command line, to allow more general command
        lines in reload_cmds.  Ensure $reload_objs contains a leading
        * libltdl/m4/libtool.m4 (_LT_LANG_CXX_CONFIG) [sysv5*,
        sco3.2v5*, sco5v6*] <reload_cmds>: For CC, invoke prelinker
        before creating reloadable object.
        * THANKS: Update.
        Report and analysis by Tim Rice and John Wolfe.

diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh
index 7fcf4cb..fd5b1c7 100644
--- a/libltdl/config/ltmain.m4sh
+++ b/libltdl/config/ltmain.m4sh
@@ -6923,17 +6923,19 @@ EOF
                  # command to the queue.
                  if test "$k" -eq 1 ; then
                    # The first file doesn't have a previous command to add.
-                   eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
+                   reload_objs=$objlist
+                   eval concat_cmds=\"$reload_cmds\"
                    # All subsequent reloadable object files will link in
                    # the last one created.
-                   eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist 
$last_robj~\$RM $last_robj\"
+                   reload_objs="$objlist $last_robj"
+                   eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM 
                  func_arith $k + 1
-                 objlist=$obj
+                 objlist=" $obj"
                  func_len " $last_robj"
                  func_arith $len0 + $func_len_result
@@ -6943,7 +6945,8 @@ EOF
              # reloadable object file.  All subsequent reloadable object
              # files will link in the last one created.
              test -z "$concat_cmds" || concat_cmds=$concat_cmds~
-             eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist 
+             reload_objs="$objlist $last_robj"
+             eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
              if test -n "$last_robj"; then
                eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
index 51e8910..1fe65a9 100644
--- a/libltdl/m4/libtool.m4
+++ b/libltdl/m4/libtool.m4
@@ -6221,6 +6221,7 @@ if test "$_lt_caught_CXX_error" != yes; then
            _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G 
${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs 
            _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~
              '"$_LT_TAGVAR(old_archive_cmds, $1)"
+           _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~$CC 
-r -o $output$reload_objs'
            _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib 
$libobjs $deplibs $compiler_flags'

reply via email to

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