summaryrefslogtreecommitdiff
path: root/binutils-absolute-gnu_debuglink-path.patch
blob: 9622b5895c2aabe95290c1cf6a9e17cf842a0869 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
--- 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 19:50:45.155718000 +0200
@@ -1215,6 +1215,10 @@
       return NULL;
     }
 
+  /* PLD: check the possible absolute debuginfo path (e.g. /tmp/.../usr/lib/debug/... */
+  if (separate_debug_file_exists (basename, crc32))
+    return basename;
+
   dir = strdup (abfd->filename);
   if (dir == NULL)
     {
@@ -1322,6 +1326,15 @@
   return find_separate_debug_file (abfd, dir);
 }
 
+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_create_gnu_debuglink_section
@@ -1353,8 +1366,7 @@
       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,9 +1451,7 @@
     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);
 
   debuglink_size = strlen (filename) + 1;
   debuglink_size += 3;