1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

Fix use of the getOpenFile api.

The gold plugin was passing the desired map size as the file size. This was
working for two reasons:
* Recent version of gold provide the get_view callback, so this code was not
  used.
* In older versions, getOpenFile was called, but the file size is never used
  if we don't require null terminated buffers and map size defaults to the
  file size.

Thanks to Eli Bendersky for noticing this.

I will try to make this api a bit less error prone.

llvm-svn: 186978
This commit is contained in:
Rafael Espindola 2013-07-23 18:44:31 +00:00
parent 0cc91bd60a
commit 8f45894865

View File

@ -253,8 +253,8 @@ static ld_plugin_status claim_file_hook(const ld_plugin_input_file *file,
offset = file->offset;
}
if (error_code ec =
MemoryBuffer::getOpenFile(file->fd, file->name, buffer, file->filesize,
-1, offset, false)) {
MemoryBuffer::getOpenFile(file->fd, file->name, buffer, -1,
file->filesize, offset, false)) {
(*message)(LDPL_ERROR, ec.message().c_str());
return LDPS_ERR;
}