• Jan Beulich's avatar
    x86: fold sections in final binaries · 4b7fd815
    Jan Beulich authored
    
    
    Especially when linking a PE binary (xen.efi), standalone output
    sections are expensive: Often the linker will align the subsequent one
    on the section alignment boundary (2Mb) when the linker script doesn't
    otherwise place it. (I haven't been able to derive from observed
    behavior under what conditions it would not do so.)
    
    With gcov enabled (and with gcc11) I'm observing enough sections that,
    as of quite recently, the resulting image doesn't fit in 16Mb anymore,
    failing the final ASSERT() in the linker script. (That assertion is
    slated to go away, but that's a separate change.)
    
    Any destructor related sections can be discarded, as we never "exit"
    the hypervisor. This includes .text.exit, which is referenced from
    .dtors.*. Constructor related sections need to all be taken care of, not
    just those with historically used names: .ctors.* and .text.startup is
    what gcc11 populates. While there re-arrange ordering / sorting to match
    that used by the linker provided scripts.
    
    Finally, for xen.efi only, also discard .note.gnu.*. These are
    meaningless in a PE binary. Quite likely, while not meaningless there,
    the section is also of no use in ELF, but keep it there for now.
    Signed-off-by: default avatarJan Beulich <jbeulich@suse.com>
    Reviewed-by: default avatarRoger Pau Monné <roger.pau@citrix.com>
    4b7fd815
xen.lds.S 12.4 KB