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: RFC: ELF: Add a "-z readonly" option to ld


On Tue, Nov 7, 2017 at 4:51 PM, Ian Lance Taylor <iant@google.com> wrote:
> On Tue, Nov 7, 2017 at 4:25 PM, H.J. Lu <hongjiu.lu@intel.com> wrote:
>> We currently put read-only sections in read-execute segment:
>>
>> Elf file type is DYN (Shared object file)
>> Entry point 0x3b0
>> There are 7 program headers, starting at offset 52
>>
>> Program Headers:
>>   Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
>>   LOAD           0x000000 0x00000000 0x00000000 0x00524 0x00524 R E 0x200000
>>   LOAD           0x000ef4 0x00200ef4 0x00200ef4 0x0012c 0x00130 RW  0x200000
>>   DYNAMIC        0x000f00 0x00200f00 0x00200f00 0x000e0 0x000e0 RW  0x4
>>   NOTE           0x000114 0x00000114 0x00000114 0x00024 0x00024 R   0x4
>>   GNU_EH_FRAME   0x00048c 0x0000048c 0x0000048c 0x00024 0x00024 R   0x4
>>   GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RW  0x10
>>   GNU_RELRO      0x000ef4 0x00200ef4 0x00200ef4 0x0010c 0x0010c R   0x1
>>
>>  Section to Segment mapping:
>>   Segment Sections...
>>    00     .note.gnu.build-id .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt .init .plt .plt.got .text .fini .rodata .eh_frame_hdr .eh_frame
>>    01     .init_array .fini_array .data.rel.ro .dynamic .got .got.plt .bss
>>    02     .dynamic
>>    03     .note.gnu.build-id
>>    04     .eh_frame_hdr
>>    05
>>    06     .init_array .fini_array .data.rel.ro .dynamic .got
>>
>> This patch adds a "-z readonly" option to ELF linker to place read-only
>> in separate read-only segments:
>
> Sounds like gold's --rosegment option.  Perhaps GNU ld could use the
> same option name?

--rosegment is OK for gold since gold is ELF-only linker.  Using
--rosegment for ld
could be odd for non-ELF target.   But I am OK with --rosegment if there are no
objections.

-- 
H.J.


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