This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

tlink


Jason, you remember the `we don't instantiate templates when -r is
given' problem?  I was wondering if we want to add an option to
instantiate templates if we're doing a partial link?

We can do it always by default, or do it never, or do it when an
option is given.  Which do you prefer?  If you prefer an option, let
me know the spelling you prefer and the default, and I can add it.

The below enables gcc to instantiate templates, when -r is given,
always.

Doing diffs in collect2.c.~1~:
--------------
Doing diffs in tlink.c.~1~:
*** tlink.c.~1~	Tue Oct 28 18:11:27 1997
--- tlink.c	Wed Nov 19 18:03:32 1997
*************** void
*** 596,602 ****
  do_tlink (ld_argv, object_lst)
       char **ld_argv, **object_lst;
  {
!   int exit = tlink_execute ("ld", ld_argv, ldout);
  
    tlink_init ();
  
--- 596,636 ----
  do_tlink (ld_argv, object_lst)
       char **ld_argv, **object_lst;
  {
!   char **ld1_argv = ld_argv;
!   int argc = -1;
!   int rflag = 0;
!   int exit;
!   /* Instantiate templates when -r is given.  */
!   int instantiate_unknown = 1;
! 
!   if (instantiate_unknown)
!     {
!       while (ld_argv[++argc] != 0)
! 	{
! 	  if (strcmp (ld_argv[argc], "-r") == 0)
! 	    rflag = 1;
! 	}
!     }
! 
!   /* Strip -r so that we can do a trial full link to resolve template
!      things.  */
!   if (instantiate_unknown && rflag)
!     {
!       int arg1c = -1;
! 
!       ld1_argv = (char **) xcalloc (sizeof (char *), argc+1);
!       argc = -1;
!       while ((ld1_argv[++arg1c] = ld_argv[++argc]) != 0)
! 	{
! 	  if (strcmp (ld_argv[argc], "-r") == 0)
! 	    --arg1c;
! 	}
! 
!       /* Make sure the list ends if -r comes last.  */
!       ld1_argv[++arg1c] = 0;
!     }
! 
!   exit = tlink_execute ("ld", ld1_argv, ldout);
  
    tlink_init ();
  
*************** do_tlink (ld_argv, object_lst)
*** 606,612 ****
  
        /* Until collect does a better job of figuring out which are object
  	 files, assume that everything on the command line could be.  */
!       if (read_repo_files (ld_argv))
  	while (exit && i++ < MAX_ITERATIONS)
  	  {
  	    if (tlink_verbose >= 3)
--- 640,646 ----
  
        /* Until collect does a better job of figuring out which are object
  	 files, assume that everything on the command line could be.  */
!       if (read_repo_files (ld1_argv))
  	while (exit && i++ < MAX_ITERATIONS)
  	  {
  	    if (tlink_verbose >= 3)
*************** do_tlink (ld_argv, object_lst)
*** 618,625 ****
  	      break;
  	    if (tlink_verbose)
  	      fprintf (stderr, "collect: relinking\n");
! 	    exit = tlink_execute ("ld", ld_argv, ldout);
  	  }
      }
  
    dump_file (ldout);
--- 652,666 ----
  	      break;
  	    if (tlink_verbose)
  	      fprintf (stderr, "collect: relinking\n");
! 	    exit = tlink_execute ("ld", ld1_argv, ldout);
  	  }
+     }
+ 
+   if (instantiate_unknown
+       && rflag)
+     {
+       /* Now rerun with full arguments.  */
+       exit = tlink_execute ("ld", ld_argv, ldout);
      }
  
    dump_file (ldout);
--------------


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]