Module Name:    src
Committed By:   christos
Date:           Tue Aug 29 20:39:17 UTC 2023

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

Log Message:
When we try to find the compat32 dynamic linker, strip out the arch-specific
string (sparc:v8plus -> sparc).


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 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.11 src/external/gpl3/gdb/dist/gdb/solib.c:1.12
--- src/external/gpl3/gdb/dist/gdb/solib.c:1.11	Mon Jul 31 13:00:50 2023
+++ src/external/gpl3/gdb/dist/gdb/solib.c	Tue Aug 29 16:39:17 2023
@@ -476,18 +476,20 @@ solib_bfd_open (const char *pathname)
   b = gdbarch_bfd_arch_info (target_gdbarch ());
   if (!b->compatible (b, bfd_get_arch_info (abfd.get ())))
     {
-      char buf[SO_NAME_MAX_PATH_SIZE];
       const char *slash = strrchr(pathname, '/');
       if (slash)
         {
+	  char buf[SO_NAME_MAX_PATH_SIZE], arch[128], *colon;
           struct stat st;
 
-	  snprintf(buf, sizeof(buf), "%.*s/%s/%s", 
-	    (int)(slash - pathname), pathname, b->printable_name, slash + 1);
+	  strlcpy(arch, b->printable_name, sizeof(arch));
+	  if ((colon = strchr(arch, ':')) != NULL)
+		*colon = '\0';
+	  snprintf(buf, sizeof(buf), "%.*s/%s/%s",
+	    (int)(slash - pathname), pathname, arch, slash + 1);
 	  if (stat(buf, &st) == 0)
 	    return solib_bfd_open(buf);
-	  snprintf(buf, sizeof(buf), "%s-%s", 
-	    pathname, b->printable_name);
+	  snprintf(buf, sizeof(buf), "%s-%s", pathname, arch);
 	  if (stat(buf, &st) == 0)
 	    return solib_bfd_open(buf);
 	}

Reply via email to