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

[xen stable-4.14] x86/EFI: suppress GNU ld 2.36'es creation of base relocs



commit 97c0a5c05bb6ff87fd19b6366bb4a3ca006a32da
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Fri Mar 5 15:35:19 2021 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Fri Mar 5 15:35:19 2021 +0100

    x86/EFI: suppress GNU ld 2.36'es creation of base relocs
    
    All of the sudden ld creates base relocations itself, for PE
    executables - as a result we now have two of them for every entity to
    be relocated. While we will likely want to use this down the road, it
    doesn't work quite right yet in corner cases, so rather than suppressing
    our own way of creating the relocations we need to tell ld to avoid
    doing so.
    
    Probe whether --disable-reloc-section (which was introduced by the same
    commit making relocation generation the default) is recognized by ld's PE
    emulation, and use the option if so. (To limit redundancy, move the first
    part of setting EFI_LDFLAGS earlier, and use it already while probing.)
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    master commit: 76cbb9c3f4dd9ab6aa44eeacab84fb88b2e8bfc1
    master date: 2021-02-25 15:11:58 +0100
---
 xen/arch/x86/Makefile | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 7216bd7b68..d45b213ab6 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -176,8 +176,13 @@ EFI_LDFLAGS += --major-subsystem-version=2 
--minor-subsystem-version=0
 # Check if the compiler supports the MS ABI.
 export XEN_BUILD_EFI := $(shell $(CC) $(XEN_CFLAGS) -c efi/check.c -o 
efi/check.o 2>/dev/null && echo y)
 # Check if the linker supports PE.
-XEN_BUILD_PE := $(if $(XEN_BUILD_EFI),$(shell $(LD) -mi386pep --subsystem=10 
-S -o efi/check.efi efi/check.o 2>/dev/null && echo y))
+XEN_BUILD_PE := $(if $(XEN_BUILD_EFI),$(shell $(LD) $(call 
EFI_LDFLAGS,0x100000000) -o efi/check.efi efi/check.o 2>/dev/null && echo y))
 CFLAGS-$(XEN_BUILD_EFI) += -DXEN_BUILD_EFI
+# Check if the linker produces fixups in PE by default (we need to disable it 
doing so for now).
+XEN_NO_PE_FIXUPS := $(if $(XEN_BUILD_EFI), \
+                         $(shell $(LD) $(call EFI_LDFLAGS,0x100000000) 
--disable-reloc-section -o efi/check.efi efi/check.o 2>/dev/null && \
+                                 echo --disable-reloc-section))
+EFI_LDFLAGS += $(XEN_NO_PE_FIXUPS)
 
 $(TARGET).efi: VIRT_BASE = 0x$(shell $(NM) efi/relocs-dummy.o | sed -n 's, A 
VIRT_START$$,,p')
 $(TARGET).efi: ALT_BASE = 0x$(shell $(NM) efi/relocs-dummy.o | sed -n 's, A 
ALT_START$$,,p')
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14



 


Rackspace

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