This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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()

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]