From nobody Thu May 2 19:40:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1613722228593618.4791262893043; Fri, 19 Feb 2021 00:10:28 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.86795.163189 (Exim 4.92) (envelope-from ) id 1lD0rF-0005cM-TR; Fri, 19 Feb 2021 08:09:49 +0000 Received: by outflank-mailman (output) from mailman id 86795.163189; Fri, 19 Feb 2021 08:09:49 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lD0rF-0005cF-Q3; Fri, 19 Feb 2021 08:09:49 +0000 Received: by outflank-mailman (input) for mailman id 86795; Fri, 19 Feb 2021 08:09:49 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lD0rF-0005br-96 for xen-devel@lists.xenproject.org; Fri, 19 Feb 2021 08:09:49 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 2c365cdf-9d6c-4e2d-a2ad-dfde9c35b33d; Fri, 19 Feb 2021 08:09:48 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 5AEACAC69; Fri, 19 Feb 2021 08:09:47 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 2c365cdf-9d6c-4e2d-a2ad-dfde9c35b33d X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1613722187; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+Mj267HPvJ4mQpGRW6TYWARtkHTN06xccO011IR9F90=; b=HeQ2c+LNm5BbukyHw5AP3xGAfsdLZ4hXalf38/rYH8QK+Aly1KUufg1xbkSCCxwqHDVJTl fPIW+k86eDCVQ7fe41/1qF/axBJcOz8ixxQQ6rQra8qEMBX1MUv1esdtINF+UKWWF9lX4O L/JL+uFNr6HQWOSBjf3PFaeiVJ5gSr4= To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= From: Jan Beulich Subject: [PATCH] x86/EFI: suppress GNU ld 2.36'es creation of base relocs Message-ID: <6ce5b1a7-d7c2-c30c-ad78-233379ea130b@suse.com> Date: Fri, 19 Feb 2021 09:09:43 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" 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 Acked-by: Andrew Cooper --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -123,8 +123,13 @@ ifneq ($(efi-y),) # Check if the compiler supports the MS ABI. export XEN_BUILD_EFI :=3D $(shell $(CC) $(XEN_CFLAGS) -c efi/check.c -o ef= i/check.o 2>/dev/null && echo y) # Check if the linker supports PE. -XEN_BUILD_PE :=3D $(if $(XEN_BUILD_EFI),$(shell $(LD) -mi386pep --subsyste= m=3D10 -S -o efi/check.efi efi/check.o 2>/dev/null && echo y)) +EFI_LDFLAGS =3D $(patsubst -m%,-mi386pep,$(XEN_LDFLAGS)) --subsystem=3D10 = --strip-debug +XEN_BUILD_PE :=3D $(if $(XEN_BUILD_EFI),$(shell $(LD) $(EFI_LDFLAGS) -o ef= i/check.efi efi/check.o 2>/dev/null && echo y)) CFLAGS-$(XEN_BUILD_EFI) +=3D -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 :=3D $(if $(XEN_BUILD_EFI), \ + $(shell $(LD) $(EFI_LDFLAGS) --disable-reloc-sect= ion -o efi/check.efi efi/check.o 2>/dev/null && \ + echo --disable-reloc-section)) endif =20 ALL_OBJS :=3D $(BASEDIR)/arch/x86/boot/built_in.o $(BASEDIR)/arch/x86/efi/= built_in.o $(ALL_OBJS) @@ -177,8 +182,7 @@ note.o: $(TARGET)-syms --rename-section=3D.data=3D.note.gnu.build-id -S $@.bin $@ rm -f $@.bin =20 -EFI_LDFLAGS =3D $(patsubst -m%,-mi386pep,$(XEN_LDFLAGS)) --subsystem=3D10 -EFI_LDFLAGS +=3D --image-base=3D$(1) --stack=3D0,0 --heap=3D0,0 --strip-de= bug +EFI_LDFLAGS +=3D --image-base=3D$(1) --stack=3D0,0 --heap=3D0,0 $(XEN_NO_P= E_FIXUPS) EFI_LDFLAGS +=3D --section-alignment=3D0x200000 --file-alignment=3D0x20 EFI_LDFLAGS +=3D --major-image-version=3D$(XEN_VERSION) EFI_LDFLAGS +=3D --minor-image-version=3D$(XEN_SUBVERSION)