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

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



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

Fix the first issue by using '|' instead of '||', and the second one
by defining the efi symbol based on the EFI define (like it was done
prior to commit b199c44afa).

Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
Cc: Jan Beulich <jbeulich@xxxxxxxx>
Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 xen/arch/x86/xen.lds.S | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index 70afedd31d..a21553d4fc 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -302,10 +302,10 @@ SECTIONS
   .pad : {
     . = ALIGN(MB(16));
   } :text
+#else
+  efi = .;
 #endif
 
-  efi = DEFINED(efi) ? efi : .;
-
   /* Sections to be discarded */
   /DISCARD/ : {
        *(.exit.text)
@@ -331,7 +331,7 @@ SECTIONS
   .comment 0 : { *(.comment) }
 }
 
-ASSERT(__image_base__ > XEN_VIRT_START ||
+ASSERT(__image_base__ > XEN_VIRT_START |
        __2M_rwdata_end <= XEN_VIRT_END - NR_CPUS * PAGE_SIZE,
        "Xen image overlaps stubs area")
 
-- 
2.17.1


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