[patch][gold] Don't put rodata and text in the same segment.

Rafael Espindola espindola@google.com
Thu Sep 2 01:53:00 GMT 2010
In native client the rodata section cannot be in the same segment as
text since the data will fail to validate. We have been using a linker
script, but maybe others also think it is a good idea to have rodata
in a non executable segment.

The change to attach_allocated_section_to_segment is the core of the
patch. The update to find_first_load_seg is because it would now find
a non-executable segment that was not the first segment after the
sorting. The change to set_segment_offsets fixes what I think is a
hidden bug. I think it was never noticed because the executable
segment was normally followed by a rw one.

2010-09-01  Rafael Espindola  <espindola@google.com>

	* layout.cc (Layout::attach_allocated_section_to_segment): Don't put
	sections with different PF_X flags in the same segment.
	(Layout::find_first_load_seg): Search all segments to find the first one.
	(Layout::set_segment_offsets): Align the address of a segment that follows an
	executable one.

Cheers,
-- 
Rafael Ávila de Espíndola
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rodata.patch
Type: application/octet-stream
Size: 2997 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20100902/2928960f/attachment.obj>


More information about the Binutils mailing list