From 70c7e485453fdbc228406715556f9447bc9f9fd8 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Tue, 23 Jul 2013 20:25:01 +0000 Subject: Split getOpenFile into getOpenFile and getOpenFileSlice. The main observation is that we never need both the filesize and the map size. When mapping a slice of a file, it doesn't make sense to request a null terminator and that would be the only case where the filesize would be used. There are other cleanups that should be done in this area: * A client should not have to pass the size (even an explicit -1) to say if it wants a null terminator or not, so we should probably swap the argument order. * The default should be to not require a null terminator. Very few clients require this, but many end up asking for it just because it is the default. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186984 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/gold/gold-plugin.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'tools/gold') diff --git a/tools/gold/gold-plugin.cpp b/tools/gold/gold-plugin.cpp index 133eca48e5..77717098d6 100644 --- a/tools/gold/gold-plugin.cpp +++ b/tools/gold/gold-plugin.cpp @@ -252,9 +252,8 @@ static ld_plugin_status claim_file_hook(const ld_plugin_input_file *file, if (file->offset) { offset = file->offset; } - if (error_code ec = - MemoryBuffer::getOpenFile(file->fd, file->name, buffer, -1, - file->filesize, offset, false)) { + if (error_code ec = MemoryBuffer::getOpenFileSlice( + file->fd, file->name, buffer, file->filesize, offset)) { (*message)(LDPL_ERROR, ec.message().c_str()); return LDPS_ERR; } -- cgit v1.2.3