- BFD_ASSERT (strlen (dir) != 0);
-
- /* Strip off filename part. */
- for (i = strlen (dir) - 1; i >= 0; i--)
- if (IS_DIR_SEPARATOR (dir[i]))
+ memcpy (dir, abfd->filename, dirlen);
+ dir[dirlen] = '\0';
+
+ /* Compute the canonical name of the bfd object with all symbolic links
+ resolved, for use in the global debugfile directory. */
+ canon_dir = lrealpath (abfd->filename);
+ for (canon_dirlen = strlen (canon_dir); canon_dirlen > 0; canon_dirlen--)
+ if (IS_DIR_SEPARATOR (canon_dir[canon_dirlen - 1]))