Message ID | 20190621163802.29808-4-roger.pau@citrix.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | misc improvements | expand |
>>> On 21.06.19 at 18:38, <roger.pau@citrix.com> wrote: > if the hypervisor has been built with EFI support (ie: multiboot2). > This allows to position the .reloc section correctly in the output > binary. The title still says "add ... to ELF binary", when really such a section is already there (and in fact that's the problem you're trying to work around). As mentioned before, if anything you add mention of the section to the linker script, but not to the ELF binary (afaict). > Note that for the ELF output format the .reloc section is moved before > .bss for two reasons: in order for the resulting binary to not contain > any section with data after .bss, so that the file size can be smaller > than the loaded memory size, Sounds like another linker quirk then. I didn't think there was a requirement for image and file offsets to go in lock step. There is some correlation iirc, but the sentence may want weakening a little. > and because the data it contains is > read-only, so it belongs with the other sections containing read-only > data. I can accept this one (as a secondary argument). Jan
diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S index 98a99444c2..19aa4332cf 100644 --- a/xen/arch/x86/xen.lds.S +++ b/xen/arch/x86/xen.lds.S @@ -175,6 +175,14 @@ SECTIONS } :text #endif #endif + +#if defined(XEN_BUILD_EFI) && !defined(EFI) + . = ALIGN(4); + DECL_SECTION(.reloc) { + *(.reloc) + } :text +#endif + _erodata = .; . = ALIGN(SECTION_ALIGN);
if the hypervisor has been built with EFI support (ie: multiboot2). This allows to position the .reloc section correctly in the output binary. Note that for the ELF output format the .reloc section is moved before .bss for two reasons: in order for the resulting binary to not contain any section with data after .bss, so that the file size can be smaller than the loaded memory size, and because the data it contains is read-only, so it belongs with the other sections containing read-only data. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> --- Cc: Jan Beulich <jbeulich@suse.com> Cc: Andrew Cooper <andrew.cooper3@citrix.com> Cc: Wei Liu <wl@xen.org> --- changes sincce v1: - Move the .reloc section position in the output binary only for the ELF output format. --- xen/arch/x86/xen.lds.S | 8 ++++++++ 1 file changed, 8 insertions(+)