gold patch committed: Put .interp section in PT_INTERP segment

Ian Lance Taylor iant@google.com
Fri Jun 17 13:02:00 GMT 2011


This patch changes gold such that if creating a shared library, and
there is a .interp section, then gold will create a PT_INTERP segment
which holds the .interp section.  Also, if creating a shared library,
the --dynamic-linker option will cause gold to put the option value into
a .interp section in a PT_INTERP segment.  The --dynamic-linker option
overrides.  This is approximately what GNU ld does.  GNU ld behaves
oddly if there is a .interp section and the --dynamic-linker is used: it
seems to keep the contents of the .interp sectin with the length of the
--dynamic-linker option.  I did not attempt to recreate that.

Ian


2011-06-17  Ian Lance Taylor  <iant@google.com>

	PR gold/12880
	* layout.h (class Layout): Add interp_segment_ field.
	* layout.cc (Layout::Layout): Initialize interp_segment_ field.
	(Layout::attach_allocated_section_to_segment): If making shared
	library, put .interp section in PT_INTERP segment.
	(Layout::finalize): Also call create_interp if -dynamic-linker
	option was used.
	(Layout::create_interp): Assert that there is no PT_INTERP
	segment.  If not using a SECTIONS clause, use make_output_section.
	(Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
	* script-sections.cc
	(Script_sections::create_note_and_tls_segments): If making shared
	library, put .interp section in PT_INTERP segment.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.patch
Type: text/x-diff
Size: 7293 bytes
Desc: patch
URL: <https://sourceware.org/pipermail/binutils/attachments/20110617/498f5822/attachment.bin>


More information about the Binutils mailing list