Commit f68df07c by Richard Guenther Committed by Richard Biener

re PR driver/43021 (Driver no longer handles fancy names)

2010-02-11  Richard Guenther  <rguenther@suse.de>

	PR driver/43021
	* gcc.c (process_command): Handle LTO file@offset case more
	appropriately.

	lto/
	* lto-elf.c (lto_elf_file_open): Handle file@offset case more
	appropriately.

From-SVN: r156695
parent 8f6aedba
2010-02-11 Richard Guenther <rguenther@suse.de>
PR driver/43021
* gcc.c (process_command): Handle LTO file@offset case more
appropriately.
2010-02-11 Jakub Jelinek <jakub@redhat.com> 2010-02-11 Jakub Jelinek <jakub@redhat.com>
* reload1.c (eliminate_regs_1): If insn is DEBUG_INSN, avoid any * reload1.c (eliminate_regs_1): If insn is DEBUG_INSN, avoid any
......
...@@ -4575,20 +4575,35 @@ process_command (int argc, const char **argv) ...@@ -4575,20 +4575,35 @@ process_command (int argc, const char **argv)
} }
else else
{ {
const char *p = strchr (argv[i], '@'); const char *p = strrchr (argv[i], '@');
char *fname; char *fname;
long offset;
int consumed;
#ifdef HAVE_TARGET_OBJECT_SUFFIX #ifdef HAVE_TARGET_OBJECT_SUFFIX
argv[i] = convert_filename (argv[i], 0, access (argv[i], F_OK)); argv[i] = convert_filename (argv[i], 0, access (argv[i], F_OK));
#endif #endif
if (!p) /* For LTO static archive support we handle input file
fname = xstrdup (argv[i]); specifications that are composed of a filename and
else an offset like FNAME@OFFSET. */
{ if (p
&& p != argv[i]
&& sscanf (p, "@%li%n", &offset, &consumed) >= 1
&& strlen (p) == (unsigned int)consumed)
{
fname = (char *)xmalloc (p - argv[i] + 1); fname = (char *)xmalloc (p - argv[i] + 1);
memcpy (fname, argv[i], p - argv[i]); memcpy (fname, argv[i], p - argv[i]);
fname[p - argv[i]] = '\0'; fname[p - argv[i]] = '\0';
} /* Only accept non-stdin and existing FNAME parts, otherwise
try with the full name. */
if (strcmp (fname, "-") == 0 || access (fname, F_OK) < 0)
{
free (fname);
fname = xstrdup (argv[i]);
}
}
else
fname = xstrdup (argv[i]);
if (strcmp (fname, "-") != 0 && access (fname, F_OK) < 0) if (strcmp (fname, "-") != 0 && access (fname, F_OK) < 0)
{ {
perror_with_name (fname); perror_with_name (fname);
......
2010-02-11 Richard Guenther <rguenther@suse.de>
PR driver/43021
* lto-elf.c (lto_elf_file_open): Handle file@offset case more
appropriately.
2010-01-11 Andy Hutchinson <hutchinsonandy@gcc.gnu.org> 2010-01-11 Andy Hutchinson <hutchinsonandy@gcc.gnu.org>
* lto.c (O_BINARY): Define. * lto.c (O_BINARY): Define.
......
...@@ -550,35 +550,33 @@ lto_elf_file_open (const char *filename, bool writable) ...@@ -550,35 +550,33 @@ lto_elf_file_open (const char *filename, bool writable)
lto_elf_file *elf_file; lto_elf_file *elf_file;
lto_file *result = NULL; lto_file *result = NULL;
off_t offset; off_t offset;
long loffset;
off_t header_offset; off_t header_offset;
const char *offset_p; const char *offset_p;
char *fname; char *fname;
int consumed;
offset_p = strchr (filename, '@'); offset_p = strrchr (filename, '@');
if (!offset_p) if (offset_p
&& offset_p != filename
&& sscanf (offset_p, "@%li%n", &loffset, &consumed) >= 1
&& strlen (offset_p) == (unsigned int)consumed)
{ {
fname = xstrdup (filename);
offset = 0;
header_offset = 0;
}
else
{
/* The file started with '@' is a file containing command line
options. Stop if it doesn't exist. */
if (offset_p == filename)
fatal_error ("command line option file '%s' does not exist",
filename);
fname = (char *) xmalloc (offset_p - filename + 1); fname = (char *) xmalloc (offset_p - filename + 1);
memcpy (fname, filename, offset_p - filename); memcpy (fname, filename, offset_p - filename);
fname[offset_p - filename] = '\0'; fname[offset_p - filename] = '\0';
offset_p += 3; /* skip the @0x */ offset = (off_t)loffset;
offset = lto_parse_hex (offset_p);
/* elf_rand expects the offset to point to the ar header, not the /* elf_rand expects the offset to point to the ar header, not the
object itself. Subtract the size of the ar header (60 bytes). object itself. Subtract the size of the ar header (60 bytes).
We don't uses sizeof (struct ar_hd) to avoid including ar.h */ We don't uses sizeof (struct ar_hd) to avoid including ar.h */
header_offset = offset - 60; header_offset = offset - 60;
} }
else
{
fname = xstrdup (filename);
offset = 0;
header_offset = 0;
}
/* Set up. */ /* Set up. */
elf_file = XCNEW (lto_elf_file); elf_file = XCNEW (lto_elf_file);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment