Module Name:    src
Committed By:   christos
Date:           Fri Nov 22 01:48:50 UTC 2019

Modified Files:
        src/external/gpl3/gdb/dist/gdb: solib.c

Log Message:
Support for compat-32 type shared library paths.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/gpl3/gdb/dist/gdb/solib.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/gdb/dist/gdb/solib.c
diff -u src/external/gpl3/gdb/dist/gdb/solib.c:1.7 src/external/gpl3/gdb/dist/gdb/solib.c:1.8
--- src/external/gpl3/gdb/dist/gdb/solib.c:1.7	Sun May 26 17:40:01 2019
+++ src/external/gpl3/gdb/dist/gdb/solib.c	Thu Nov 21 20:48:50 2019
@@ -507,10 +507,27 @@ solib_bfd_open (const char *pathname)
   /* Check bfd arch.  */
   b = gdbarch_bfd_arch_info (target_gdbarch ());
   if (!b->compatible (b, bfd_get_arch_info (abfd.get ())))
-    warning (_("`%s': Shared library architecture %s is not compatible "
-               "with target architecture %s."), bfd_get_filename (abfd),
+    {
+      char buf[SO_NAME_MAX_PATH_SIZE];
+      char *slash = strrchr(pathname, '/');
+      if (slash)
+        {
+          struct stat st;
+
+	  snprintf(buf, sizeof(buf), "%.*s/%s/%s", 
+	    (int)(slash - pathname), pathname, b->printable_name, slash + 1);
+	  if (stat(buf, &st) == 0)
+	    return solib_bfd_open(buf);
+	  snprintf(buf, sizeof(buf), "%s-%s", 
+	    pathname, b->printable_name);
+	  if (stat(buf, &st) == 0)
+	    return solib_bfd_open(buf);
+	}
+      warning (_("`%s': Shared library architecture %s is not compatible "
+                 "with target architecture %s."), bfd_get_filename (abfd),
              bfd_get_arch_info (abfd.get ())->printable_name,
 	     b->printable_name);
+    }
 
   return abfd;
 }

Reply via email to