* emultempl/spuelf.em (embedded_spu_file): Test for NULL path
authorAlan Modra <amodra@gmail.com>
Wed, 11 Jul 2007 22:58:09 +0000 (22:58 +0000)
committerAlan Modra <amodra@gmail.com>
Wed, 11 Jul 2007 22:58:09 +0000 (22:58 +0000)
before calling base_name, not after.

ld/ChangeLog
ld/emultempl/spuelf.em

index 96158f6..bf73bb4 100644 (file)
@@ -1,3 +1,8 @@
+2007-07-12  Alan Modra  <amodra@bigpond.net.au>
+
+       * emultempl/spuelf.em (embedded_spu_file): Test for NULL path
+       before calling base_name, not after.
+
 2007-07-10  Alan Modra  <amodra@bigpond.net.au>
 
        * scripttempl/elf.sc (DISCARDED): Renamed from STACKNOTE.  Add
index abcb6b5..2235143 100644 (file)
@@ -345,19 +345,19 @@ embedded_spu_file (lang_input_statement_type *entry, const char *flags)
   for (search = (lang_input_statement_type *) input_file_chain.head;
        search != NULL;
        search = (lang_input_statement_type *) search->next_real_file)
-    {
-      const char *infile = base_name (search->filename);
+    if (search->filename != NULL)
+      {
+       const char *infile = base_name (search->filename);
 
-      if (infile != NULL
-         && strncmp (infile, "crtbegin", 8) == 0)
-       {
-         if (infile[8] == 'S')
-           flags = concat (flags, " -fPIC", NULL);
-         else if (infile[8] == 'T')
-           flags = concat (flags, " -fpie", NULL);
-         break;
-       }
-    }
+       if (strncmp (infile, "crtbegin", 8) == 0)
+         {
+           if (infile[8] == 'S')
+             flags = concat (flags, " -fPIC", NULL);
+           else if (infile[8] == 'T')
+             flags = concat (flags, " -fpie", NULL);
+           break;
+         }
+      }
 
   /* Use fork() and exec() rather than system() so that we don't
      need to worry about quoting args.  */