aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/lto-plugin
diff options
context:
space:
mode:
authorBen Cheng <bccheng@google.com>2014-04-22 20:33:12 (GMT)
committerBen Cheng <bccheng@google.com>2014-04-22 20:33:12 (GMT)
commite3cc64dec20832769406aa38cde83c7dd4194bf4 (patch)
treeef8e39be37cfe0cb69d850043b7924389ff17164 /gcc-4.9/lto-plugin
parentf33c7b3122b1d7950efa88067c9a156229ba647b (diff)
downloadtoolchain_gcc-e3cc64dec20832769406aa38cde83c7dd4194bf4.zip
toolchain_gcc-e3cc64dec20832769406aa38cde83c7dd4194bf4.tar.gz
toolchain_gcc-e3cc64dec20832769406aa38cde83c7dd4194bf4.tar.bz2
[4.9] GCC 4.9.0 official release refresh
Change-Id: Ic99a7da8b44b789a48aeec93b33e93944d6e6767
Diffstat (limited to 'gcc-4.9/lto-plugin')
-rw-r--r--gcc-4.9/lto-plugin/ChangeLog13
-rw-r--r--gcc-4.9/lto-plugin/lto-plugin.c49
2 files changed, 50 insertions, 12 deletions
diff --git a/gcc-4.9/lto-plugin/ChangeLog b/gcc-4.9/lto-plugin/ChangeLog
index 73688cd..af21cf8 100644
--- a/gcc-4.9/lto-plugin/ChangeLog
+++ b/gcc-4.9/lto-plugin/ChangeLog
@@ -1,3 +1,16 @@
+2014-04-22 Release Manager
+
+ * GCC 4.9.0 released.
+
+2014-04-02 Richard Biener <rguenther@suse.de>
+
+ * lto-plugin.c (onload): Fail to load if -fno-use-linker-plugin
+ is set in COLLECT_GCC_OPTIONS.
+
+2014-03-28 Richard Biener <rguenther@suse.de>
+
+ * lto-plugin.c (process_symtab): Handle EINTR and short reads.
+
2014-03-17 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* configure.ac (ac_lto_plugin_ldflags): Set to -Wc,-static-libgcc
diff --git a/gcc-4.9/lto-plugin/lto-plugin.c b/gcc-4.9/lto-plugin/lto-plugin.c
index 6f31ed2..910e23c 100644
--- a/gcc-4.9/lto-plugin/lto-plugin.c
+++ b/gcc-4.9/lto-plugin/lto-plugin.c
@@ -39,6 +39,7 @@ along with this program; see the file COPYING3. If not see
#include <stdint.h>
#endif
#include <assert.h>
+#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -817,7 +818,7 @@ process_symtab (void *data, const char *name, off_t offset, off_t length)
{
struct plugin_objfile *obj = (struct plugin_objfile *)data;
char *s;
- char *secdata;
+ char *secdatastart, *secdata;
if (strncmp (name, LTO_SECTION_PREFIX, LTO_SECTION_PREFIX_LEN) != 0)
return 1;
@@ -825,23 +826,40 @@ process_symtab (void *data, const char *name, off_t offset, off_t length)
s = strrchr (name, '.');
if (s)
sscanf (s, ".%" PRI_LL "x", &obj->out->id);
- secdata = xmalloc (length);
+ secdata = secdatastart = xmalloc (length);
offset += obj->file->offset;
- if (offset != lseek (obj->file->fd, offset, SEEK_SET)
- || length != read (obj->file->fd, secdata, length))
+ if (offset != lseek (obj->file->fd, offset, SEEK_SET))
+ goto err;
+
+ do
{
- if (message)
- message (LDPL_FATAL, "%s: corrupt object file", obj->file->name);
- /* Force claim_file_handler to abandon this file. */
- obj->found = 0;
- free (secdata);
- return 0;
+ ssize_t got = read (obj->file->fd, secdata, length);
+ if (got == 0)
+ break;
+ else if (got > 0)
+ {
+ secdata += got;
+ length -= got;
+ }
+ else if (errno != EINTR)
+ goto err;
}
+ while (length > 0);
+ if (length > 0)
+ goto err;
- translate (secdata, secdata + length, obj->out);
+ translate (secdatastart, secdata, obj->out);
obj->found++;
- free (secdata);
+ free (secdatastart);
return 1;
+
+err:
+ if (message)
+ message (LDPL_FATAL, "%s: corrupt object file", obj->file->name);
+ /* Force claim_file_handler to abandon this file. */
+ obj->found = 0;
+ free (secdatastart);
+ return 0;
}
/* Callback used by gold to check if the plugin will claim FILE. Writes
@@ -1049,5 +1067,12 @@ onload (struct ld_plugin_tv *tv)
"could not register the all_symbols_read callback");
}
+ /* Support -fno-use-linker-plugin by failing to load the plugin
+ for the case where it is auto-loaded by BFD. */
+ char *collect_gcc_options = getenv ("COLLECT_GCC_OPTIONS");
+ if (collect_gcc_options
+ && strstr (collect_gcc_options, "'-fno-use-linker-plugin'"))
+ return LDPS_ERR;
+
return LDPS_OK;
}