Hi Bertrand,
On 01/03/2022 13:30, Bertrand Marquis wrote:
On 1 Mar 2022, at 08:58, Jan Beulich <[email protected]> wrote:
On 01.03.2022 09:55, Jan Beulich wrote:
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: Jan Beulich <[email protected]>
Some of this will likely want mirroring to Arm as well, even if xen.efi
there isn't produced by the linker. Sections are better properly folded
even for ELF, and constructors not ending up in [__ctors_start,__ctors_end)
can surely not do any good.
I fully agree with that and it would make sense to do both changes together to
avoid differences between x86 and arm unless required.
Right now our discard section on arm is a lot shorter and I do not see why we
would need any of the sections that are discarded on x86.
Me neither.
As this needs testing and checking I do not think it makes sense for you to do
that right now.
@Stefano and Julien: I am ok to create myself a task to sync with x86 in the
next weeks/months, what do you think ?
I haven't looked in details the exact difference between two linker
scripts. After the sync, I would expect to be mostly similar.
We also have the RISCv and possibly soon PowerPC. So, I would consider
to consolidate the linker scripts if possible. This would help to keep
them in sync.
Anyway, as discussed on IRC, let's start with updating the Arm linker
scripts. We can then look at the differences.
Cheers,
--
Julien Grall