This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
gold patch committed: Don't munmap if --keep-files-mapped
- From: Ian Lance Taylor <iant at google dot com>
- To: binutils at sourceware dot org
- Date: Wed, 09 Mar 2011 17:12:33 -0800
- Subject: gold patch committed: Don't munmap if --keep-files-mapped
This patch to gold avoids calling munmap on a whole file view if
--keep-files-mapped is used. We will have a whole file view if
--map-whole-files is true, as is the default on a 64-bit host. When we
want to map the entire file, calling munmap is just a waste of time.
Committed to mainline.
Ian
2011-03-09 Ian Lance Taylor <iant@google.com>
* fileread.cc (File_read::clear_views): Don't delete the whole
file view.
Index: fileread.cc
===================================================================
RCS file: /cvs/src/src/gold/fileread.cc,v
retrieving revision 1.70
diff -p -u -r1.70 fileread.cc
--- fileread.cc 9 Mar 2011 01:50:33 -0000 1.70
+++ fileread.cc 10 Mar 2011 01:06:49 -0000
@@ -717,7 +717,9 @@ File_read::clear_views(Clear_views_mode
should_delete = false;
else if (mode == CLEAR_VIEWS_ALL)
should_delete = true;
- else if (p->second->should_cache() && keep_files_mapped)
+ else if ((p->second->should_cache()
+ || p->second == this->whole_file_view_)
+ && keep_files_mapped)
should_delete = false;
else if (this->object_count_ > 1
&& p->second->accessed()