diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-02-11 12:23:08 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-02-11 12:23:08 +0000 |
commit | 2bd888dc62ee6298b759613c47a05300bd23e8ba (patch) | |
tree | b5c6ba211c6d44152757721aa56c71c41a65aff2 /gcc/lto | |
parent | 39e30dc75a1949049827d21e152797965195ff5a (diff) | |
download | gcc-2bd888dc62ee6298b759613c47a05300bd23e8ba.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@156695 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/lto')
-rw-r--r-- | gcc/lto/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/lto/lto-elf.c | 30 |
2 files changed, 20 insertions, 16 deletions
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index a726d32f5bb..58e51231bf1 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,9 @@ +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> * lto.c (O_BINARY): Define. diff --git a/gcc/lto/lto-elf.c b/gcc/lto/lto-elf.c index b70648d4680..356e5139536 100644 --- a/gcc/lto/lto-elf.c +++ b/gcc/lto/lto-elf.c @@ -550,35 +550,33 @@ lto_elf_file_open (const char *filename, bool writable) lto_elf_file *elf_file; lto_file *result = NULL; off_t offset; + long loffset; off_t header_offset; const char *offset_p; char *fname; + int consumed; - offset_p = strchr (filename, '@'); - if (!offset_p) + offset_p = strrchr (filename, '@'); + 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); memcpy (fname, filename, offset_p - filename); fname[offset_p - filename] = '\0'; - offset_p += 3; /* skip the @0x */ - offset = lto_parse_hex (offset_p); + offset = (off_t)loffset; /* elf_rand expects the offset to point to the ar header, not the object itself. Subtract the size of the ar header (60 bytes). We don't uses sizeof (struct ar_hd) to avoid including ar.h */ header_offset = offset - 60; } + else + { + fname = xstrdup (filename); + offset = 0; + header_offset = 0; + } /* Set up. */ elf_file = XCNEW (lto_elf_file); |