[llvm] r186978 - Fix use of the getOpenFile api.
Rafael Espindola
rafael.espindola at gmail.com
Tue Jul 23 11:44:31 PDT 2013
Author: rafael
Date: Tue Jul 23 13:44:31 2013
New Revision: 186978
URL: http://llvm.org/viewvc/llvm-project?rev=186978&view=rev
Log:
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.
Modified:
llvm/trunk/tools/gold/gold-plugin.cpp
Modified: llvm/trunk/tools/gold/gold-plugin.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/gold/gold-plugin.cpp?rev=186978&r1=186977&r2=186978&view=diff
==============================================================================
--- llvm/trunk/tools/gold/gold-plugin.cpp (original)
+++ llvm/trunk/tools/gold/gold-plugin.cpp Tue Jul 23 13:44:31 2013
@@ -253,8 +253,8 @@ static ld_plugin_status claim_file_hook(
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;
}
More information about the llvm-commits
mailing list