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

Re: [Xen-devel] [PATCH] xen/x86: fix linker script to work with lld



On Wed, Jul 04, 2018 at 01:57:58AM -0600, Jan Beulich wrote:
> >>> On 03.07.18 at 18:02, <daniel.kiper@xxxxxxxxxx> wrote:
> > On Thu, Jun 28, 2018 at 11:35:24PM -0600, Jan Beulich wrote:
> >> >>> Roger Pau Monne <roger.pau@xxxxxxxxxx> 06/28/18 5:38 PM >>>
> >> >lld (the llvm linker) has some issues with Xen linker script. It
> >> >doesn't understand '||' in assert expressions:
> >> >
> >> >ld    -melf_x86_64_fbsd  -T xen.lds -N prelink.o --build-id=sha1 \
> >> >/root/src/xen/xen/common/symbols-dummy.o -o /root/src/xen/xen/.xen-syms.0
> >> >ld: error: xen.lds:260: malformed number: |
> >> >>>> ASSERT(__image_base__ > (((((((((261 >> 8) * 0xffff000000000000) | 
> >> >>>> (261 << 39)))
> > + ((1 << 39) / 2)) + (64 << 30)) + (1 << 30)) + (1 << 30))) ||
> >> >>>>
> >                                                                   ^
> >> >
> >> >And doesn't work properly with the 'DEFINED(foo) ? foo : ...'
> >> >expression:
> >> >
> >> >ld    -melf_x86_64_fbsd  -T xen.lds -N prelink.o --build-id=sha1 \
> >> >/root/src/xen/xen/common/symbols-dummy.o -o /root/src/xen/xen/.xen-syms.0
> >> >ld: error: xen.lds:233: symbol not found: efi
> >
> > This smells like lld bug. efi symbol is clearly undefined in prelink.o
> > (lld does not support i386pep emulation):
> >
> >  11147: 0000000000000000     0 NOTYPE  GLOBAL HIDDEN   UND efi
> >
> > However, surprisingly DEFINED() states that it is and ternary operator
> > fires address calculation from undefined symbol. So, I think that lld
> > have to be fixed instead of Xen. It should be noted that binutils ld
> > works without any issue.
>
> Right, but if we can make Xen build nevertheless, this would be better.
> So what we need here is a (re-)explanation of why you've needed to
> do the very change Roger is suggesting to revert.

After commit b199c44 both ELF and PE output need an efi symbol. So, we
cannot use simple "#ifdef EFI" for differentiation as it was earlier.
Going further if build tools are able to generate EFI code then native
Xen EFI code which provides efi symbol is build. Otherwise Xen EFI stub
code is used and efi symbol is provided by linker script. IIRC you
insisted on that. The issue can be solved by adding efi symbol to the
Xen EFI stub code (we can just simply copy existing efi struct from
native Xen EFI code) and removing relevant line from linker script.

Daniel

_______________________________________________
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®.