---- binutils-2.17.50.0.3/bfd/opncls.c.orig 2006-07-15 20:23:49.000000000 +0200
-+++ binutils-2.17.50.0.3/bfd/opncls.c 2006-09-02 10:21:33.212591250 +0200
-@@ -1215,6 +1215,10 @@
- return NULL;
- }
+--- binutils-2.35/bfd/opncls.c.orig 2020-07-24 11:12:19.000000000 +0200
++++ binutils-2.35/bfd/opncls.c 2020-07-25 10:12:04.006886866 +0200
+@@ -1232,6 +1232,15 @@ bfd_get_debug_link_info (bfd *abfd, unsi
+ return bfd_get_debug_link_info_1 (abfd, crc32_out);
+ }
-+ /* PLD: check the possible absolute debuginfo path (e.g. /usr/lib/debug/... */
-+ if (separate_debug_file_exists (basename, crc32))
-+ return basename;
++static char const*
++relaxed_filename (char const* filename)
++{
++ char const* relaxed = strstr (filename, "/usr/lib/debug/");
++ if ( relaxed != NULL )
++ return relaxed;
++ return filename;
++}
+
- dir = strdup (abfd->filename);
- if (dir == NULL)
+ /*
+ FUNCTION
+ bfd_get_alt_debug_link_info
+@@ -1438,6 +1447,11 @@ find_separate_debug_file (bfd * abfd,
+ if (include_dirs)
{
-@@ -1353,9 +1357,6 @@
+ const char *fname = bfd_get_filename (abfd);
++
++ /* PLD: check the possible absolute debuginfo path (e.g. /tmp/.../usr/lib/debug/... */
++ if (check_func (base, func_data))
++ return base;
++
+ for (dirlen = strlen (fname); dirlen > 0; dirlen--)
+ if (IS_DIR_SEPARATOR (fname[dirlen - 1]))
+ break;
+@@ -1667,8 +1681,7 @@ bfd_create_gnu_debuglink_section (bfd *a
return NULL;
}
- /* Strip off any path components in filename. */
- filename = lbasename (filename);
--
++ filename = relaxed_filename (filename);
+
sect = bfd_get_section_by_name (abfd, GNU_DEBUGLINK);
if (sect)
- {
-@@ -1439,10 +1440,6 @@
+@@ -1760,9 +1773,7 @@ bfd_fill_in_gnu_debuglink_section (bfd *
crc32 = bfd_calc_gnu_debuglink_crc32 (crc32, buffer, count);
fclose (handle);
- /* Strip off any path components in filename,
- now that we no longer need them. */
- filename = lbasename (filename);
--
- debuglink_size = strlen (filename) + 1;
- debuglink_size += 3;
- debuglink_size &= ~3;
++ filename = relaxed_filename (filename);
+
+ filelen = strlen (filename);
+ debuglink_size = filelen + 1;