about summary refs log tree commit diff
path: root/elf/readlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'elf/readlib.c')
-rw-r--r--elf/readlib.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/elf/readlib.c b/elf/readlib.c
index 4d67c74136..f3129c4557 100644
--- a/elf/readlib.c
+++ b/elf/readlib.c
@@ -33,6 +33,7 @@
 #include <gnu/lib-names.h>
 
 #include <ldconfig.h>
+#include <endswith.h>
 
 #define Elf32_CLASS ELFCLASS32
 #define Elf64_CLASS ELFCLASS64
@@ -43,12 +44,14 @@ struct known_names
   int flag;
 };
 
-/* Check if string corresponds to a GDB Python file.  */
+/* Check if string corresponds to a GDB extension file.  */
 static bool
-is_gdb_python_file (const char *name)
+is_gdb_extension_file (const char *name)
 {
   size_t len = strlen (name);
-  return len > 7 && strcmp (name + len - 7, "-gdb.py") == 0;
+  return (endswithn (name, len, "-gdb.gdb")
+	  || endswithn (name, len, "-gdb.py")
+	  || endswithn (name, len, "-gdb.scm"));
 }
 
 /* Returns 0 if everything is ok, != 0 in case of error.  */
@@ -145,7 +148,7 @@ process_file (const char *real_file_name, const char *file_name,
       size_t len = MIN (statbuf.st_size, 512);
       if (memmem (file_contents, len, "GROUP", 5) == NULL
 	  && memmem (file_contents, len, "GNU ld script", 13) == NULL
-	  && !is_gdb_python_file (file_name))
+	  && !is_gdb_extension_file (file_name))
 	error (0, 0, _("%s is not an ELF file - it has the wrong magic bytes at the start.\n"),
 	       file_name);
       ret = 1;