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

[xen staging-4.20] x86/EFI: correct symbol table generation with older GNU ld



commit 816e71923fb8f99ecac8f7705d99f9aa82d380c8
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Wed Feb 11 12:18:56 2026 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Feb 11 12:18:56 2026 +0100

    x86/EFI: correct symbol table generation with older GNU ld
    
    See the extensive code comment. This isn't really nice, but unless I'm
    overlooking something there doesn't look to be a way to have the linker
    strip individual symbols while doing its work.
    
    Fixes: bf6501a62e80 ("x86-64: EFI boot code")
    Reported-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: Daniel P. Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx>
    master commit: 45bb2789349b996bef19eeb098b6fe47a2b32f5f
    master date: 2026-02-02 09:03:05 +0100
---
 xen/arch/x86/xen.lds.S | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index f13655567a..c19682721d 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -340,6 +340,25 @@ SECTIONS
     *(.reloc)
     __base_relocs_end = .;
   }
+
+  /*
+   * When efi/relocs-dummy.o is linked into the first-pass binary, the two
+   * symbols supplied by it (for ./Makefile to use) may appear in the symbol
+   * table (GNU ld 2.37 and newer strip them, for not being properly
+   * representable).  No such symbols would appear during subsequent passes.
+   * At least some of those older ld versions emit VIRT_START as absolute, but
+   * ALT_START as if it was part of .text.  The symbols tool generating our
+   * own symbol table would hence not ignore it when passed --all-symbols,
+   * leading to the 2nd pass binary having one more symbol than the final (3rd
+   * pass) one.
+   *
+   * Arrange for both (just in case) symbols to always be there, and to always
+   * be absolute (zero).
+   */
+  PROVIDE(VIRT_START = 0);
+  PROVIDE(ALT_START = 0);
+  VIRT_START &= 0;
+  ALT_START &= 0;
 #elif defined(XEN_BUILD_EFI)
   /*
    * Due to the way EFI support is currently implemented, these two symbols
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20



 


Rackspace

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