+2015-02-10 H.J. Lu <hongjiu.lu@intel.com>
+
+ * plugin.c (get_view): Align offset passed to mmap.
+
2015-02-08 H.J. Lu <hongjiu.lu@intel.com>
* ldfile.c (ldfile_try_open_bfd): Don't call bfd_check_format
plugin_input_file_t *input = (plugin_input_file_t *) handle;
char *buffer;
size_t size = input->filesize;
+#if HAVE_GETPAGESIZE
+ off_t offset, bias;
+#endif
ASSERT (called_plugin);
input->view_buffer.offset = input->offset;
#if HAVE_MMAP
- buffer = mmap (NULL, size, PROT_READ, MAP_PRIVATE, input->fd,
- input->offset);
- if (buffer == MAP_FAILED)
+# if HAVE_GETPAGESIZE
+ bias = input->offset % getpagesize ();;
+ offset = input->offset - bias;
+ size += bias;
+# endif
+ buffer = mmap (NULL, size, PROT_READ, MAP_PRIVATE, input->fd, offset);
+ if (buffer != MAP_FAILED)
+ buffer += bias;
+ else
#endif
{
char *p;