This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Gold linker patch to split unlikely text into a separate segment
- From: Cary Coutant <ccoutant at gmail dot com>
- To: Sriraman Tallam <tmsriram at google dot com>
- Cc: "H.J. Lu" <hjl dot tools at gmail dot com>, Krzysztof Pszeniczny <kpszeniczny at google dot com>, Chris Kennelly <ckennelly at google dot com>, Xinliang David Li <davidxl at google dot com>, Stephane Eranian <eranian at google dot com>, binutils <binutils at sourceware dot org>
- Date: Thu, 19 Oct 2017 17:47:39 -0700
- Subject: Re: Gold linker patch to split unlikely text into a separate segment
- Authentication-results: sourceware.org; auth=none
- References: <CAAs8HmxCpQrbpw8YTLx6zGhTn5XqEp_TBn5_h7v4wTwSHQsQPg@mail.gmail.com> <CAMe9rOpjtiGPQ=zLB4kFgBfamusoYv1ZGkUgnEqt5N+FmiL1_A@mail.gmail.com> <CAAs8Hmx6-TAV5UVjYKzLL70=E=5xWMCb-g6db3EPa=uzMwxF-g@mail.gmail.com> <CAMe9rOoPkLgh6GX=VfBXsfNnVOaz3wr8QQnEzWnBGni3cqZmsQ@mail.gmail.com> <CAAs8Hmw3g7ULov0C8k+ywP8aMM-8gyRu3Ft9FeurpHSP4PBO5A@mail.gmail.com> <CAAs8Hmwmnk=D=cXUdNQuryRFv2yr8Vgk7B3KvwB8Cu-OpPPvnQ@mail.gmail.com> <CAAs8Hmy7=MRfVGTqFuSmT5ja464uTsJ+LjLUqYehPfNz24GV0A@mail.gmail.com> <CAJimCsHyDU172JMjH7tNqT+F5Gc-vj9CkcSgaUrd70Y7OYko=g@mail.gmail.com> <CAAs8HmxhV08ETQ8UxofLs6P5Jamw3pvTdef23WNVWCvoA-W=aA@mail.gmail.com>
>> Do you want to call set_is_unique_segment() for .text.unlikely
>> sections? That sounds wrong to me. If that's the right thing to do,
>> please explain in a comment.
>
> Yes, I want the final binary to be like this:
>
> Elf file type is EXEC (Executable file)
> Entry point 0x400560
> There are 10 program headers, starting at offset 64
>
> Program Headers:
> Type Offset VirtAddr PhysAddr
> FileSiz MemSiz Flags Align
>
> ....
>
> LOAD 0x0000000000000000 0x0000000000400000 0x0000000000400000
> 0x0000000000000970 0x0000000000000970 R E 1000
> LOAD 0x0000000000000970 0x0000000000401970 0x0000000000401970
> 0x000000000000000b 0x000000000000000b R E 1000
> LOAD 0x0000000000000de8 0x0000000000402de8 0x0000000000402de8
> ...
>
>
> Section to Segment mapping:
> Segment Sections...
> ...
> 02 .interp .note.ABI-tag .note.gnu.build-id .dynsym .dynstr
> .gnu.hash .hash .gnu.version .gnu.version_r .rela.dyn .rela.plt .init
> .plt .text .fini .rodata .eh_frame .eh_frame_hdr
> 03 .text.unlikely
> 04 .ctors .dtors .jcr .dynamic .got .got.plt .data .bss
>
>
> One more PT_LOAD segment for .text.unlikely which can only be done
> with set_is_unique_segment.
Won't that put *each* .text.unlikely section in its own unique
segment? Don't you want one segment containing all .text.unlikely
sections?
I guess I need to study how
Layout::attach_allocated_section_to_segment() works a little harder.
Maybe I'm just being misled by the name of the flag.
-cary