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]

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


Rafael Espindola <espindola@google.com> writes:

> 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.

It's definitely not a good idea to always put read-only data in a
different segment.  That will introduce an additional segment to every
executable, which will force an additional mmap each time a program is
run.  That is not desirable.

I think it would be OK to have an option to put read-only data in a
different segment.

Ian


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