Gold linker patch to split unlikely text into a separate segment
Cary Coutant
ccoutant@gmail.com
Fri Oct 20 00:47:00 GMT 2017
>> 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
More information about the Binutils
mailing list