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 add program headers if -n or -N


I committed this patch to gold to not add the program headers to a
PT_LOAD segment when using a linker script with -n or -N.  I believe
this corresponds to the GNU linker behaviour.

Ian


2009-06-22  Ian Lance Taylor  <iant@google.com>

	* script-sections.cc (Script_sections::create_segments): Don't put
	program headers in a PT_LOAD segment if -n or -N.


Index: script-sections.cc
===================================================================
RCS file: /cvs/src/src/gold/script-sections.cc,v
retrieving revision 1.18
diff -p -u -r1.18 script-sections.cc
--- script-sections.cc	19 Mar 2009 05:51:49 -0000	1.18
+++ script-sections.cc	23 Jun 2009 05:57:08 -0000
@@ -2981,6 +2981,11 @@ Script_sections::create_segments(Layout*
   if (first_seg == NULL)
     return NULL;
 
+  // -n or -N mean that the program is not demand paged and there is
+  // -no need to put the program headers in a PT_LOAD segment.
+  if (parameters->options().nmagic() || parameters->options().omagic())
+    return NULL;
+
   size_t sizeof_headers = this->total_header_size(layout);
 
   uint64_t vma = first_seg->vaddr();

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