From: Ian Rickards <irickard@arm.com>
authorRichard Earnshaw <richard.earnshaw@arm.com>
Wed, 17 Jul 2002 12:17:18 +0000 (12:17 +0000)
committerRichard Earnshaw <richard.earnshaw@arm.com>
Wed, 17 Jul 2002 12:17:18 +0000 (12:17 +0000)
* dwarf2.c (concat_filename): If we can't establish the directory
just return the filename.

bfd/ChangeLog
bfd/dwarf2.c

index cb66ee74e85a2c874f08f29036920d44ed666c5c..f8e4100848e6c75a2ba4dc8cf06760c28c07a79d 100644 (file)
@@ -1,3 +1,8 @@
+2002-07-17  Ian Rickards  <irickard@arm.com>
+
+       * dwarf2.c (concat_filename): If we can't establish the directory 
+       just return the filename.
+
 2002-07-16  Moritz Jodeit  <moritz@jodeit.org>
 
        * peXXigen.c (_bfd_XXi_swap_aouthdr_out): Correct order of memset args.
index 005a21f7d3b2a4e94876a20e19cbc1dbeb7a5127..9c5e7b8d173652d88bfae7943f584885300e3209 100644 (file)
@@ -856,13 +856,18 @@ concat_filename (table, file)
   filename = table->files[file - 1].name;
   if (IS_ABSOLUTE_PATH(filename))
     return filename;
-
   else
     {
       char* dirname = (table->files[file - 1].dir
                       ? table->dirs[table->files[file - 1].dir - 1]
                       : table->comp_dir);
-      return (char*) concat (dirname, "/", filename, NULL);
+
+      /* Not all tools set DW_AT_comp_dir, so dirname may be unknown.  The
+        best we can do is return the filename part.  */
+      if (dirname == NULL)
+       return filename;
+      else
+       return (char*) concat (dirname, "/", filename, NULL);
     }
 }