--- 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); } +static char const* +relaxed_filename (char const* filename) +{ + char const* relaxed = strstr (filename, "/usr/lib/debug/"); + if ( relaxed != NULL ) + return relaxed; + return filename; +} + /* FUNCTION bfd_get_alt_debug_link_info @@ -1438,6 +1447,11 @@ find_separate_debug_file (bfd * abfd, if (include_dirs) { 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) @@ -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); + filename = relaxed_filename (filename); filelen = strlen (filename); debuglink_size = filelen + 1;