[PATCH] Don't issue errors on GDB Python files
Szabolcs Nagy
szabolcs.nagy@arm.com
Wed Jun 24 14:18:00 GMT 2015
On 24/06/15 11:30, H.J. Lu wrote:
> @@ -155,11 +162,14 @@ process_file (const char *real_file_name, const char *file_name,
> /* The file is neither ELF nor aout. Check if it's a linker
> script, like libc.so - otherwise complain. Only search the
> beginning of the file. */
> - 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)
> - error (0, 0, _("%s is not an ELF file - it has the wrong magic bytes at the start.\n"),
> - file_name);
> + if (!is_gdb_python_file (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)
> + error (0, 0, _("%s is not an ELF file - it has the wrong magic bytes at the start.\n"),
> + file_name);
> + }
> ret = 1;
> }
special-casing -gdb.py is ugly.
and these heuristics are fragile
(eg if the python script happened to be smaller than
an elf header then you would get a "too small" warning).
i think either the 'strstr (file_name, ".so") != NULL'
check at the begining of the function should be more
strict or just silently ignore any file with invalid
header.
More information about the Libc-alpha
mailing list