[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v3 1/3] x86/linker: add a reloc section to ELF linker script



On Thu, Jun 27, 2019 at 11:59:46AM +0100, Andrew Cooper wrote:
> On 27/06/2019 10:33, Roger Pau Monne wrote:
> > 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 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@xxxxxxxxxx>
> 
> I have to admit that I'm still confused as to why we need this in the
> first place.
> 
> The ELF build is linked to a fixed virtual address, irrespective of
> whether grub loads it via MB1 or MB2 and/or with EFI details.
> 
> i.e. the non-EFI build shouldn't have any remaining relocations by the
> time it is fully linked.
> 
> Or am I missing something?

Right, but there's code that depends on the symbols defined in .reloc
(__base_relocs_start/__base_relocs_end), so unless those symbols are
defined the linker will throw a missing symbols error on the final
link step.

I could add .reloc to the discarded sections list and create the
__base_relocs_start and __base_relocs_end symbols on the linker script
maybe, but I'm not sure that's any better than just having the dummy
.reloc section.

Or another option would be to compile the units that use those symbols
twice, one for the ELF build and one for the PE build, but again that
doesn't seem much better IMO.

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.