This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

[PATCH] Fix PR43021


This fixes a regression in the driver where we no longer accept
input files which contain a '@'.  This is due to the LTO static
archive special-casing of name@offset.  The following patch
simply makes some extra checks before going that path.

Bootstrap & regtest running.

Richard.

2010-02-10  Richard Guenther  <rguenther@suse.de>

	PR driver/43021
	* gcc.c (process_command): Perform extra checks before accepting
	an input as composed filename + offset.

Index: gcc/gcc.c
===================================================================
*** gcc/gcc.c	(revision 156652)
--- gcc/gcc.c	(working copy)
*************** process_command (int argc, const char **
*** 4580,4592 ****
  #ifdef HAVE_TARGET_OBJECT_SUFFIX
  	  argv[i] = convert_filename (argv[i], 0, access (argv[i], F_OK));
  #endif
!           if (!p)
              fname = xstrdup (argv[i]);
            else
              {
                fname = (char *)xmalloc (p - argv[i] + 1);
                memcpy (fname, argv[i], p - argv[i]);
                fname[p - argv[i]] = '\0';
              }
  
            if (strcmp (fname, "-") != 0 && access (fname, F_OK) < 0)
--- 4580,4603 ----
  #ifdef HAVE_TARGET_OBJECT_SUFFIX
  	  argv[i] = convert_filename (argv[i], 0, access (argv[i], F_OK));
  #endif
! 	  /* For LTO static archive support we handle input file
! 	     specifications that are composed of a filename and
! 	     an offset like FNAME@OFFSET.  */
!           if (!p
! 	      || p == argv[i])
              fname = xstrdup (argv[i]);
            else
              {
                fname = (char *)xmalloc (p - argv[i] + 1);
                memcpy (fname, argv[i], p - argv[i]);
                fname[p - argv[i]] = '\0';
+ 	      /* Only accept non-stdin and existing FNAME parts, otherwise
+ 		 try with the full name.  */
+ 	      if (strcmp (fname, "-") == 0 || access (fname, F_OK) < 0)
+ 		{
+ 		  free (fname);
+ 		  fname = xstrdup (argv[i]);
+ 		}
              }
  
            if (strcmp (fname, "-") != 0 && access (fname, F_OK) < 0)


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